Move setcustomname and setcustomnamevisible to FlagWatcher

This commit is contained in:
libraryaddict 2014-09-07 03:32:45 +12:00
parent 7b140d0d36
commit 5115af60a0
2 changed files with 25 additions and 25 deletions

View File

@ -206,6 +206,31 @@ public class FlagWatcher {
return getFlag(5);
}
public String getCustomName() {
return (String) getValue(10, null);
}
public boolean hasCustomName() {
return getCustomName() != null;
}
public boolean isCustomNameVisible() {
return (Byte) getValue(11, (byte) 0) == 1;
}
public void setCustomName(String name) {
if (name != null && name.length() > 64) {
name = name.substring(0, 64);
}
setValue(10, name);
sendData(10);
}
public void setCustomNameVisible(boolean display) {
setValue(11, (byte) (display ? 1 : 0));
sendData(11);
}
public boolean isRightClicking() {
return getFlag(4);
}

View File

@ -69,10 +69,6 @@ public class LivingWatcher extends FlagWatcher {
return clone;
}
public String getCustomName() {
return (String) getValue(10, null);
}
public float getHealth() {
return (Float) getValue(6, 0F);
}
@ -115,18 +111,10 @@ public class LivingWatcher extends FlagWatcher {
return (int) f1 << 16 | (int) f2 << 8 | (int) f3;
}
public boolean hasCustomName() {
return getCustomName() != null;
}
public boolean hasPotionEffect(PotionEffectType type) {
return potionEffects.contains(type.getId());
}
public boolean isCustomNameVisible() {
return (Byte) getValue(11, (byte) 0) == 1;
}
public boolean isMaxHealthSet() {
return maxHealthSet;
}
@ -148,19 +136,6 @@ public class LivingWatcher extends FlagWatcher {
sendData(7);
}
public void setCustomName(String name) {
if (name != null && name.length() > 64) {
name = name.substring(0, 64);
}
setValue(10, name);
sendData(10);
}
public void setCustomNameVisible(boolean display) {
setValue(11, (byte) (display ? 1 : 0));
sendData(11);
}
public void setHealth(float health) {
setValue(6, health);
sendData(6);