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

Rabbits ignore the "MoreCarrotTicks" value, causing them to always try to eat carrots

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • 22w42a
    • 1.18.2, 22w11a, 22w18a
    • None
    • Plausible
    • Mob behaviour
    • Low

    Description

      When a rabbit pathfinds to a carrot block and consumes it, the MoreCarrotTicks value is set to 40 ticks.

      It seems the intended behavior is that once until this value is 0 the rabbit will not be able to eat any carrots. However, because of a bug, the result is ignored.

      Looking at Rabbit$RaidGardenGoal#canUse:

              @Override
              public boolean canUse() {
                  if (this.nextStartTick <= 0) {
                      if (!this.rabbit.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
                          return false;
                      }
                      this.canRaid = false;
                      this.wantsToRaid = this.rabbit.wantsMoreFood(); // If ticks == 0
                      this.wantsToRaid = true;
                  }            
                  return super.canUse();
              }
      

      The result of wantsMoreFood is ignored and overridden by true.

      Attachments

        Activity

          People

            SystemInvecklare [Mojang] SystemInvecklare
            Owen1212055 Owen
            Votes:
            6 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              CHK: