fix a bunch of compile issues

This commit is contained in:
Jake Potrebic
2024-12-14 20:15:49 -08:00
parent 7ac9b00916
commit 0262d9a165
19 changed files with 29 additions and 37 deletions

View File

@@ -47,10 +47,10 @@
+ // copied the last function parameter (listed below)
+ Vec3 vec3d = traverseContext.getFrom().subtract(traverseContext.getTo());
+
+ return BlockHitResult.miss(traverseContext.getTo(), Direction.getApproximateNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo()));
+ return BlockHitResult.miss(traverseContext.getTo(), Direction.getApproximateNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(traverseContext.getTo()));
+ }
+ // Paper end - Prevent raytrace from loading chunks
+ if (blockState.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, blockposition)))) return null; // Paper - Perf: optimise air cases & check canCollide predicate
+ if (blockState.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, traversePos)))) return null; // Paper - Perf: optimise air cases & check canCollide predicate
+ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: don't need to go to world state again
Vec3 from = traverseContext.getFrom();
Vec3 to = traverseContext.getTo();

View File

@@ -130,7 +130,7 @@
+ java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config
+ io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator // Paper - create paper world config
) {
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
+ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.generator = gen;
+ this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
@@ -587,7 +587,7 @@
+ // Paper start - Prevent block entity and entity crashes
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ MinecraftServer.LOGGER.error(msg, var6);
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ // Paper end - Prevent block entity and entity crashes
}

View File

@@ -86,10 +86,10 @@
+ popExperience(level, pos, amount, null);
+ }
+ public void popExperience(ServerLevel level, BlockPos pos, int amount, net.minecraft.world.entity.Entity entity) {
+ // Paper end - add entity paramete
+ // Paper end - add entity parameter
if (level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
- ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount);
+ ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount, entity); // Paper
+ ExperienceOrb.award(level, Vec3.atCenterOf(pos), amount, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, entity); // Paper
}
}

View File

@@ -24,7 +24,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -56,7 +56,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -24,7 +24,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -25,7 +25,7 @@
+ }
+
+ @Override
+ public java.util.List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -20,7 +20,7 @@
+ this.transaction.remove(who);
+ }
+
+ public java.util.List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -26,7 +26,7 @@
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+

View File

@@ -1,10 +1,13 @@
--- a/net/minecraft/world/level/block/entity/LecternBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/LecternBlockEntity.java
@@ -33,6 +_,51 @@
@@ -32,7 +_,53 @@
public static final int NUM_DATA = 1;
public static final int SLOT_BOOK = 0;
public static final int NUM_SLOTS = 1;
public final Container bookAccess = new Container() {
+ // CraftBukkit start - add fields and methods
- public final Container bookAccess = new Container() {
+ // CraftBukkit start - add fields and methods
+ public final Container bookAccess = new LecternInventory();
+ public class LecternInventory implements Container {
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = 1;
+

View File

@@ -137,7 +137,7 @@
if (structureStart.isValid()) {
+ // CraftBukkit start
+ BoundingBox box = structureStart.getBoundingBox();
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structureStart.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkPos.x, chunkPos.z);
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structureManager.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkPos.x, chunkPos.z);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return true;