mojira.dev
MC-172035

Selector distance argument is position based while dx,dy,dz are hitbox based

The bug

It appears the following selector arguments do not behave consistently:

  • distance: Finds entities whose position (center of the hitbox) is within the area

  • dx, dy, dz: Finds entities whose hitbox intersects with the area

This might be intended, but can also have unexpected side-effects and be unintuitive.

How to reproduce

  1. Place a block at (0,0) in the floor so you know where it is

  2. Show hitboxes (F3 + B)

  3. Move around (0,0) and run the following command

    /say @s[x=0.5,z=0.5,distance=..0.5]

    It finds you as soon as the center of your hitbox is inside a circular area with center at (0.5,0.5) with radius 0.5

  4. Move around (0,0) and run the following command

    /say @s[x=0.0,z=0.0,dx=0,dz=0]

    It finds you as soon as your hitbox intersects with the block area of (0,0)

Linked issues

Comments 1

I was thinking about position/hitbox arguments and it appears that all should be position, as they can be more precise. In the other hand, mobs have different hitboxes, so it would be harder to see what touches specified coords. Other solution would be adding a new argument to command selectors "select=position/hitbox" with default position to keep old contraptions easy to fix.

Example of usage:

/tp @e[x=2..3,y=4..5,z=6..,select=position] @e[x=0,y=9,z=..2,select=hitbox]

marcono1234

(Unassigned)

Confirmed

Commands

20w06a

Retrieved