Particles produced from dragon eggs teleporting cannot be seen by other players
The Bug:
Particles produced from dragon eggs teleporting cannot be seen by other players.
Steps to Reproduce:
- Obtain a dragon egg and place it down.
- Get two players and label them "Player A" and "Player B".
- Have "Player A" stand a fair distance away from the dragon egg whilst looking in its direction.
- Have "Player B" teleport the dragon egg by right-clicking on it.
- Get both players to watch closely at the particles produced as the dragon egg teleports.
- Take note as to whether or not particles produced from dragon eggs teleporting can be seen by other players.
Observed Behavior:
Dragon egg teleportation particles can only be seen by the person who interacted with the dragon egg, and not other players.
Expected Behavior:
Dragon egg teleportation particles would be seen by all players.
Code Analysis:
Code analysis by [Mod] Avoma can be found below.
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) { ... 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.isClientSide) { for(int j = 0; j < 128; ++j) { double d0 = $l.random.nextDouble(); float f = ($l.random.nextFloat() - 0.5F) * 0.2F; float f1 = ($l.random.nextFloat() - 0.5F) * 0.2F; float f2 = ($l.random.nextFloat() - 0.5F) * 0.2F; double d1 = Mth.lerp(d0, (double)blockpos.getX(), (double)$bp.getX()) + ($l.random.nextDouble() - 0.5D) + 0.5D; double d2 = Mth.lerp(d0, (double)blockpos.getY(), (double)$bp.getY()) + $l.random.nextDouble() - 0.5D; double d3 = Mth.lerp(d0, (double)blockpos.getZ(), (double)$bp.getZ()) + ($l.random.nextDouble() - 0.5D) + 0.5D; $l.addParticle(ParticleTypes.PORTAL, d1, d2, d3, (double)f, (double)f1, (double)f2); } ...
If we look at the above class, we can see that particles produced from dragon eggs teleporting are only produced client-side. This is evident through the following line of code:
if ($l.isClientSide)