Move setcustomname and setcustomnamevisible to FlagWatcher
This commit is contained in:
		| @@ -206,6 +206,31 @@ public class FlagWatcher { | |||||||
|         return getFlag(5); |         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() { |     public boolean isRightClicking() { | ||||||
|         return getFlag(4); |         return getFlag(4); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -69,10 +69,6 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|         return clone; |         return clone; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public String getCustomName() { |  | ||||||
|         return (String) getValue(10, null); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public float getHealth() { |     public float getHealth() { | ||||||
|         return (Float) getValue(6, 0F); |         return (Float) getValue(6, 0F); | ||||||
|     } |     } | ||||||
| @@ -115,18 +111,10 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|         return (int) f1 << 16 | (int) f2 << 8 | (int) f3; |         return (int) f1 << 16 | (int) f2 << 8 | (int) f3; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean hasCustomName() { |  | ||||||
|         return getCustomName() != null; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public boolean hasPotionEffect(PotionEffectType type) { |     public boolean hasPotionEffect(PotionEffectType type) { | ||||||
|         return potionEffects.contains(type.getId()); |         return potionEffects.contains(type.getId()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isCustomNameVisible() { |  | ||||||
|         return (Byte) getValue(11, (byte) 0) == 1; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public boolean isMaxHealthSet() { |     public boolean isMaxHealthSet() { | ||||||
|         return maxHealthSet; |         return maxHealthSet; | ||||||
|     } |     } | ||||||
| @@ -148,19 +136,6 @@ public class LivingWatcher extends FlagWatcher { | |||||||
|         sendData(7); |         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) { |     public void setHealth(float health) { | ||||||
|         setValue(6, health); |         setValue(6, health); | ||||||
|         sendData(6); |         sendData(6); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user