aboutsummaryrefslogtreecommitdiff
path: root/defaults/src
diff options
context:
space:
mode:
Diffstat (limited to 'defaults/src')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java
index ba73439..3157866 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java
@@ -121,20 +121,23 @@ public class ConditionNBT extends CITCondition {
try {
if (element instanceof NbtString nbtString) //noinspection ConstantConditions
return matchString.matches(nbtString.asString()) || matchString.matches(Text.Serializer.fromJson(nbtString.asString()).getString());
- else if (element instanceof NbtInt nbtInt)
+ else if (element instanceof NbtInt nbtInt && matchInteger != null)
return nbtInt.equals(matchInteger);
- else if (element instanceof NbtByte nbtByte)
+ else if (element instanceof NbtByte nbtByte && matchByte != null)
return nbtByte.equals(matchByte);
- else if (element instanceof NbtFloat nbtFloat)
+ else if (element instanceof NbtFloat nbtFloat && matchFloat != null)
return nbtFloat.equals(matchFloat);
- else if (element instanceof NbtDouble nbtDouble)
+ else if (element instanceof NbtDouble nbtDouble && matchDouble != null)
return nbtDouble.equals(matchDouble);
- else if (element instanceof NbtLong nbtLong)
+ else if (element instanceof NbtLong nbtLong && matchLong != null)
return nbtLong.equals(matchLong);
- else if (element instanceof NbtShort nbtShort)
+ else if (element instanceof NbtShort nbtShort && matchShort != null)
return nbtShort.equals(matchShort);
- else if (element instanceof NbtCompound nbtCompound)
+ else if (element instanceof NbtCompound nbtCompound && matchCompound != null)
return NbtHelper.matches(matchCompound, nbtCompound, true);
+
+ if (element instanceof AbstractNbtNumber nbtNumber && !(matchString instanceof StringMatcher.DirectMatcher))
+ return matchString.matches(String.valueOf(nbtNumber.numberValue()));
} catch (Exception ignored) { }
return false;
}