mojira.dev
MC-171476

"Netherite effects" do not apply to netherite helmets worn by undead mobs, causing the helmet to "burn" in the daylight

The bug

The "netherite effects" mentioned from 20w06a are not applied to netherite helmets when worn by undead mobs that are exposed in daylight, causing the netherite helmets to eventually break or "burn".

To Reproduce

/summon minecraft:zombie ~ ~ ~ {ArmorItems:[{},{},{},{id:"minecraft:netherite_helmet",components:{"minecraft:damage":406},count:1b}]}

Code analysis

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

Linked issues

Attachments

Comments 15

Duplicate of MC-3453, which has the resolution Working As Intended; meaning this is intended game behavior - please use the search function in the future.

BrewmasterLo (I'm nicer now)

Odd

Maybe that should be a feature 

To reproduce, run

/summon zombie ~ ~ ~ {ArmorItems:[{},{},{},{id:"minecraft:netherite_helmet",Count:1b,tag:{Damage:406}}]}

Can confirm in 20w51a.

Can confirm in 21w03a.

5 more comments

Can confirm in 1.18.1.

Here's a code analysis of this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

net.minecraft.world.entity.monster.Zombie.java

public class Zombie extends Monster {
   ...
   public void aiStep() {
      if (this.isAlive()) {
         boolean flag = this.isSunSensitive() && this.isSunBurnTick();
         if (flag) {
            ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
            if (!itemstack.isEmpty()) {
               if (itemstack.isDamageableItem()) {
                  itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2));
                  if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) {
                     this.broadcastBreakEvent(EquipmentSlot.HEAD);
                     this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
                  }
               }

               flag = false;
            }

            if (flag) {
               this.setSecondsOnFire(8);
            }
         }
      }

      super.aiStep();
   }
   ...

If we look at the above class, we can see that no checks are carried out to see what type of armor a non-player entity is wearing on their head, before receiving damage from exposure to the sun. The only check that is in place is to see whether or not the item on their head can consume durability. This is evident through the following line of code:

if (itemstack.isDamageableItem())

Because of this, netherite helmets worn by non-player entities can be damaged from exposure to the sun.

Can confirm in 1.18.2 and 22w11a.

Can confirm in 1.19.

Can confirm in 1.19.2.

DrownedZombie

(Unassigned)

Confirmed

Gameplay

Low

Items

20w06a, 20w07a, 20w08a, 20w09a, 20w11a, ..., 1.20.1, 1.20.2, 23w42a, 1.21.1, 1.21.4

Retrieved