Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-236341

Hand animation and animal eating animation/sounds are not played when feeding hay bales to adult donkeys, horses or mules

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • None
    • 1.17.1, 21w37a, 21w38a, 21w39a, 21w40a, 21w41a, 21w42a, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 4, 1.18 Pre-release 5, 1.18 Pre-release 6, 1.18 Pre-release 8, 1.18 Release Candidate 3, 1.18, 1.18.1 Release Candidate 2, 1.18.1, 22w03a, 22w06a, 1.18.2 Pre-release 1, 22w11a, 22w17a, 22w18a, 1.19 Pre-release 1, 1.19, 1.19.1 Pre-release 5, 1.19.2, 22w42a, 22w46a
    • Confirmed
    • Mob behaviour, Player Animation, Sound

    Description

      The bug

      You can feed hay bales to adult donkeys, horses or mules, but hand animation and animal eating animation/sounds are not played.

      The distinction of this issue from MC-93825 is that it is NOT a desync, and it is not MC-233276 as it happens regardless of the animal's temper value, and no other food exhibits this behavior, only hay bales. Also unlike MC-233276, this does not affect llamas.

      To reproduce

      1. Summon a donkey, horse or mule.
      2. Feed the animal hay bales.
      3. The hay bales will be consumed, but no animations or sounds are played.

      Expected result

      Animations and sounds should be played when you feed hay bales to adult donkeys, horses and mules.

      Code analysis (tentative)

      There appears to be a missing line in AbstractHorse.java:

      net.minecraft.world.entity.animal.horse.AbstractHorse.java (Mojang mappings, 1.18-pre1)
      ...
      protected boolean handleEating(Player $$0, ItemStack $$1) {
              boolean $$2 = false;
              float $$3 = 0.0f;
              int $$4 = 0;
              int $$5 = 0;
              if ($$1.is(Items.WHEAT)) {
                  $$3 = 2.0f;
                  $$4 = 20;
                  $$5 = 3;
              } 
              ...
              else if ($$1.is(Blocks.HAY_BLOCK.asItem())) {
                  $$3 = 20.0f;
                  $$4 = 180;
                  /** There should be a $$5 here? */ 
              } 
              ...
              else if ($$1.is(Items.GOLDEN_CARROT)) {
                  $$3 = 4.0f;
                  $$4 = 60;
                  $$5 = 5;
                  ...
              } 
              ...
              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());
              }
      

      The variable $$5 appears to control the Temper and the eating event, and it is missing for the hay bale. Llamas override this method in their own class, which would explain why they are not affected.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ampolive [Mod] ampolive
              Votes:
              7 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                CHK: