mojira.dev
MC-132878

Armor stands destroyed by explosions/lava/fire don't produce particles

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

Attachments

Comments 14

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 calls this.method_6908() (dropContents() previously - drops the contents of armorstand) and this.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. The method_6898() (also, not named apparently - playParticles() in MCP) should be called before it the remove() call.

if (source.isExplosive()) {
            this.method_6908(source); //drops contents
            this.method_6898(); //displays the particles
            this.remove(); //kills entity
            return false;
        }

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 named damageArmorStand() in MCP) if the health is equal or smaller than 0.5f - it forgets to call the particle method, it should be added before the remove() again, to display particles correctly.

if (float4 <= 0.5f) {
            this.method_6908(damageSource); //drops contents
            this.method_6898(); //displays the particles
            this.remove(); /kills entity
        }

This bug seems like an oversight made when making this code, so hopefully this helps it get fixed.

Can confirm in 20w49a.

Can confirm in 20w51a.

Can confirm in 21w05b.

Can confirm in 21w06a.

4 more comments

Can confirm in 1.18.1.

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()

Can confirm in 1.18.2.

Can confirm in 1.19.

Can confirm in 1.19.2.

muzikbike

(Unassigned)

Confirmed

Platform

Low

Particles

armor_stand, missing-particle

Minecraft 1.12.2, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, ..., 23w05a, 1.20.1, 1.20.4, 1.21, 1.21.4

Retrieved