minecraft:behavior.pickup_items for you with a switch.Get GodCraftOverview
minecraft:behavior.pickup_items is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets the mob walk to items lying on the ground and pick them up. Zombies, foxes and piglins use it.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
stop_if_holding_item | boolean | false | If true, the mob won't pick up an item if it already holds something in that item's slot. |
speed_multiplier | number | 1 | Speeds the mob up or slows it down while this goal runs: 1 is normal speed. |
track_target | boolean | false | If true, the mob keeps chasing the item as long as it is still valid. |
max_dist | integer | 1 | How far away the mob looks for items. |
search_height | integer | 1 | How far up and down the mob looks for items. |
goal_radius | number | 0.5 | How close the mob must get before it counts as arrived. A little room stops it from jittering around one spot. |
pickup_based_on_chance | boolean | false | If true, there is a random chance (based on difficulty) that the mob can't pick items up. |
can_pickup_any_item | boolean | false | If true, the mob can pick up any item, not just ones it can use. |
cooldown_after_being_attacked | integer | 0 | Seconds the mob won't pick up items after being hit. |
can_pickup_to_hand_or_equipment | boolean | true | If true, items can go into the mob's hand or armor slots. |
pickup_same_items_as_in_hand | boolean | false | If true, the mob only picks up items that match what it already holds. |
on_pickup_item_start | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | Event that runs when the mob starts moving to an item. |
on_pickup_item_end | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | Event that runs when the mob picks up the item or gives up on it. |
excluded_items | Item Descriptor[] | none | Items this mob will never pick up. |
priority | integer | 0 | Decides which goal wins when several want to run: lower numbers run first.Range: 0 to … |
control_flags | Goal's control flags[] | none | Lists the body parts this goal takes control of (such as move, look or jump), so goals that need the same part don't run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.pickup_items": {
"stop_if_holding_item": false,
"speed_multiplier": 1,
"track_target": false,
"max_dist": 1,
"search_height": 1,
"goal_radius": 0.5,
"pickup_based_on_chance": false,
"can_pickup_any_item": false
}
}