mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
24 lines
1.2 KiB
Diff
24 lines
1.2 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 7ea68dc8e8bf3795013acbbde0c55a9ff833dfbd..1a0accca970ca5eb895c63c5a45a5261440d0e12 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -344,6 +344,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;
|
|
}
|