mojira.dev
MC-151628

"/execute unless data block" never runs the command when the block doesn't have the NBT element

Running

/execute if data block ~ ~ ~ Items run say ChestHere

will correctly print ChestHere when standing on a chest. (And not, when you're not doing so.)

However

/execute unless data block ~ ~ ~ Items run say NoChestHere

will not say NoChestHere when not standing on a chest.

Comments 1

Confirmed, though this is probably intended. An error ("the target block is not a block entity") should prevent either condition from succeeding. This behavior is in accordance with /execute if block and unless block both failing when run outside of the world, for example. However, probably the second command should at least print the error when run from chat?

Josh Miller

(Unassigned)

Confirmed

Commands

Minecraft 1.14, 1.16.4, 1.20.2

Retrieved