diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 8 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/EntityLiving.java | 15 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 9471fcf1..ba09ace7 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -29,6 +29,13 @@ import org.bukkit.plugin.PluginManager; public abstract class Entity { + // CraftBukkit start + private static final int CURRENT_LEVEL = 1; + static boolean isLevelAtLeast(NBTTagCompound tag, int level) { + return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; + } + // CraftBukkit end + private static int entityCount = 0; public int id; public double l; @@ -1087,6 +1094,7 @@ public abstract class Entity { nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits()); nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits()); + nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); // CraftBukkit end this.b(nbttagcompound); } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 458e44f0..5cbac214 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1087,7 +1087,6 @@ public abstract class EntityLiving extends Entity { nbttagcompound.setShort("AttackTime", (short) this.attackTicks); nbttagcompound.setBoolean("CanPickUpLoot", this.canPickUpLoot); nbttagcompound.setBoolean("PersistenceRequired", this.persistent); - nbttagcompound.setBoolean("Bukkit.PersistenceUpdated", true); // CraftBukkit NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.equipment.length; ++i) { @@ -1134,13 +1133,15 @@ public abstract class EntityLiving extends Entity { this.hurtTicks = nbttagcompound.getShort("HurtTime"); this.deathTicks = nbttagcompound.getShort("DeathTime"); this.attackTicks = nbttagcompound.getShort("AttackTime"); - this.canPickUpLoot = nbttagcompound.getBoolean("CanPickUpLoot"); - // CraftBukkit start - if persistence is false only use it if it was set after we started using it - boolean data = nbttagcompound.getBoolean("PersistenceRequired"); - if (nbttagcompound.hasKey("Bukkit.PersistenceUpdated") || data) { + // CraftBukkit start - if looting or persistence is false only use it if it was set after we started using it + boolean data = nbttagcompound.getBoolean("CanPickUpLoot"); + if (isLevelAtLeast(nbttagcompound, 1) || data) { + this.canPickUpLoot = data; + } + + data = nbttagcompound.getBoolean("PersistenceRequired"); + if (isLevelAtLeast(nbttagcompound, 1) || data) { this.persistent = data; - } else { - this.persistent = !this.bj(); } // CraftBukkit end |