diff options
author | feildmaster <admin@feildmaster.com> | 2012-12-28 20:27:41 -0600 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2012-12-28 20:27:41 -0600 |
commit | 538de63a033431352f5060fb5c72356c6c0d0a48 (patch) | |
tree | 115a72645d6fedf8e3e7cea0d4abcfe51721abf9 /src/main/java/net/minecraft/server | |
parent | 509e3d2a328273b08e3a203023b117ad120b31dd (diff) | |
download | craftbukkit-538de63a033431352f5060fb5c72356c6c0d0a48.tar craftbukkit-538de63a033431352f5060fb5c72356c6c0d0a48.tar.gz craftbukkit-538de63a033431352f5060fb5c72356c6c0d0a48.tar.lz craftbukkit-538de63a033431352f5060fb5c72356c6c0d0a48.tar.xz craftbukkit-538de63a033431352f5060fb5c72356c6c0d0a48.zip |
Fix persistence on tamed pets. Fixes BUKKIT-3300
With the persistence api introduced, pets did not have their
persistence flag updated to reflect their persistence. This caused
tame ocelots to not persist under specific conditions.
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/Entity.java | 7 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/EntityWolf.java | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 32804143..381a6312 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -30,7 +30,7 @@ import org.bukkit.plugin.PluginManager; public abstract class Entity { // CraftBukkit start - private static final int CURRENT_LEVEL = 1; + private static final int CURRENT_LEVEL = 2; static boolean isLevelAtLeast(NBTTagCompound tag, int level) { return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -1162,6 +1162,11 @@ public abstract class Entity { if (!nbttagcompound.hasKey("Bukkit.MaxHealth")) { entity.maxHealth = entity.getMaxHealth(); } + + // Reset the persistence for tamed animals + if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) { + entity.persistent = !entity.bj(); + } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java index 19de09e2..8ee33180 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -76,7 +76,8 @@ public class EntityWolf extends EntityTameableAnimal { } protected boolean bj() { - return this.isAngry(); + // CraftBukkit - added && !this.isTamed() + return this.isAngry() && !this.isTamed(); } protected String aY() { |