mojira.dev
MC-149589

The wither boss will always drops a nether star regardless of its DeathLootTable data

The wither boss' loot table is not changed when its DeathLootTable NBT data is modified, resulting in it always dropping a nether star.

Steps to Reproduce:

  1. Summon a wither with no AI

    /summon minecraft:wither ~ ~ ~ {NoAI:1b}
  2. Modify its data to be empty

    /data modify entity @e[type=wither,limit=1,sort=nearest] DeathLootTable set value ""
  3. Kill it

    /kill @e[type=wither]

Expected & Observed Results:

❌ - The wither will drop a nether star, despite having no DeathLootTable NBT data
✔ - It would not drop anything, as that is what the player intentionally set the DeathLootTable to.


Screenshots/Videos:



[media]

Code Analysis

The happens because the wither boss has its death loot table "hard-coded", meaning it ignores any loot table entirely.

Class: net.minecraft.world.entity.boss.wither.WitherBoss // Method: dropCustomDeathLoot // MCP 1.20.2 Mojang Mappings
protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) {
      super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops);
      ItemEntity itementity = this.spawnAtLocation(Items.NETHER_STAR);
      if (itementity != null) {
         itementity.setExtendedLifetime();
      }
   }

Original Description:

The bug

Setting the wither's DeathLootTable NBT tag to any given loot table does not stop the wither from dropping a nether star.
Loot from the loot table set in the DeathLootTable tag drops in addition to the nether star. This was not the case in 1.13.*, where the DeathLootTable tag being set prevented the nether star from dropping.

Linked issues

Attachments

Comments

migrated

Confirmed in 1.16 Release Candidate 1.

migrated

Affects 21w18a

Avoma

Can confirm in 1.19.2. Here's a code analysis of this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19.2 using Mojang mappings.

net.minecraft.world.entity.boss.wither.WitherBoss.java

public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob {
   ...
   @Override
   protected void dropCustomDeathLoot(DamageSource damageSource, int n, boolean bl) {
      super.dropCustomDeathLoot(damageSource, n, bl);
      ItemEntity itemEntity = this.spawnAtLocation(Items.NETHER_STAR);
      if (itemEntity != null) {
         itemEntity.setExtendedLifetime();
      }
   }
   ...

If we look at the above class, we can see the drop of a nether star from a wither is controlled by the dropCustomDeathLoot() method. Because the drop is controlled this way, it doesn't have a loot table entry, therefore resulting in this issue.

Brain81505

Can confirm in 1.19.3 and 1.19.4-rc2

ArrotinoD

This is in 1.20.4 too

[Mod] Jingy

I'd like to request ownership of this issue, as @unknown has not updated it since it's creation.

[Mod] Jingy

Relates to MC-75494 MC-161191

AMGAMES04

Can confirm in 24w34a 

[Mod] Jingy

(Unassigned)

Confirmed

Platform

Normal

Loot tables

drop-item, loot-table, loot_table, wither

Minecraft 1.14, 1.15.2, 20w15a, 1.16 Release Candidate 1, 1.16, ..., 24w12a, 1.21.1, 24w34a, 24w37a, 1.21.4

Retrieved