Added setHideCape to PlayerWatcher

This commit is contained in:
libraryaddict 2014-07-14 13:04:14 +12:00
parent 288882a427
commit abc0be8bae

View File

@ -35,6 +35,28 @@ public class PlayerWatcher extends LivingWatcher {
return isInBed; 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) { public void setArrowsSticking(int arrowsNo) {
setValue(9, (byte) arrowsNo); setValue(9, (byte) arrowsNo);
sendData(9); sendData(9);