Fixed ocelot settamed and setsitting not working. added issitting and istamed

This commit is contained in:
libraryaddict 2013-12-17 07:46:30 +13:00
parent e4d71bb6a4
commit e221dc4757

View File

@ -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) {