The bug
When an armor stand is broken by hand, particles are produced, but this does not apply when destroyed by an explosion.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
testing discovered 1
Attachments
Comments 14
Can confirm in 1.18.2 Pre-release 1. Here's a code analysis along with a potential fix regarding this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
net.minecraft.world.entity.decoration.ArmorStand.java
public class ArmorStand extends LivingEntity {
...
public boolean hurt(DamageSource $ds, float $f) {
if (!this.level.isClientSide && !this.isRemoved()) {
if (DamageSource.OUT_OF_WORLD.equals($ds)) {
...
} else if (!this.isInvulnerableTo($ds) && !this.invisible && !this.isMarker()) {
if ($ds.isExplosion()) {
this.brokenByAnything($ds);
this.kill();
return false;
...
If we look at the above class, we can see that no method responsible for producing breaking particles is called when an armor stand is destroyed by an explosion. The only two methods called are the brokenByAnything()
method, which plays the breaking sound as well as dropping all of the armor stand's death loot, and the kill()
method which simply kills the armor stand.
Potential Fix:
Simply calling the showBreakingParticles()
method (a method responsible for producing breaking particles of an armor stand) when an armor stand is destroyed by an explosion, should resolve this problem. The following line of code could be used in order to fix this:
this.showBreakingParticles()
The following is based on 20w06a names using yarn.
The reason for this is because there's no particles call when the armorstand dies by explosion or lava code-wise. In the method
net.minecraft.entity.decoration.ArmorStandEntity.damage()
when the damage source is explosion, it callsthis.method_6908()
(dropContents()
previously - drops the contents of armorstand) andthis.remove()
(sets the entity dead) but does not call for the particle method, hence why it doesn't display them when killed by an explosion. Themethod_6898()
(also, not named apparently -playParticles()
in MCP) should be called before it theremove()
call.For lava and fire, the armorstand gets damaged and is set dead in that method, in
net.minecraft.entity.decoration.ArmorStandEntity.method_6905()
(unnamed again, darn, this is nameddamageArmorStand()
in MCP) if the health is equal or smaller than0.5f
- it forgets to call the particle method, it should be added before theremove()
again, to display particles correctly.This bug seems like an oversight made when making this code, so hopefully this helps it get fixed.