From 6034ae612a9e56bea1d11a13f5cb2a0412b079a3 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 16 Jul 2013 17:23:53 +1200 Subject: [PATCH] Fixed adult problems. tehehe --- .../disguise/DisguiseTypes/MobDisguise.java | 12 ++++++++++-- .../DisguiseTypes/Watchers/AgeableWatcher.java | 2 +- .../DisguiseTypes/Watchers/PigZombieWatcher.java | 13 +------------ .../DisguiseTypes/Watchers/ZombieWatcher.java | 13 ++++++++++++- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java index 2f40356b..1060f01d 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java @@ -1,13 +1,14 @@ package me.libraryaddict.disguise.DisguiseTypes; import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher; +import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher; public class MobDisguise extends Disguise { private boolean isAdult; public MobDisguise(DisguiseType disguiseType, boolean isAdult) { - super(disguiseType, true); + this(disguiseType, isAdult, true); } public MobDisguise(DisguiseType disguiseType, boolean isAdult, boolean replaceSounds) { @@ -15,11 +16,18 @@ public class MobDisguise extends Disguise { this.isAdult = isAdult; } + public MobDisguise clone() { + MobDisguise disguise = new MobDisguise(getType(), isAdult(), replaceSounds()); + return disguise; + } + public boolean isAdult() { if (getWatcher() != null) { if (getWatcher() instanceof AgeableWatcher) return ((AgeableWatcher) getWatcher()).isAdult(); - return false; + else if (getWatcher() instanceof ZombieWatcher) + return ((ZombieWatcher) getWatcher()).isAdult(); + return isAdult; } return isAdult; } diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/AgeableWatcher.java b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/AgeableWatcher.java index afdb98ff..f4377c28 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/AgeableWatcher.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/AgeableWatcher.java @@ -12,7 +12,7 @@ public abstract class AgeableWatcher extends LivingWatcher { public void setAdult(boolean isAdult) { if (isAdult != isAdult()) { - setValue(12, isAdult ? 0 : -23999); + setValue(12, isAdult ? 0 : -24000); sendData(12); } } diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/PigZombieWatcher.java b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/PigZombieWatcher.java index 2868dfaa..368a09fb 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/PigZombieWatcher.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/PigZombieWatcher.java @@ -1,20 +1,9 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers; -public class PigZombieWatcher extends LivingWatcher { +public class PigZombieWatcher extends ZombieWatcher { public PigZombieWatcher(int entityId) { super(entityId); } - public boolean isBaby() { - return (Byte) getValue(12, (byte) 0) == 1; - } - - public void setBaby(boolean baby) { - if (isBaby() != baby) { - setValue(12, (byte) (baby ? 1 : 0)); - sendData(12); - } - } - } diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/ZombieWatcher.java b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/ZombieWatcher.java index 88dea310..b5bf4f81 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/ZombieWatcher.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Watchers/ZombieWatcher.java @@ -1,15 +1,26 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers; -public class ZombieWatcher extends PigZombieWatcher { +public class ZombieWatcher extends LivingWatcher { public ZombieWatcher(int entityId) { super(entityId); } + public boolean isAdult() { + return (Byte) getValue(12, (byte) 0) == 0; + } + public boolean isVillager() { return (Byte) getValue(13, (byte) 0) == 1; } + public void setAdult(boolean adult) { + if (isAdult() != adult) { + setValue(12, (byte) (adult ? 0 : 1)); + sendData(12); + } + } + public void setVillager(boolean villager) { if (isVillager() != villager) { setValue(13, (byte) (villager ? 1 : 0));