Fix insentient watcher not using proper values, and added 'setEnraged'. Not sure if its the proper name, seems to only affect zombie and vindicator from quick tests

This commit is contained in:
libraryaddict 2020-05-15 13:12:44 +12:00
parent 65ee3ed186
commit 54ea63a6c2
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -9,15 +9,15 @@ public class InsentientWatcher extends LivingWatcher {
super(disguise); super(disguise);
} }
public MainHand getMainHand() {
return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT;
}
public void setMainHand(MainHand mainHand) { public void setMainHand(MainHand mainHand) {
setInsentientFlag(2, mainHand == MainHand.RIGHT); setInsentientFlag(2, mainHand == MainHand.RIGHT);
sendData(MetaIndex.INSENTIENT_META); sendData(MetaIndex.INSENTIENT_META);
} }
public MainHand getMainHand() {
return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT;
}
public boolean isAI() { public boolean isAI() {
return getInsentientFlag(1); return getInsentientFlag(1);
} }
@ -31,13 +31,22 @@ public class InsentientWatcher extends LivingWatcher {
byte b0 = getData(MetaIndex.INSENTIENT_META); byte b0 = getData(MetaIndex.INSENTIENT_META);
if (flag) { if (flag) {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 | 1 << i)); setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i));
} else { } else {
setData(MetaIndex.INSENTIENT_META, (byte) (b0 & (~1 << i))); setData(MetaIndex.INSENTIENT_META, (byte) (b0 & i));
} }
} }
private boolean getInsentientFlag(int i) { private boolean getInsentientFlag(int i) {
return (getData(MetaIndex.INSENTIENT_META) & 1 << i) != 0; return (getData(MetaIndex.INSENTIENT_META) & i) != 0;
}
public boolean isEnraged() {
return getInsentientFlag(4);
}
public void setEnraged(boolean enraged) {
setInsentientFlag(4, enraged);
sendData(MetaIndex.INSENTIENT_META);
} }
} }