Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-80400

Sizelimited entity selectors (@e with c=1,@r with type=!entity) in commands prefer players



    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 1.8.6, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w49b, Minecraft 1.8.9, Minecraft 16w03a, Minecraft 16w04a, Minecraft 16w07b, Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.4, Minecraft 16w21b, Minecraft 1.10, Minecraft 1.10.2, Minecraft 16w33a, Minecraft 16w40a, Minecraft 1.11.2
    • Minecraft 17w45b
    • Confirmed
    • Creative


      The problem:
      The argument "c" in selectors (e.g. "@e[c=1]") is supposed to limit the amount of entities targeted by the selector to the x closest (for c=x) or x furthest (for c=-x) entities, sorted by their distance. However, when used inside a scoreboard command (e.g. "scoreboard players set @e[c=1,r=10] something 0") the selector will first "fill" the available slots with all players that match the remaining criteria, regardless of their distance (compared to other matching entities). When the limit was not reached with player entities alone, other entities will be processed like expected (based on their distance that is).

      How to reproduce:
      Start by creating an objective

      /scoreboard objectives add demo dummy

      and set up the sidebar so you can see it

      /scoreboard objectives setdisplay sidebar demo

      Now just place a command block down and put in a command like

      /scoreboard players add @e[c=1,r=3] demo 1

      Finally, place down an entity (i recommend an Armor stand) next to the command block.
      When you activate the cmd block outside the range (in my example 3), the entity will get a new score. As soon as you are near enough (again, 3 blocks in my example), you will be targeted instead, even if the entity you use is standing between you and the cmd block (which makes it clearly the closer one).


      • Most /scoreboard commands (excluding /scoreboard teams <join|leave> and /scoreboard players tag <target> <add|remove>).
      • The name shown in green from the results of /scoreboard players tag <target> <list> (though the list of tags shown in white is from the correct target).
      • The stored selector for CommandStats.

      Also note skylinerw's comment and code analysis.


        Issue Links



              Unassigned Unassigned
              Wubbi WubbiConcepts
              42 Vote for this issue
              15 Start watching this issue