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
Make a new creative world
Spawn a wither. Make sure there are no mobs in the area.
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.