Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-32094

Selectors erroneously find all entities in overlapping blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.5.0.14
    • 1.2.14.3, 1.2.13.54
    • None
    • Unconfirmed
    • Windows

      The bug

      Selector arguments such as c, r, dx, dy, and dz work entirely on the block level – an entity that is physically outside the range will still be detected if it anywhere is inside a block that is partially inside the range.

      How to reproduce

      1. Teleport yourself to the center of some block: /tp @s 0 64 0
      2. Summon an armor stand 1.5 blocks away from you: /summon armor_stand ~ ~ ~1.5
      3. Run a selector from the armor stand: /execute @e[type=armor_stand,c=1] ~ ~ ~ say @a[r=1]
      Expected result: empty output since the player is further than one block away.
      Actual result: player is found.

      The player can continue moving even further away from the armor stand – any position in the block teleported to will be found by the selector, even those that should not be. Even if the armor stand is in a position such that the r=1 "sphere" barely overlaps a block, entities will be found regardless of where they are in that block.

      In practice, this makes precise position selectors difficult or impossible – despite the existence of decimal selector arguments, all searches are done on a per-block level. I used integers exclusively to demonstrate here, but this is easily reproducible with the decimal ones: /execute @e[type=armor_stand,c=1] ~ ~ ~ say @a[r=0.001] should almost never find players, but in reality it finds every player that shares a block with it.

        1. _20180404_170014.JPG
          535 kB
          Katie Heart
        2. screenshot-1.png
          0.8 kB
          [Mod] tryashtar
        3. screenshot-2.png
          346 kB
          [Mod] tryashtar
        4. screenshot-3.png
          76 kB
          [Mod] tryashtar

            tryashtar [Mod] tryashtar
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: