The bug
End crystals are extremely loyal to the dragon and would uselessly try to heal her even when she's dying. The beam is still present even after detonating the crystal until the dragon is fully gone.
Code analysis
Code analysis by @unknown can be found in this comment.
Attachments
Comments 2
Code Analysis - Mojang Mappings 1.17.1 - Client-Side
net.minecraft.client.renderer.EnderDragonRenderer
public void render(EnderDragon lvt1, float lvt2, float lvt3, PoseStack lvt4, MultiBufferSource lvt5, int lvt6) {
...
//Renders the nearest crystal
if (lvt1.nearestCrystal != null) { //To fix this only for the clients change to: (lvt1.dragonDeathTime > 0 && lvt1.nearestCrystal != null)
lvt4.pushPose();
float lvt11 = (float)(lvt1.nearestCrystal.getX() - Mth.lerp((double)lvt3, lvt1.xo, lvt1.getX()));
float lvt12 = (float)(lvt1.nearestCrystal.getY() - Mth.lerp((double)lvt3, lvt1.yo, lvt1.getY()));
float lvt13 = (float)(lvt1.nearestCrystal.getZ() - Mth.lerp((double)lvt3, lvt1.zo, lvt1.getZ()));
EnderDragonRenderer.renderCrystalBeams(lvt11,lvt12+EndCrystalRenderer.getY(lvt1.nearestCrystal,lvt3),lvt13,lvt3,lvt1.tickCount,lvt4,lvt5,lvt6);
lvt4.popPose();
}
super.render(lvt1, lvt2, lvt3, lvt4, lvt5, lvt6);
}public void render(EnderDragon lvt1, float lvt2, float lvt3, PoseStack lvt4, MultiBufferSource lvt5, int lvt6) {
...
//Renders the nearest crystal
if (lvt1.nearestCrystal != null) { //To fix this only for the clients change to: (lvt1.dragonDeathTime > 0 && lvt1.nearestCrystal != null)
lvt4.pushPose();
float lvt11 = (float)(lvt1.nearestCrystal.getX() - Mth.lerp((double)lvt3, lvt1.xo, lvt1.getX()));
float lvt12 = (float)(lvt1.nearestCrystal.getY() - Mth.lerp((double)lvt3, lvt1.yo, lvt1.getY()));
float lvt13 = (float)(lvt1.nearestCrystal.getZ() - Mth.lerp((double)lvt3, lvt1.zo, lvt1.getZ()));
EnderDragonRenderer.renderCrystalBeams(lvt11,lvt12+EndCrystalRenderer.getY(lvt1.nearestCrystal,lvt3),lvt13,lvt3,lvt1.tickCount,lvt4,lvt5,lvt6);
lvt4.popPose();
}
super.render(lvt1, lvt2, lvt3, lvt4, lvt5, lvt6);
}
Can confirm in 20w51a.