diff --git a/patches/server/Add-exception-reporting-event.patch b/patches/server/Add-exception-reporting-event.patch index 3f3a58a832..07fc343b0f 100644 --- a/patches/server/Add-exception-reporting-event.patch +++ b/patches/server/Add-exception-reporting-event.patch @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.io.IOException; @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper start - Prevent tile 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()); + 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, throwable); + getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); entity.discard(); diff --git a/patches/server/Configurable-speed-for-water-flowing-over-lava.patch b/patches/server/Configurable-speed-for-water-flowing-over-lava.patch index 4e8bd6dc84..06207aafc5 100644 --- a/patches/server/Configurable-speed-for-water-flowing-over-lava.patch +++ b/patches/server/Configurable-speed-for-water-flowing-over-lava.patch @@ -20,18 +20,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava + public int getFlowSpeed(Level world, BlockPos blockposition) { -+ if (this.material == net.minecraft.world.level.material.Material.WATER) { ++ if (net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) { + if ( -+ world.getMaterialIfLoaded(blockposition.north(1)) == net.minecraft.world.level.material.Material.LAVA || -+ world.getMaterialIfLoaded(blockposition.south(1)) == net.minecraft.world.level.material.Material.LAVA || -+ world.getMaterialIfLoaded(blockposition.west(1)) == net.minecraft.world.level.material.Material.LAVA || -+ world.getMaterialIfLoaded(blockposition.east(1)) == net.minecraft.world.level.material.Material.LAVA ++ isLava(world, blockposition.north(1)) || ++ isLava(world, blockposition.south(1)) || ++ isLava(world, blockposition.west(1)) || ++ isLava(world, blockposition.east(1)) + ) { + return world.paperConfig().environment.waterOverLavaFlowSpeed; + } + } + return this.fluid.getTickDelay(world); + } ++ private static boolean isLava(Level world, BlockPos blockPos) { ++ final FluidState fluidState = world.getFluidIfLoaded(blockPos); ++ return fluidState != null && fluidState.is(FluidTags.LAVA); ++ } + // Paper end + @Override diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 3fe2d5dfcd..e4c835e605 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -6738,21 +6738,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.material.FluidState; -+import net.minecraft.world.level.material.Material; - import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.BlockHitResult; - import net.minecraft.world.phys.Vec3; @@ -0,0 +0,0 @@ public interface BlockGetter extends LevelHeightAccessor { } BlockState getBlockState(BlockPos pos); + // Paper start - if loaded util + @Nullable BlockState getBlockStateIfLoaded(BlockPos blockposition); -+ default @Nullable Material getMaterialIfLoaded(BlockPos blockposition) { -+ BlockState type = this.getBlockStateIfLoaded(blockposition); -+ return type == null ? null : type.getMaterial(); -+ } + + default @Nullable Block getBlockIfLoaded(BlockPos blockposition) { + BlockState type = this.getBlockStateIfLoaded(blockposition); @@ -7071,7 +7062,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end + // Paper start -+ public @Nullable ChunkHolder playerChunk; ++ public @Nullable net.minecraft.server.level.ChunkHolder playerChunk; + + static final int NEIGHBOUR_CACHE_RADIUS = 3; + public static int getNeighbourCacheRadius() { diff --git a/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 7aa87af48a..04e66a7d69 100644 --- a/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Prevent armor stands from doing entity lookups + @Override + public boolean noCollision(@Nullable Entity entity, AABB box) { -+ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level.paperConfig().entities.armorStands.doCollisionEntityLookups) return false; ++ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return false; + return LevelAccessor.super.noCollision(entity, box); + } + // Paper end diff --git a/patches/server/Prevent-tile-entity-and-entity-crashes.patch b/patches/server/Prevent-tile-entity-and-entity-crashes.patch index 07804191ec..c6c5b49a18 100644 --- a/patches/server/Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/Prevent-tile-entity-and-entity-crashes.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - entity.fillCrashReportCategory(crashreportsystemdetails); - throw new ReportedException(crashreport); + // Paper start - Prevent tile 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()); ++ 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, throwable); + entity.discard(); + // Paper end