From e08a433f61703caf371d1fee1119f8e91b255033 Mon Sep 17 00:00:00 2001 From: Johan Friis Date: Sun, 5 Jan 2025 00:23:50 +0100 Subject: [PATCH] Enable BlockStatePredicate list sizes of 1 With existing implementation, `b1` is an empty list, while `b2` is not ``` const b1 = BlockStatePredicate.wrap(['minecraft:oak_log']).getBlockIds(); const b2 = BlockStatePredicate.wrap(['minecraft:oak_log', 'minecraft:birch_log']).getBlockIds(); console.log(b1); console.log(b2); ``` I removed the check for list size > 1 completely, rather than change it to list size > 0, as there should never be a case where list size is < 0, and the empty case is handled in the other branch. Let me know if you would prefer there to be an explicit check for size > 0 and I can update the PR --- .../latvian/mods/kubejs/block/state/BlockStatePredicate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/latvian/mods/kubejs/block/state/BlockStatePredicate.java b/src/main/java/dev/latvian/mods/kubejs/block/state/BlockStatePredicate.java index e6cb95108..4bd2a5b99 100644 --- a/src/main/java/dev/latvian/mods/kubejs/block/state/BlockStatePredicate.java +++ b/src/main/java/dev/latvian/mods/kubejs/block/state/BlockStatePredicate.java @@ -87,7 +87,7 @@ static BlockStatePredicate wrap(Context cx, Object o) { if (list.isEmpty()) { return Simple.NONE; - } else if (list.size() > 1) { + } else { var predicates = new ArrayList(); for (var o1 : list) {