From abc0be8baebdd73561e549d8079db14c6aeebf5f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 14 Jul 2014 13:04:14 +1200 Subject: [PATCH] Added setHideCape to PlayerWatcher --- .../disguisetypes/watchers/PlayerWatcher.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java index 7a3bff28..4abe6c4e 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/PlayerWatcher.java @@ -35,6 +35,28 @@ public class PlayerWatcher extends LivingWatcher { return isInBed; } + public void setHideCape(boolean hideCape) { + setValue16(1, hideCape); + sendData(16); + } + + public boolean isHideCape() { + return getValue16(1); + } + + private boolean getValue16(int i) { + return ((Byte) getValue(16, (byte) 0) & 1 << i) != 0; + } + + private void setValue16(int i, boolean flag) { + byte b0 = (Byte) getValue(16, (byte) 0); + if (flag) { + setValue(16, Byte.valueOf((byte) (b0 | 1 << i))); + } else { + setValue(16, Byte.valueOf((byte) (b0 & (1 << i ^ 0xFFFFFFFF)))); + } + } + public void setArrowsSticking(int arrowsNo) { setValue(9, (byte) arrowsNo); sendData(9);