mojira.dev
MC-269682

"execute if items" count check results incorrectly

Steps to reproduce:

1) Put down a container (a barrel for example). Put 3 diamond swords in it.

2) Stand on the container and run this command:

execute if items block ~ ~-1 ~ container.* minecraft:diamond_sword[minecraft:count={max:1}]

Result: The command succeeds with "Test passed, count: 3"

Expected Result: The command should fail. The amount of diamond swords in the container is more than 1.

This seems to be happening with unstackable items. Stackable item checks work fine.

Comments 4

Thank you for your report!
After consideration, the issue is being closed as Invalid.

This report does not describe a bug.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

This is the intended behaviour. 🙂 The item predicate `minecraft:diamond_sword[minecraft:count={max:1}]` is checking each stack that individually has <=1 stack size. All 3 item stacks match that predicate, so they are all included in the result of the command.

Is it possible to rewrite this command to check total amount of items instead of items per stack?

Wyvernity

(Unassigned)

Community Consensus

Commands

24w12a

Retrieved