diff --git a/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 6096bf4e2..19013eb22 100644 --- a/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -13,7 +13,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index f4b5792e080d5181184eb661d005ce6cab649bf3..c66ae4d9eea993f3b7fcc6e253259db3346229d1 100644 +index f4b5792e080d5181184eb661d005ce6cab649bf3..35b26f4a4554541affbf76df38fed0f7e555c9b9 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java @@ -21,6 +21,15 @@ public class Vec3i implements Comparable { @@ -21,11 +21,11 @@ index f4b5792e080d5181184eb661d005ce6cab649bf3..c66ae4d9eea993f3b7fcc6e253259db3 private int z; + // Paper start -+ public boolean isValidLocation(net.minecraft.world.level.Level level) { -+ return getX() >= -30000000 && getZ() >= -30000000 && getX() < 30000000 && getZ() < 30000000 && !level.isOutsideBuildHeight(getY()); ++ public boolean isValidLocation(net.minecraft.world.level.LevelHeightAccessor levelHeightAccessor) { ++ return getX() >= -30000000 && getZ() >= -30000000 && getX() < 30000000 && getZ() < 30000000 && !levelHeightAccessor.isOutsideBuildHeight(getY()); + } -+ public boolean isInvalidYLocation(net.minecraft.world.level.Level level) { -+ return level.isOutsideBuildHeight(getY()); ++ public boolean isInvalidYLocation(net.minecraft.world.level.LevelHeightAccessor levelHeightAccessor) { ++ return levelHeightAccessor.isOutsideBuildHeight(getY()); + } + // Paper end + @@ -90,7 +90,7 @@ index c1beb6d5fc3cabfeacf0ffbf563e53ff7984c5d3..452b513e8b89d865a396066adaf4feb1 @Override public FluidState getFluidState(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 9939c4c39549771afe971a6433dfd57e36050dd8..7e5e16fd61b39d2093459766e8aaa10bb05f6763 100644 +index b36a893ded952d1a5ed1a55eae9c3c406848e1f3..092f2cd5806e8609b952e7678c0c38b235c52264 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -337,12 +337,28 @@ public class LevelChunk implements ChunkAccess { diff --git a/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index 50871e155..6f969d64c 100644 --- a/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..0d8ddbc3f8aa22f16907613838ffb9a42f1e6de6 100644 +index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..1f5086a18b9c1c65dc2b09f44ed7c561ba96a847 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -246,6 +246,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { -+ if (!blockposition.isValidLocation()) return; // Paper - SPIGOT-6086 for all invalid locations; avoid acquiring locks ++ if (!pos.isValidLocation(levelHeightAccessor)) return; // Paper - SPIGOT-6086 for all invalid locations; avoid acquiring locks LevelChunk chunk = this.getSendingChunk(); // Paper - no-tick view distance if (chunk != null) {