aboutsummaryrefslogtreecommitdiff
path: root/defaults/src/main/java/shcm/shsupercm
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-04-25 17:48:42 +0300
committerSHsuperCM <shsupercm@gmail.com>2022-04-25 17:48:42 +0300
commitffa0e186440249e1657268d036ec3036974b9fe9 (patch)
tree4c2de51161b71f0a1c73e4f7923ece97ede80f74 /defaults/src/main/java/shcm/shsupercm
parentbcffd1c8bc953f0498adf99d657d7a5e963fa972 (diff)
downloadCITResewn-ffa0e186440249e1657268d036ec3036974b9fe9.tar.gz
CITResewn-ffa0e186440249e1657268d036ec3036974b9fe9.tar.bz2
CITResewn-ffa0e186440249e1657268d036ec3036974b9fe9.zip
Fixed hand condition parity
Fixes #135
Diffstat (limited to 'defaults/src/main/java/shcm/shsupercm')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionHand.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionHand.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionHand.java
index 0405cbc..d76c90f 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionHand.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionHand.java
@@ -1,6 +1,7 @@
package shcm.shsupercm.fabric.citresewn.defaults.cit.conditions;
import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint;
+import net.minecraft.util.Hand;
import shcm.shsupercm.fabric.citresewn.api.CITConditionContainer;
import shcm.shsupercm.fabric.citresewn.cit.CITContext;
import shcm.shsupercm.fabric.citresewn.cit.builtin.conditions.EnumCondition;
@@ -16,18 +17,12 @@ public class ConditionHand extends EnumCondition<ConditionHand.Hand> {
@Override
protected Hand getValue(CITContext context) {
- if (context.entity.getMainHandStack() == context.stack)
- return Hand.MAINHAND;
- if (context.entity.getOffHandStack() == context.stack)
- return Hand.OFFHAND;
-
- return null;
+ return context.entity != null && context.entity.getOffHandStack() == context.stack ? Hand.OFFHAND : Hand.MAINHAND;
}
@Override
public boolean test(CITContext context) {
- Hand hand = getValue(context);
- return this.value == hand || (this.value == Hand.ANY && hand != null);
+ return this.value == Hand.ANY || this.value == getValue(context);
}
protected enum Hand implements EnumCondition.Aliased {