mojira.dev
MC-233276

You can feed adult donkeys, horses, llamas or mules with maximum Temper value, and hand animation is not played

The bug

You can feed adult donkeys, horses or mules with maximum Temper value, and the hand animation is not played.

The distinction of this issue from MC-93825 is that it is NOT a desync, and it is not MC-236341 as it happens only with a high temper value, and all food exhibits this behavior. However, sometimes golden carrots do play animation and sounds on the first time.

To reproduce

  1. Summon a donkey, horse, llama or mule with a Temper value of 100, e.g.

    /summon horse ~ ~ ~ {Temper:100}
  2. Give the animal any food.
    ❓ Very rarely, animations and sounds will be played one time.
    ❌ No animations and sounds are played.

  3. Notice how the food is actually consumed, i.e. it is not a desync.

Expected result

You should not be able to feed said animal; as per MC-201599, it should show the hand animation but the animal should not consume the food (this was the behavior in 1.15.2).

Analysis (tentative)

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

I think that this is the piece of code that causes the issue, but I might be wrong.

net.minecraft.world.entity.animal.horse.AbstractHorse.java (Mojang mappings, 1.18-pre1)

...
protected boolean handleEating(Player $$0, ItemStack $$1) {
        boolean $$2 = false;
        ...
        if ($$5 > 0 && ($$2 || !this.isTamed()) && this.getTemper() < this.getMaxTemper()) {
            $$2 = true;
            if (!this.level.isClientSide) {
                this.modifyTemper($$5);
            }
        }
       if ($$2) {
            this.eating();
            this.gameEvent(GameEvent.EAT, this.eyeBlockPosition());
        }
       ...

If the animal's temper is equal or more than its max temper and it is not tamed, $$2 is not set to true, so the game event and animations will not play. At least, this is what I understood.

Related issues

Attachments

Comments

migrated
[media]
ampolive

Relates to MC-187419.

ampolive

I don't think this is a duplicate of MC-93825, because the items don't re-appear when the inventory is updated.

ampolive

Relates to MC-93825 and MC-236341.

ampolive

I think that the actual bug here could be that you are able to feed these animals with high Temper in the first place.

ampolive

elvendorke

1098630

Confirmed

Mob behaviour, Player Animation

animation, donkey, feeding, hand-animation, horse, llama, mule, sound, temper

1.17.1, 21w37a, 21w38a, 21w39a, 21w40a, ..., 23w18a, 1.20 Release Candidate 1, 1.20, 1.20.1, 1.20.2

23w41a

Retrieved