Paper/Spigot-Server-Patches/0129-Optimize-World.isLoaded-BlockPosition-Z.patch
Shane Freeder 0708fa363b
Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
eb2e6578 SPIGOT-5116: Fix concurrent modification exception inside ChunkMapDistance
989f9b3d SPIGOT-4849: Fix server crash when accessing chunks during chunk load/unload/populate events
f554183c SPIGOT-5171: Don't fire PlayerTeleportEvent if not actually moving
2349feb8 SPIGOT-5163: Cancelling PlayerBucketFillEvent visually removes the targeted block

Spigot Changes:
9a643a6a Remove DataWatcher Locking
2019-07-16 23:09:32 +01:00

26 lines
1.0 KiB
Diff

From afe90ec5ec5202911c92ff2b497d734b76057256 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4ce18f85b..cfdb6b57f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -209,6 +209,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
return i < 0 || i >= 256;
}
+ public boolean isLoaded(BlockPosition blockposition) {
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; // Paper
+ }
+
// Paper start
public boolean isLoadedAndInBounds(BlockPosition blockposition) {
return getWorldBorder().isInBounds(blockposition) && getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
--
2.22.0