minecraft:behavior.share_items

Allows the mob to give items it has to others.

Properties

PropertyTypeDefaultWhat it does
entity_typesList of object or Object[]List of entities this mob will share items with
filtersObject or List of object{"AND": null, "NOT": null, "OR": null, "all": null, "all_…Conditions that make this entry in the list valid
max_distDecimal16Maximum distance this mob can be away to be a valid choice
max_heightDecimal-1Maximum height this mob can be away to be a valid choice
max_fleeDecimal10Maximum distance this mob can be from the target to stop fleeing
walk_speed_multiplierDecimal1Multiplier for the walking speed. A value of 1.0 means the speed is unchanged
sprint_speed_multiplierDecimal1Multiplier for the sprinting speed. A value of 1.0 means the speed is unchanged
priorityInteger0Priority for this mob type
check_if_outnumberedBooleanfalseIf true, the mob will check if its outnumbered
reevaluate_descriptionBooleanfalseIf true, the mob will stop being targeted if it stops meeting any conditions.
cooldownInteger0The amount of time in seconds that the mob has to wait before selecting a target of the same type again
must_seeBoolean—If true, the mob has to be visible to be a valid choice
must_see_forget_durationInteger3Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more
speed_multiplierDecimal1Movement speed multiplier of the mob when using this AI Goal
max_distInteger1Maximum distance in blocks this mob will look for entities to share items with
goal_radiusDecimal0.5Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

This is how vanilla Villager uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:behavior.share_items": {
    "entity_types": [
      {
        "filters": {
          "subject": "other",
          "test": "is_family",
          "value": "villager"
        }
      }
    ],
    "goal_radius": 2,
    "priority": 10,
    "max_dist": 3,
    "speed_multiplier": 0.5
  }
}

Used by 2

Vanilla entities with minecraft:behavior.share_items in their definition:

Related components