A collection matcher's `contains` field passes unconditionally for nonempty collections
Run this to get a bundle containing dirt:
/give @s minecraft:bundle[minecraft:bundle_contents=[{id:"minecraft:dirt"}]]
Hold the bundle in your main hand, and enter this to check if the bundle contains a diamond:
/execute if items entity @s weapon.mainhand *[minecraft:bundle_contents~{items:{contains:[{item:"minecraft:diamond"}]}}]
Clearly, the bundle did not contain a diamond, and yet this outputs "Test passed, count: 1".
I tested this on minecraft:bundle_contents and minecraft:container. The only case I could find where this bug doesn't apply is when the collection being matched is empty.
2024-05-24, 04:35 AM
2024-05-24, 07:38 PM
2024-05-24, 04:06 PM
0
0
-