diff options
Diffstat (limited to 'patches/unapplied/server/0071-Add-World-Util-Methods.patch')
-rw-r--r-- | patches/unapplied/server/0071-Add-World-Util-Methods.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/unapplied/server/0071-Add-World-Util-Methods.patch b/patches/unapplied/server/0071-Add-World-Util-Methods.patch new file mode 100644 index 0000000000..4c7b9c4d27 --- /dev/null +++ b/patches/unapplied/server/0071-Add-World-Util-Methods.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Fri, 18 Mar 2016 20:16:03 -0400 +Subject: [PATCH] Add World Util Methods + +Methods that can be used for other patches to help improve logic. + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index f900c86697f5a3da45b724944a663fca8f89413e..d1b117f25bafb294f00c18be02be593061120956 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -339,6 +339,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return chunk == null ? null : chunk.getFluidState(blockposition); + } + ++ public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline ++ return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; ++ } ++ ++ public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { // Overridden in WorldServer for ABI compat which has final ++ return ((ServerLevel) this).getChunkSource().getChunkAtIfLoadedImmediately(x, z); ++ } ++ public final @Nullable LevelChunk getChunkIfLoaded(BlockPos blockposition) { ++ return ((ServerLevel) this).getChunkSource().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ } ++ ++ // reduces need to do isLoaded before getType ++ public final @Nullable BlockState getBlockStateIfLoadedAndInBounds(BlockPos blockposition) { ++ return getWorldBorder().isWithinBounds(blockposition) ? getBlockStateIfLoaded(blockposition) : null; ++ } ++ + @Override + public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { + // Paper end |