diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-12-04 23:13:12 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-12-04 23:15:53 -0600 |
commit | 5409d05d3ac1ed77d8d96effd0864f5e3f9af455 (patch) | |
tree | 7cf7a71e82aad03d25e79f25a5aa749e923fd14d /src/main/java/net/minecraft/server | |
parent | b854320fc8967e4d58979d20bbcdd00b2af3d81f (diff) | |
download | craftbukkit-5409d05d3ac1ed77d8d96effd0864f5e3f9af455.tar craftbukkit-5409d05d3ac1ed77d8d96effd0864f5e3f9af455.tar.gz craftbukkit-5409d05d3ac1ed77d8d96effd0864f5e3f9af455.tar.lz craftbukkit-5409d05d3ac1ed77d8d96effd0864f5e3f9af455.tar.xz craftbukkit-5409d05d3ac1ed77d8d96effd0864f5e3f9af455.zip |
Ensure animals don't despawn due to old default setting.
The old default for the persistent flag on mobs was false which was then
written out to their NBT data when they were saved. We now use this data
for all mobs, not just non-animal mobs. However, this means animals that
spawned before that change will now start despawning like monsters do.
To avoid this we add a new flag to the mob's saved data to mark if the
data was saved before or after we started using it and ignore it if it
was before.
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityLiving.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index fff17a2d..b709cb60 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1087,6 +1087,7 @@ 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,7 +1135,13 @@ public abstract class EntityLiving extends Entity { this.deathTicks = nbttagcompound.getShort("DeathTime"); this.attackTicks = nbttagcompound.getShort("AttackTime"); this.canPickUpLoot = nbttagcompound.getBoolean("CanPickUpLoot"); - this.persistent = nbttagcompound.getBoolean("PersistenceRequired"); + // 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) { + this.persistent = data; + } + // CraftBukkit end + NBTTagList nbttaglist; int i; |