Remove null values in TileEntity tick list
Because who wouldn't want to tick a null tile entity right? Fixes GH-851
This commit is contained in:
@@ -40,7 +40,7 @@ index 23944088..e8d1a1c6 100644
|
||||
return (long) i & 4294967295L | ((long) j & 4294967295L) << 32;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 12938b9f..7e0ba4b2 100644
|
||||
index 12938b9f..e4fd7fa7 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -74,7 +74,11 @@ index 12938b9f..7e0ba4b2 100644
|
||||
+
|
||||
+ private void removeTileEntitiesForRemovedChunks() {
|
||||
+ if (!this.tileEntitiesChunkToBeRemoved.isEmpty()) {
|
||||
+ java.util.function.Predicate<TileEntity> isInChunk = (tileEntity) -> {
|
||||
+ java.util.function.Predicate<TileEntity> isInChunkOrNull = (tileEntity) -> {
|
||||
+ if (tileEntity == null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ BlockPosition tilePos = tileEntity.getPosition();
|
||||
+ long tileChunkPos = net.minecraft.server.ChunkCoordIntPair.asLong(tilePos.getX() >> 4, tilePos.getZ() >> 4);
|
||||
+ final boolean willRemove = this.tileEntitiesChunkToBeRemoved.contains(tileChunkPos);
|
||||
@@ -90,7 +94,7 @@ index 12938b9f..7e0ba4b2 100644
|
||||
+ return willRemove;
|
||||
+ };
|
||||
+
|
||||
+ this.tileEntityListTick.removeIf(isInChunk);
|
||||
+ this.tileEntityListTick.removeIf(isInChunkOrNull);
|
||||
+ this.tileEntitiesChunkToBeRemoved.clear();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user