From a21f038fc335c6d9e77290e613937c234d0a15a1 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Mon, 25 Jun 2012 03:24:53 -0500 Subject: Mark entities as invalid when they get despawned. Addresses BUKKIT-810 --- src/main/java/net/minecraft/server/Entity.java | 1 + src/main/java/net/minecraft/server/World.java | 2 ++ src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | 4 ++++ 3 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 4c5758b8..144dc63c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -143,6 +143,7 @@ public abstract class Entity { public boolean cd; public boolean ce; public UUID uniqueId = UUID.randomUUID(); // CraftBukkit + public boolean valid = true; // CraftBukkit public Entity(World world) { this.id = entityCount++; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index dc8a5f71..589c9320 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -929,6 +929,8 @@ public class World implements IBlockAccess { for (int i = 0; i < this.u.size(); ++i) { ((IWorldAccess) this.u.get(i)).b(entity); } + + entity.valid = false; // CraftBukkit } public void kill(Entity entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index a6d9c377..9ab1e669 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -212,6 +212,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return !entity.isAlive(); } + public boolean isValid() { + return entity.isAlive() && entity.valid; + } + public Server getServer() { return server; } -- cgit v1.2.3