-
Bug
-
Resolution: Invalid
-
None
-
Minecraft 1.8.7
-
None
-
Unconfirmed
A few days ago, I was working with Entity selectors, and wanted to target any players at y=4 or below. My Entity selector ended up like this:
@a[x=-30000000,y=0,z=-30000000,dx=60000001,dy=4,dz=60000001]
This would essentially track any player inside the map, but I ran into a problem while doing so, and the server froze.
From this I've assumed that the game is analyzing the world block by block, looking for a player. Putting this into perspective, it's scanning 1.8e+16 blocks, one by one, attempting to do this in less than 1/20 of a second, which is not always possible.
To get around this, I suggest the following:
Instead of testing block for block, perhaps... just iterate through each entity, and selecting those who match the interval. In coding (For this, I'll use Javascript, the only language I know and can put this on), this would be:
for(i in world.entities){
if(world.entities[i].x >= x && world.entities[i].x <= x + dx)
}
(Only handling x values as an example)
This means, that if... an entity is at x=10, and the selector is @e[x=0,dx=100], it will be selected because...
10 >= 0 and 10 =< 100
I believe this could potentially boost command block creations by a considerable amount and allow more with less calculations.