diff options
Diffstat (limited to 'patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch')
-rw-r--r-- | patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch new file mode 100644 index 0000000000..da22f581ab --- /dev/null +++ b/patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Fri, 2 Dec 2016 00:11:43 -0500 +Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z + +Reduce method invocations for World.isLoaded(BlockPosition)Z + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 807df663f710311276d69288875bb80e7fa37893..64b763d6dc695e9cb9dd381deb5609e4902713dd 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -334,6 +334,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return chunk == null ? null : chunk.getFluidState(blockposition); + } + ++ @Override ++ public final boolean hasChunkAt(BlockPos pos) { ++ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper ++ } ++ + public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline + return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; + } |