The bug
Right clicking a dragon egg near y = 0 or y = 255 can result in it being deleted.
How to reproduce
Create a Superflat world completely filled with a block
3;256*minecraft:stone;127;
Replace one block at y = 255 and place a dragon egg
Right click the dragon egg
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.block.BlockDragonEgg.teleport(World, BlockPos)
does not test if the y-coordinate of the randomly chosen position is inside the valid building height range. Since the method World.getBlockState(BlockPos)
returns for positions < 0 and >= 256 air the dragon egg tries to place itself there.
Note: It would be great if the dragon egg would not try to teleport outside the worldborder or at least the 30,000,000 blocks area as well.
Linked issues
relates to 3
Attachments
Comments 11
They shouldn't be able to teleport themselves outside of the world. After all, assuming that the teleportation evolved as a defence mechanism, it wouldn't work very well if it killed itself.
The fact that the egg can teleport outside the world may be intended (though I don't think so), but the fact that it immediately dies certainly isn't. This is a serious problem at high altitudes, as it will just despawn if it teleports above Y=256.
I think this is intended as the area of the teleportation is: 15×15×7