mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
If Entity is added to chunk, look up the chunk if current isnt set
Hopefully will (f)ix #1280... I'm suspicious that Citizens isn't calling things in the same order and causes the current chunk to not be set, which then bugs removals. Though this doesn't make any sense to me, so this likely won't fix it... But if the isAddedToChunk is true, we really should be returning a chunk anyways if its loaded.
This commit is contained in:
parent
189b80e425
commit
372d9c2d4a
2 changed files with 14 additions and 18 deletions
|
@ -4,19 +4,6 @@ Date: Thu, 3 Mar 2016 02:39:54 -0600
|
|||
Subject: [PATCH] Change implementation of (tile)entity removal list
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index aadc426fd..584501787 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
private static final DataWatcherObject<Boolean> aC = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aD = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aE = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
- public boolean aa;
|
||||
+ public boolean aa; public boolean isAddedToChunk() { return aa; } // Paper - OBFHELPER
|
||||
public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER
|
||||
public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER
|
||||
public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index e85ed2e33..89197281e 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
|
|
|
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
|
|||
of having to look it up by hashmap lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 4bbebb25af..ea167a17bb 100644
|
||||
index 4bbebb25a..ea167a17b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk {
|
||||
|
@ -81,9 +81,18 @@ index 4bbebb25af..ea167a17bb 100644
|
|||
// Keep this synced up with World.a(Class)
|
||||
if (entity instanceof EntityInsentient) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 06c72b95f3..c107bd767f 100644
|
||||
index 06c72b95f..0e3a94ab8 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
private static final DataWatcherObject<Boolean> aC = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aD = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aE = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
- public boolean aa;
|
||||
+ public boolean aa; public boolean isAddedToChunk() { return aa; } // Paper - OBFHELPER
|
||||
public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER
|
||||
public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER
|
||||
public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
}
|
||||
|
||||
|
@ -98,7 +107,7 @@ index 06c72b95f3..c107bd767f 100644
|
|||
+ */
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : null;
|
||||
+ return chunk != null && chunk.isLoaded() ? chunk : (isAddedToChunk() ? world.getChunkIfLoaded(getChunkX(), getChunkZ()) : null);
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the chunk at the location, using the entities local cache if avail
|
||||
|
@ -124,7 +133,7 @@ index 06c72b95f3..c107bd767f 100644
|
|||
private MinecraftKey entityKey = getMinecraftKey();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 0176ca530c..29069b753e 100644
|
||||
index 0176ca530..29069b753 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject {
|
||||
|
@ -143,7 +152,7 @@ index 0176ca530c..29069b753e 100644
|
|||
private MinecraftKey tileEntityKey = getMinecraftKey();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index c5a194ffea..833e3111de 100644
|
||||
index c5a194ffe..833e3111d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ import java.util.UUID;
|
||||
|
|
Loading…
Reference in a new issue