Did I screw up isAdult.. Huh

This commit is contained in:
libraryaddict 2014-05-24 05:18:24 +12:00
parent 19aabb2656
commit 7c12b2e0b3
2 changed files with 14 additions and 9 deletions

View File

@ -267,8 +267,9 @@ public class FlagWatcher {
} }
public void setArmor(ItemStack[] itemstack) { public void setArmor(ItemStack[] itemstack) {
for (int i = 0; i < itemstack.length; i++) for (int i = 0; i < itemstack.length; i++) {
setItemStack(i, itemstack[i]); setItemStack(i, itemstack[i]);
}
} }
protected void setBackupValue(int no, Object value) { protected void setBackupValue(int no, Object value) {
@ -310,14 +311,16 @@ public class FlagWatcher {
} else { } else {
itemStack = enquipment.getArmorContents()[slot]; itemStack = enquipment.getArmorContents()[slot];
} }
if (itemStack != null && itemStack.getTypeId() == 0) if (itemStack != null && itemStack.getTypeId() == 0) {
itemStack = null; itemStack = null;
}
} }
} }
Object itemToSend = null; Object itemToSend = null;
if (itemStack != null && itemStack.getTypeId() != 0) if (itemStack != null && itemStack.getTypeId() != 0) {
itemToSend = ReflectionManager.getNmsItem(itemStack); itemToSend = ReflectionManager.getNmsItem(itemStack);
}
items[slot] = itemStack; items[slot] = itemStack;
if (DisguiseAPI.isDisguiseInUse(getDisguise())) { if (DisguiseAPI.isDisguiseInUse(getDisguise())) {
slot++; slot++;

View File

@ -18,7 +18,8 @@ public class MobDisguise extends TargetedDisguise {
public MobDisguise(DisguiseType disguiseType, boolean isAdult) { public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
if (!disguiseType.isMob()) { if (!disguiseType.isMob()) {
throw new InvalidParameterException("Expected a living DisguiseType while constructing MobDisguise. Received " throw new InvalidParameterException("Expected a living DisguiseType while constructing MobDisguise. Received "
+ disguiseType + " instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MiscDisguise") + " instead"); + disguiseType + " instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MiscDisguise")
+ " instead");
} }
this.isAdult = isAdult; this.isAdult = isAdult;
createDisguise(disguiseType); createDisguise(disguiseType);
@ -70,11 +71,12 @@ public class MobDisguise extends TargetedDisguise {
public boolean isAdult() { public boolean isAdult() {
if (getWatcher() != null) { if (getWatcher() != null) {
if (getWatcher() instanceof AgeableWatcher) if (getWatcher() instanceof AgeableWatcher) {
return ((AgeableWatcher) getWatcher()).isBaby(); return ((AgeableWatcher) getWatcher()).isAdult();
else if (getWatcher() instanceof ZombieWatcher) } else if (getWatcher() instanceof ZombieWatcher) {
return ((ZombieWatcher) getWatcher()).isBaby(); return ((ZombieWatcher) getWatcher()).isAdult();
return false; }
return true;
} }
return isAdult; return isAdult;
} }