Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-133485

Mobs don't drop extra experience when wearing armor

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.17.20.20 Beta, 1.17.2 Hotfix
    • None
    • None
    • Confirmed
    • Multiple
    • 390117

    Description

      The bug

      All mobs that can naturally spawn with random armor or tools are intended to drop additional experience for each piece. This is explicitly included in the behavior files. For example, here is what husks use:

      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"
      }
      

      This does not work. query.equipment_count always returns 0 in this context, rendering it completely unfunctional.

      The query itself works fine in other contexts, on both the server and client side. Other queries such as query.is_in_water also work fine in this context.

      How to reproduce

      Ambiguous Vanilla Method
      1. Spawn a bunch of husks or zombies or whatever
      2. Kill them and observe how much experience you get
      You get no additional experience from ones that have armor

      Clean Custom Method
      1. Download the attached world
      2. Kill the husk wearing armor
      No experience is dropped

      This world overrides the husk behavior to remove some unneeded components, and simplifies its experience molang string to the following:

      query.equipment_count * 50
      

      Note

      Fixing this naively will introduce an exploit! If mobs drop additional experience for armor they pick up, you can trivially buff the experience output of your mob farm by allowing mobs to pick up items, which they will drop on death, ready to be recycled again.

      In Java Edition, mobs only give additional experience for natural equipment, not equipment picked up from the ground! For this reason, query.equipment_count should not be used at all, but rather something different that can distinguish between natural and picked-up equipment. Also, the hand item should count as well; query.equipment_count does not account for it.

      Attachments

        Issue Links

          Activity

            People

              tryashtar [Mod] tryashtar
              Votes:
              8 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                CHK: