mojira.dev
MC-297064

"/Execute if block" Coordinate Command Bug

While trying to use the command below, I ran into some issues:

/execute if block -1 -60 4 minecraft:stone run give @p minecraft:dirt

The command was working inconsistently across different versions and even in different worlds in the same version (where essentially everything was identical.

After an hour of troubleshooting, my friend and I found that the command does not work if the coordinates have at least two negative numbers. For instance, the command would work if the coordinates were 1 -60 4 but not if the coordinates were -1 -60 4. I tested this across multiple versions, and it was all the same. In the same world, if the block was placed somewhere where the coordinates only had one negative, it would work, and if there were two or more negatives, it wouldn’t.

Tested vanilla versions: 1.19.4 full release, 1.20.4 full release, 25w02a snapshot, 1.21 full release, 1.21.1 full release, 1.21.4 full release, 1.21.5 full release

All were tested in creative in superflat normal mode, and 1.21 was also tested in a default normal world

I suspect this issue affects all of the 1.19, 1.20, and 1.21 versions

Linked issues

Attachments

Comments 3

This is not a bug. See MC-36602

(From the moderator notes) The coordinate of a block is the coordinate rounded down, meaning anything from -0.1 to -1.0 is part of the -1 block coordinate. The center of the block at -1 is at -0.5.

If you see the Targeted Block in the debug screen, you’ll see that the stone block’s coordinate is -4 -60 7, not -3 -60 7. You are testing the wrong block.

I tested it out and you’re right. That is so unnecessarily confusing. Anyway, thanks for the help

The Environment field is supposed to only contain PC details.

Thank you for your report!
We are tracking this issue in MC-36602, so this ticket is being resolved and linked as a duplicate.

That ticket has already been resolved as Works As Intended, which means this is not considered a bug and will not be fixed. Please do not leave a comment on the linked ticket.

If you haven’t already, please make use of the search feature to see whether an issue has already been reported.

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

Rainnfall

(Unassigned)

Unconfirmed

(Unassigned)

1.21.5

Retrieved