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

"minecraft:behavior.pickup_items" doesn't actually exist internally and has no effect

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Platform:
      Windows 10 - PC
    • ADO:
      59556

      Description

      In the vanilla villager.json file, this component is applied:

      "minecraft:behavior.pickup_items": {
        "priority": 7,
        "items": [
          "minecraft:bread",
          "minecraft:carrots",
          "minecraft:potatoes",
          "minecraft:wheat",
          "minecraft:beetroot",
          "minecraft:beetroot_seeds"
        ]
      }

      However, a code analysis by Jocopa3 showed that this component doesn't actually exist, and so the component has no effect on villager behavior whatsoever. In fact, the ability of villagers to pick up items is hardcoded.

      This means that changing the parameters used in the minecraft:behavior.pickup_items component has no effect on villager behavior whatsoever. (In fact, in the vanilla villager.json, the item filter list in this component doesn't have wheat_seeds listed, which SHOULD mean that villagers wouldn't be able to pick that item up, but they do anyway, since the component doesn't actually exist internally and the behavior is hardcoded.)

      There have been some reports of odd villager behavior, where villagers would not pick up items, and when they do, they seem to pick up twice as many items as you give them, allowing for easy item duplication if you have a farmer villager. I believe that a lot of this odd villager behavior may be related to this.

      Here is the code analysis by Jocopa3:

      There is a function called Villager::reloadHardcoded which loads hardcoded villager settings. That function is hardcoded to call Mob::setCanPickUpLoot(true), which makes it so villagers can always pick up loot. However, I don't know if the reloadHardcoded function is used at all, or when it's used.

      The Villager::readAdditionalSaveData is also hardcoded to callMob::setCanPickUpLoot(true), which means whenever additional save data for villagers is read, it's hardcoded to also make villagers pick up loot. Though, I don't know how behavior packs work, so I don't know if they can change that value or not.
      My guess is that behavior packs initially modify whether villagers can pick up loot or not, but that changed value is overwritten later by either of the two functions I mentioned.

      Looking into it further, I don't see behavior.pickup_items mentioned anywhere in the game... does that behavior attribute actually exist, or is it currently just a placeholder/temporarily removed behavior?

      behavior.harvest_farm_block and behavior.take_flower exist and are functional, but behavior.pickup_items simply isn't implemented at all

      By "not implemented" I mean the function which initializes all behaviors (named: GoalDefinition::_initMap) doesn't have an entry for behavior.pickup_items, so whenever that behavior is defined in a behavior file, the game ultimately ignores it

        Attachments

          Issue Links

            Activity

              People

              Reporter:
              SuperGeniusZeb [MCPE Helper] Zeb
              Votes:
              6 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: