Presumably this is a problem with all commands using cubic selectors however most visible with /kill. Using /kill alongside x,y,z,dx,dy,dz to define a cubic search area does not kill the next entity in-line. (Whether or not the sorting is done by distance or creation time.)
I've done a bit of testing and it seems that the result depends on the chunk the entity is in: /kill is misleadingly processing which entity to kill next on a chunk-by chunk basis within the search area, rather than the search area as a whole. Chunks closest to 0,0 are processed first.
Simply put: the list of entities is not being sorted by absolute_distance / creation_time before returning the first item.
To reproduce: spawn several entities diagonally across several chunks (3 or more chunks). Use /kill with a large square box (x,y,z,dx,dy,dz) that covers all chunks, as well as c=1 to only kill 1 entity. Notice that as you enter the command over and over, entities per-chunk outwards from the origin and not in the order of distance/creation.
Comments 5
I haven't been able to find any detailed documentation, but the results are clearly inaccurate regardless of the intention. Open a creative world and throw a bunch of diamonds on the ground in some memorable order. Then use this command over and over:
/kill @e[type=Item,c=1]
Notice how the diamonds disappear in the exact order you threw them on the ground (i.e. the order in which they were created). However when using cubic selectors (dx,dy,dz) over multiple chunks, the diamonds are not destroyed in this order but rather in some pseudo-random order, which is not even by distance.
This wiki page mentions using "c=" argument to grab the nearest/farthest player with @p, but nothing about @e. If @e is intended to sort by distance as well it is completely inaccurate because it sorts by creation time. Not to mention using cubic selectors manages to kill entities totally out-of-order, even if it is "more correct" than creation date. I'll update the details above to clarify this.
I cannot comment on intent for this, but we do need to keep in mind that the wiki is NOT an official source of information, it is just the best available community resource.
I agree, and the wiki really doesn't say much at all about @e in the first place. Regardless, the wiki is irrelevant in this situation. I have tested the selectors on my own in the game itself (14w06b) where they cause very clear inconsistencies. Either the cubic selectors order results inaccurately, or they order results very inaccurately.
UPDATE (14w07a): I did some testing in the newest snapshot and it looks like entities are now killed in consistent order. I don't know if this was fixed indirectly as a result of the changes to commands, or as one of the bugs they fixed but hadn't mentioned they fixed. Anyway, I think this can be marked as resolved or closed.
Just curious, where is documentation that it is supposed to go by creation and not radius from the start?