Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
23 Zeilen
1.1 KiB
Diff
23 Zeilen
1.1 KiB
Diff
From 0000000000000000000000000000000000000000 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/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 5f3d17cb247156fc8aaa7a763e402c2bbb42a7ec..ecb6378a285dff4b34170410387ebb7a8510a6dc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -305,6 +305,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
return chunk == null ? null : chunk.getFluidState(blockposition);
|
|
}
|
|
|
|
+ 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().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
|
}
|