mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
55d5c1650f
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 17c35d6e SPIGOT-6637: Revert "#636: Add FurnaceStartSmeltEvent" 4b27230b SPIGOT-6623: Missing API reasons for entity freezing e1528c85 #636: Add FurnaceStartSmeltEvent CraftBukkit Changes: a6292cc3 SPIGOT-6637: Revert "#874: Add FurnaceStartSmeltEvent" f4066854 SPIGOT-6579: DragonFireBall movement with setDirection jumps around a lot 9add952b SPIGOT-6623: Missing API reasons for entity freezing 2ea359f1 #874: Add FurnaceStartSmeltEvent be8d625e SPIGOT-5560, SPIGOT-6574, SPIGOT-6632: Remove no longer needed tile entity fix Spigot Changes: eac3cd96 Rebuild patches
53 lines
2.7 KiB
Diff
53 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
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/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 6bde7dee09b9cf2b3acd66f9c9d55b338f20fe25..a13d70d6e4a6c60e61f0c8c1b5bb88b092a110a0 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -198,7 +198,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
public final LevelStorageSource.LevelStorageAccess convertable;
|
|
public final UUID uuid;
|
|
|
|
- public LevelChunk getChunkIfLoaded(int x, int z) {
|
|
+ @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
|
return this.chunkSource.getChunk(x, z, false);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 33b20b43961051d2c116871ad63baa908fa71cd5..8eff4c4b82cd2d0d58af00c6c88f156315d53600 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -310,11 +310,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
@Override
|
|
- public FluidState getFluidIfLoaded(BlockPos blockposition) {
|
|
+ public final FluidState getFluidIfLoaded(BlockPos blockposition) {
|
|
ChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
|
|
|
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 LevelChunk getChunkIfLoaded(int x, int z) { // Overridden in WorldServer for ABI compat which has final
|
|
+ return ((ServerLevel) this).getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
|
+ }
|
|
+ public final LevelChunk getChunkIfLoaded(BlockPos blockposition) {
|
|
+ return ((ServerLevel) this).getChunkSource().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
|
+ }
|
|
+
|
|
+ // reduces need to do isLoaded before getType
|
|
+ public final BlockState getTypeIfLoadedAndInBounds(BlockPos blockposition) {
|
|
+ return getWorldBorder().isWithinBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|