aboutsummaryrefslogtreecommitdiff
path: root/defaults
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-09-10 10:58:58 +0300
committerSHsuperCM <shsupercm@gmail.com>2022-09-10 10:58:58 +0300
commitf82becce3a0def5652d93d35759ce333352ec6b8 (patch)
tree64b5b67fcf7bd8138ddad2a2fdad663cf0ea9b84 /defaults
parent736f838416a4f96c6e0c23a6658381835096993d (diff)
downloadCITResewn-f82becce3a0def5652d93d35759ce333352ec6b8.tar.gz
CITResewn-f82becce3a0def5652d93d35759ce333352ec6b8.tar.bz2
CITResewn-f82becce3a0def5652d93d35759ce333352ec6b8.zip
Added count check to nbt list conditions
Closes #195
Diffstat (limited to 'defaults')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionNBT.java6
1 files changed, 5 insertions, 1 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 3157866..e382d6f 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
@@ -108,10 +108,14 @@ public class ConditionNBT extends CITCondition {
} else {
if (element instanceof NbtCompound compound)
return testPath(compound.get(path), pathIndex + 1);
- else if (element instanceof NbtList list)
+ else if (element instanceof NbtList list) {
+ if (path.equals("count"))
+ return testValue(NbtInt.of(list.size()));
+
try {
return testPath(list.get(Integer.parseInt(path)), pathIndex + 1);
} catch (NumberFormatException | IndexOutOfBoundsException ignored) { }
+ }
}
return false;