The Bug
Dragon egg does not check whether there is a block under the destination when teleporting.
May cause the dragon egg to fall into the void.
Steps to Reproduce
Create a Superflat world:
100*minecraft:air,minecraft:glass;minecraft:plains
Place a dragon egg.
Right-click it to make it teleport.
Note that the dragon egg will teleport into the air and fall into the void.
Code analysis provided by @unknown
Linked issues
is duplicated by 1
relates to 4
Attachments
Comments 9
I am able to confirm this behavior in 21w38a though, this may be a duplicate ofย MC-229536. Please correct me if I'm wrong as I'm not 100% sure.
@@unknown
MC-229536 is about the dragon eggs can teleport in the air.
This issue mainly focuses on whether to check that there is void below the dragon eggs.
Here's a code analysis of this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.level.block.DragonEggBlock.java
public class DragonEggBlock extends FallingBlock {
...
ย private void teleport(BlockState $bs, Level $l, BlockPos $bp) {
WorldBorder worldborder = $l.getWorldBorder();
for(int i = 0; i < 1000; ++i) {
BlockPos blockpos = $bp.offset($l.random.nextInt(16) - $l.random.nextInt(16), $l.random.nextInt(8) - $l.random.nextInt(8), $l.random.nextInt(16) - $l.random.nextInt(16));
if ($l.getBlockState(blockpos).isAir() && worldborder.isWithinBounds(blockpos)) {
...
If we look at the above class, we can see that no checks are carried out to see whether the block below the dragon egg's teleportation destination is air. The only checks that are in place are to see whether or not its desired teleportation destination is air, and is within the world border. This is evident through the following line of code:
if ($l.getBlockState(blockpos).isAir() && worldborder.isWithinBounds(blockpos))
Because of this, dragon eggs can teleport on top of any block.
This issue is different from MC-174759.
MC-174759 mainly states that the dragon egg can teleport to -Y.