aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch')
-rw-r--r--patches/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/server/0115-Optimize-Level.hasChunkAt-BlockPosition-Z.patch
new file mode 100644
index 0000000000..ee46f05dc0
--- /dev/null
+++ b/patches/server/0115-Optimize-Level.hasChunkAt-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 Level.hasChunkAt(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 008be3aad044d20be14da3a9e96933d265104587..03b0720c6ebf1a876d56d18a941e0a06ed26dbf0 100644
+--- a/src/main/java/net/minecraft/world/level/Level.java
++++ b/src/main/java/net/minecraft/world/level/Level.java
+@@ -342,6 +342,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 - Perf: Optimize Level.hasChunkAt(BlockPosition)Z
++ }
++
+ public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline
+ return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
+ }