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

Zombie EXP Value is mutated each get

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.18.2
    • None
    • Plausible
    • (Unassigned)

      Each time getExperience is called, the xpReward of Zombie increases, as a mutation is occuring in the getter.

      protected int getExperienceReward(Player pPlayer) {
         if (this.isBaby()) {
            this.xpReward = (int)((double)this.xpReward * 2.5D);
         }
      
         return super.getExperienceReward(pPlayer);
      } 

      In the super call, xpReward is not mutated, just used as a base value for the xp calculations that occur, adding any relevant held items or armor bonuses. 

      Because of this, you can infinitely increase the xpReward of a baby zombie each time this method is called if the entity does not immediately get removed from the world after. As far as I know, this does not currently impact vanilla gameplay, unless someone would be able to kill and un-kill an entity using some type of command block commands, but this is a bit of a sneaky bug that may be run into soon, and has to be accounted for in non-vanilla instances.

            Unassigned Unassigned
            baileyholl baileyholl
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: