Tiny code cleanup
This commit is contained in:
		| @@ -46,7 +46,7 @@ public class FlagWatcher { | |||||||
|     @Getter(value = AccessLevel.PROTECTED) |     @Getter(value = AccessLevel.PROTECTED) | ||||||
|     private HashMap<Integer, Object> entityValues = new HashMap<>(); |     private HashMap<Integer, Object> entityValues = new HashMap<>(); | ||||||
|     private LibsEquipment equipment; |     private LibsEquipment equipment; | ||||||
|     private boolean hasDied; |     private transient boolean hasDied; | ||||||
|     @Getter |     @Getter | ||||||
|     private boolean[] modifiedEntityAnimations = new boolean[8]; |     private boolean[] modifiedEntityAnimations = new boolean[8]; | ||||||
|     private transient List<WrappedWatchableObject> watchableObjects; |     private transient List<WrappedWatchableObject> watchableObjects; | ||||||
|   | |||||||
| @@ -3,36 +3,29 @@ package me.libraryaddict.disguise.disguisetypes.watchers; | |||||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||||
| import me.libraryaddict.disguise.disguisetypes.MetaIndex; | import me.libraryaddict.disguise.disguisetypes.MetaIndex; | ||||||
|  |  | ||||||
| public class AgeableWatcher extends InsentientWatcher | public class AgeableWatcher extends InsentientWatcher { | ||||||
| { |     public AgeableWatcher(Disguise disguise) { | ||||||
|     public AgeableWatcher(Disguise disguise) |  | ||||||
|     { |  | ||||||
|         super(disguise); |         super(disguise); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isAdult() |     public boolean isAdult() { | ||||||
|     { |  | ||||||
|         return !isBaby(); |         return !isBaby(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isBaby() |     public boolean isBaby() { | ||||||
|     { |  | ||||||
|         return getData(MetaIndex.AGEABLE_BABY); |         return getData(MetaIndex.AGEABLE_BABY); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setAdult() |     public void setBaby(boolean isBaby) { | ||||||
|     { |  | ||||||
|         setBaby(false); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setBaby() |  | ||||||
|     { |  | ||||||
|         setBaby(true); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setBaby(boolean isBaby) |  | ||||||
|     { |  | ||||||
|         setData(MetaIndex.AGEABLE_BABY, isBaby); |         setData(MetaIndex.AGEABLE_BABY, isBaby); | ||||||
|         sendData(MetaIndex.AGEABLE_BABY); |         sendData(MetaIndex.AGEABLE_BABY); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public void setAdult() { | ||||||
|  |         setBaby(false); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setBaby() { | ||||||
|  |         setBaby(true); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -6,63 +6,49 @@ import me.libraryaddict.disguise.disguisetypes.MetaIndex; | |||||||
| import java.util.Optional; | import java.util.Optional; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| public class TameableWatcher extends AgeableWatcher | public class TameableWatcher extends AgeableWatcher { | ||||||
| { |     public TameableWatcher(Disguise disguise) { | ||||||
|     public TameableWatcher(Disguise disguise) |  | ||||||
|     { |  | ||||||
|         super(disguise); |         super(disguise); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public Optional<UUID> getOwner() |     public Optional<UUID> getOwner() { | ||||||
|     { |  | ||||||
|         return getData(MetaIndex.TAMEABLE_OWNER); |         return getData(MetaIndex.TAMEABLE_OWNER); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isSitting() |     public void setOwner(UUID owner) { | ||||||
|     { |         setData(MetaIndex.TAMEABLE_OWNER, Optional.of(owner)); | ||||||
|  |         sendData(MetaIndex.TAMEABLE_OWNER); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public boolean isSitting() { | ||||||
|         return isTameableFlag(1); |         return isTameableFlag(1); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isTamed() |     public void setSitting(boolean sitting) { | ||||||
|     { |         setTameableFlag(1, sitting); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public boolean isTamed() { | ||||||
|         return isTameableFlag(4); |         return isTameableFlag(4); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected boolean isTameableFlag(int no) |     public void setTamed(boolean tamed) { | ||||||
|     { |         setTameableFlag(4, tamed); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     protected boolean isTameableFlag(int no) { | ||||||
|         return (getData(MetaIndex.TAMEABLE_META) & no) != 0; |         return (getData(MetaIndex.TAMEABLE_META) & no) != 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected void setTameableFlag(int no, boolean flag) |     protected void setTameableFlag(int no, boolean flag) { | ||||||
|     { |  | ||||||
|         byte value = getData(MetaIndex.TAMEABLE_META); |         byte value = getData(MetaIndex.TAMEABLE_META); | ||||||
|  |  | ||||||
|         if (flag) |         if (flag) { | ||||||
|         { |  | ||||||
|             setData(MetaIndex.TAMEABLE_META, (byte) (value | no)); |             setData(MetaIndex.TAMEABLE_META, (byte) (value | no)); | ||||||
|         } |         } else { | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             setData(MetaIndex.TAMEABLE_META, (byte) (value & -(no + 1))); |             setData(MetaIndex.TAMEABLE_META, (byte) (value & -(no + 1))); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         sendData(MetaIndex.TAMEABLE_META); |         sendData(MetaIndex.TAMEABLE_META); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setOwner(UUID owner) |  | ||||||
|     { |  | ||||||
|         setData(MetaIndex.TAMEABLE_OWNER, Optional.of(owner)); |  | ||||||
|         sendData(MetaIndex.TAMEABLE_OWNER); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setSitting(boolean sitting) |  | ||||||
|     { |  | ||||||
|         setTameableFlag(1, sitting); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setTamed(boolean tamed) |  | ||||||
|     { |  | ||||||
|         setTameableFlag(4, tamed); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user