mojira.dev
MC-271729

Armadillo scute drops are not affected by the mob_drops game rule

Summary:
Relates to MC-136208, which was surprisingly fixed. Armadillos continue to drop scutes even when the gamerule doMobLoot is disabled, a behavior inconsistent with turtles due to the fix. This inconsistency might be intentional.

Steps to reproduce:

  1. /gamerule doMobLoot false
  2. /summon minecraft:armadillo ~ ~ ~ {scute_time:0}

Observed result:
The armadillo dropped an armadillo scute.

Expected result:
The armadillo should not drop an armadillo scute.

Note:
This gamerule likely shouldn't influence scute drops when using a brush on the armadillo.

Video:

[media]

Code analysis by @unknown

Linked issues

Attachments

Comments 2

Can confirm in 1.21.

Code Analysis / Possible Fix

Minecraft 1.21 using Yarn mappings. This code is located in ArmadilloEntity#mobTick, and defines the conditions for an armadillo scute to drop:

if (this.isAlive() && !this.isBaby() && --this.nextScuteShedCooldown <= 0) {
    this.playSound(SoundEvents.ENTITY_ARMADILLO_SCUTE_DROP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
    this.dropItem(Items.ARMADILLO_SCUTE);
    this.emitGameEvent(GameEvent.ENTITY_PLACE);
    this.nextScuteShedCooldown = this.getNextScuteShedCooldown();
}

There is no check to see if the gamerule doMobLoot is true. Adding a check to see if it is true should fix this issue, as shown below:

if (this.isAlive() && !this.isBaby() && --this.nextScuteShedCooldown <= 0 && this.getWorld().getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
    // Same code as above
}

Is this still the case with the 24w37a changes?

[Mod] EVGENSYPERPRO

(Unassigned)

1233203

Confirmed

Expansion A

Low

Loot tables, Mob behaviour

doMobLoot

23w51a, 1.20.6, 24w18a, 1.21, 1.21.1, 24w38a

25w45a

Retrieved