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

Egg laying drop from chickens is hardcoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w37a
    • 1.20.4, 24w12a, 24w13a, 1.20.5, 1.20.6 Release Candidate 1, 1.20.6, 24w19b, 1.21
    • Confirmed
    • Loot tables, Mob behaviour

      Eggs which chickens randomly lay are not controlled by a loot table, but instead are hardcoded. This issue was created due to the fix for MC-267866.

      Steps to Reproduce:

      Since this bug report is about functionality that is missing, the only way to verify this issue is to look into the various loot tables in the game either by decompressing the game jar, or looking in the code of the game.

      Code analysis:

         public void aiStep() {
      . . .
            this.flap += this.flapping * 2.0F;
            if (!this.level().isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
               this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
      -> ISSUE START
               this.spawnAtLocation(Items.EGG);
      -> ISSUE END
               this.gameEvent(GameEvent.ENTITY_PLACE);
               this.eggTime = this.random.nextInt(6000) + 6000;
            }
      . . .
         }
      

      Suggested Fix

      Introduce a loot table for eggs dropping from chickens.

      Notes:

      Related to MC-94610 MC-149589 MC-269838 MC-269839 MC-269873 MC-269874 MC-269875

            Unassigned Unassigned
            Jingy [Helper] Jiingy
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: