diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/EntityPose.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/EntityPose.java index 0f5b6afc..8e83c743 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/EntityPose.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/EntityPose.java @@ -9,6 +9,6 @@ public enum EntityPose { SLEEPING, SWIMMING, SPIN_ATTACK, - SNEAKING, + CROUCHING, DYING } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 01361047..852a93f7 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -38,6 +38,8 @@ public class FlagWatcher { private boolean hasDied; private boolean[] modifiedEntityAnimations = new boolean[8]; private transient List watchableObjects; + private boolean sleeping; + private boolean swimming; public FlagWatcher(Disguise disguise) { this.disguise = (TargetedDisguise) disguise; @@ -542,9 +544,50 @@ public class FlagWatcher { public void setSneaking(boolean setSneaking) { setEntityFlag(1, setSneaking); + updatePose(); sendData(MetaIndex.ENTITY_META); } + public boolean isSleeping() { + return sleeping; + } + + public void setSleeping(boolean sleeping) { + if (isSleeping() == sleeping) { + return; + } + + this.sleeping = sleeping; + + updatePose(); + } + + public boolean isSwimming() { + return swimming; + } + + public void setSwimming(boolean swimming) { + if (isSwimming() == swimming) { + return; + } + + this.swimming = swimming; + + updatePose(); + } + + protected void updatePose() { + if (isSleeping()) { + setEntityPose(EntityPose.SLEEPING); + } else if (isSwimming()) { + setEntityPose(EntityPose.SWIMMING); + } else if (isSneaking()) { + setEntityPose(EntityPose.CROUCHING); + } else { + setEntityPose(EntityPose.STANDING); + } + } + public void setSprinting(boolean setSprinting) { setEntityFlag(3, setSprinting); sendData(MetaIndex.ENTITY_META); diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java index 7c533c14..2bd0385b 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java @@ -54,11 +54,6 @@ public class PlayerWatcher extends LivingWatcher { return MainHand.values()[getData(MetaIndex.PLAYER_HAND)]; } - @Deprecated - public BlockFace getSleepingDirection() { - return BlockFace.SELF; - } - // Bit 0 (0x01): Cape enabled // Bit 1 (0x02): Jacket enabled // Bit 2 (0x04): Left Sleeve enabled @@ -141,11 +136,6 @@ public class PlayerWatcher extends LivingWatcher { sendData(MetaIndex.PLAYER_SKIN); } - @Deprecated - public boolean isSleeping() { - return getEntityPose() == EntityPose.SLEEPING; - } - public void setSkin(String playerName) { ((PlayerDisguise) getDisguise()).setSkin(playerName); } @@ -154,32 +144,6 @@ public class PlayerWatcher extends LivingWatcher { ((PlayerDisguise) getDisguise()).setSkin(profile); } - @Deprecated - public void setSleeping(BlockFace sleepingDirection) { - setSleeping(true, sleepingDirection); - } - - @Deprecated - public void setSleeping(boolean sleep) { - setSleeping(sleep, null); - } - - /** - * If no BlockFace is supplied. It grabs it from the entities facing direction if applicable. - * - * @param sleeping - * @param sleepingDirection - */ - - @Deprecated - public void setSleeping(boolean sleeping, BlockFace sleepingDirection) { - if (sleeping == isSleeping()) { - return; - } - - setEntityPose(sleeping ? EntityPose.SLEEPING : EntityPose.STANDING); - } - private void setSkinFlags(int i, boolean flag) { byte b0 = getData(MetaIndex.PLAYER_SKIN);