The bug
Like it is described in MC-4686 teleporting an entity causes it to move to its destination instead of just appearing there. This bug makes it easier to reproduce this bug. This causes entities to be unable to find themselves when using the selector argument r=0.
How to reproduce
- Create a "Redstone Ready" superflat world (there it seems to work most of the times)
- Use this compacted command
/summon falling_block ~ ~0.6 ~ {Block:"minecraft:stone",Time:1b,Passengers:[{id:"falling_block",Block:"minecraft:redstone_block",Time:1b,Passengers:[{id:"falling_block",Block:"minecraft:activator_rail",Time:1b,Passengers:[{id:"commandblock_minecart",Command:"/gamerule commandBlockOutput false",TrackOutput:0b},{id:"commandblock_minecart",Command:"/gamerule logAdminCommands false",TrackOutput:0b},{id:"commandblock_minecart",Command:"/scoreboard objectives add test dummy",TrackOutput:0b},{id:"commandblock_minecart",Command:"/say Objective \"test\" was added, gamerules \"commandBlockOutput\" and \"logAdminsCommands\" were turned off",TrackOutput:0b},{id:"commandblock_minecart",Command:"/setblock ~-1 ~4 ~-1 repeating_command_block 5 replace {Command:\"/scoreboard players set @a test 1\",auto:1b}",TrackOutput:0b},{id:"commandblock_minecart",Command:"/setblock ~ ~4 ~-1 chain_command_block 5 replace {Command:\"/execute @a ~ ~ ~ /scoreboard players set @a[c=1,r=0] test 2\",auto:1b}",TrackOutput:0b},{id:"commandblock_minecart",Command:"/setblock ~1 ~4 ~-1 chain_command_block 3 replace {Command:\"/execute @a[score_test_min=1,score_test=1] ~ ~ ~ /tellraw @p {\\\"text\\\":\\\"Player was unable to find himself with the selector @a[c=1,r=0]\\\",\\\"color\\\":\\\"red\\\"}\",auto:1b}",TrackOutput:0b},{id:"commandblock_minecart",Command:"/setblock ~ ~1 ~ command_block 0 replace {Command:\"/fill ~ ~1 ~ ~ ~-3 ~ air\"}",TrackOutput:0b},{id:"commandblock_minecart",Command:"/setblock ~ ~2 ~ redstone_block",TrackOutput:0b},{id:"commandblock_minecart",Command:"/kill @e[type=commandblock_minecart,r=0]",TrackOutput:0b}]}]}]}
- Teleport yourself about 16 (or more) blocks away or get launched by exploding EnderCrystals or tnt