From 54ea63a6c255382b5f404b23b51bbe1026917642 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 15 May 2020 13:12:44 +1200 Subject: [PATCH] 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 --- .../watchers/InsentientWatcher.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java index 3672535c..00a18896 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java @@ -9,15 +9,15 @@ public class InsentientWatcher extends LivingWatcher { super(disguise); } + public MainHand getMainHand() { + return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT; + } + public void setMainHand(MainHand mainHand) { setInsentientFlag(2, mainHand == MainHand.RIGHT); sendData(MetaIndex.INSENTIENT_META); } - public MainHand getMainHand() { - return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT; - } - public boolean isAI() { return getInsentientFlag(1); } @@ -31,13 +31,22 @@ public class InsentientWatcher extends LivingWatcher { byte b0 = getData(MetaIndex.INSENTIENT_META); if (flag) { - setData(MetaIndex.INSENTIENT_META, (byte) (b0 | 1 << i)); + setData(MetaIndex.INSENTIENT_META, (byte) (b0 | i)); } else { - setData(MetaIndex.INSENTIENT_META, (byte) (b0 & (~1 << i))); + setData(MetaIndex.INSENTIENT_META, (byte) (b0 & 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); } }