mojira.dev
MC-24336

Withers are harmed by the explosions of their wither skulls

The bug

Withers can harm them self and other withers with the explosion created by the impact of a wither skull. This causes a wither to severely damage it self or other withers over time. The wither skull itself cannot harm a wither.

How to reproduce

  1. Make a new creative world

  2. Spawn a wither. Make sure there are no mobs in the area.

  3. Once it has spawned, spawn an iron golem
    → Notice that when the wither fires at it, it will sometimes flash red despite the iron golem not being able to reach that high

A wither at half health or below will be able to hurt itself as well, although more frequently.

Code analysis

Code analysis by @unknown cen be found in this comment.

Attachments

Comments 5

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The reason why this happens is because WitherBosses are only imune to damage dealt by other WitherBosses. The problem is that for explosions the method net.minecraft.world.Explosion.getExplosivePlacedBy() returns the EntityLivingBase who created the explosion. Currently it is not using the net.minecraft.entity.projectile.EntityFireball.shootingEntity field for subclasses of the class EntityFireball.

/**
 * Returns either the entity that placed the explosive block, the entity that caused the explosion or null.
 */
public EntityLivingBase getExplosivePlacedBy()
{
    // Replaced this
    // Imported net.minecraft.entity.projectile.EntityFireball
    //return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null));
    if (this.exploder == null) {
        return null;
    }
    else if (this.exploder instanceof EntityTNTPrimed) {
        return ((EntityTNTPrimed) this.exploder).getTntPlacedBy();
    }
    else if (this.exploder instanceof EntityFireball) {
        return ((EntityFireball) this.exploder).shootingEntity;
    }
    else if (this.exploder instanceof EntityLivingBase) {
        return (EntityLivingBase) this.exploder;
    }
    else {
        return null;
    }
}

Confirmed for 1.13.1.

Chumbanotz

Kraif

migrated

Confirmed

Low

Mob behaviour

damage, explosion, wither, wither_skull

Minecraft 1.6.2, Minecraft 16w15b, Minecraft 1.10.2, Minecraft 16w44a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w11a, Minecraft 19w11b

Minecraft 14w04a, 19w45a

Retrieved