The bug
When a target selector has a particularly high radius (e.g. @e[distance=..100000000]
), it freezes the block update cycle until the command has finished executing, which is often one or two full seconds.
This is especially noticeable if the command block is activated by a clock.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 4
Comments 12
The reason why this happens is that a radius of 100000 means it has to test in ((100000 * 2) / 16)^2 (=156250000) chunks if an entity meets the conditions even though most of these chunks are unloaded.
At some point it is more efficient to go through all entities in the loaded entity list.
Can't reproduce the issue for Player-only selectors (@a,@p,@r without type). Tested only in singleplayer
Confirmed for 18w32a, with the upper limit of distance= in place of r=. Setting only the lower limit has no effect, so
distance=1000000..
will not trigger the bug, but any of
distance=1000000
distance=..1000000
will.
Your Java version is OUT OF DATE! Please update to the latest version, which can be found here: http://www.oracle.com/technetwork/java/javase/downloads/index.html