From e221dc4757492680b8cd8317053324a7f7e1f446 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 17 Dec 2013 07:46:30 +1300 Subject: [PATCH] Fixed ocelot settamed and setsitting not working. added issitting and istamed --- .../disguisetypes/watchers/OcelotWatcher.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java index f1c84514..860cc075 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/OcelotWatcher.java @@ -19,19 +19,39 @@ public class OcelotWatcher extends AgeableWatcher { return Ocelot.Type.getType((Byte) getValue(18, (byte) 0)); } + public boolean isSitting() { + return isTrue(1); + } + + public boolean isTamed() { + return isTrue(4); + } + + private boolean isTrue(int no) { + return ((Byte) getValue(16, (byte) 0) & no) != 0; + } + + private void setFlag(int no, boolean flag) { + byte b0 = (Byte) getValue(16, (byte) 0); + if (flag) { + setValue(16, (byte) (b0 | no)); + } else { + setValue(16, (byte) (b0 & -(no + 1))); + } + sendData(16); + } + public void setOwner(String newOwner) { setValue(17, newOwner); sendData(17); } public void setSitting(boolean sitting) { - setFlag(16, 1, sitting); - sendData(16); + setFlag(1, sitting); } public void setTamed(boolean tamed) { - setFlag(16, 4, tamed); - sendData(16); + setFlag(4, tamed); } public void setType(Type newType) {