minecraft:behavior.work
Allows the NPC to use the POI
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
sound_delay_min | Integermin 0 | 0 | The min interval in which a sound will play. |
sound_delay_max | Integermin 0 | 0 | The max interval in which a sound will play. |
goal_cooldown | Integermin 0 | 0 | The amount of ticks the goal will be on cooldown before it can be used again |
active_time | Integermin 0 | 0 | The amount of ticks the NPC will stay in their the work location |
can_work_in_rain | Boolean | false | If true, this entity can work when their jobsite POI is being rained on. |
work_in_rain_tolerance | Integermin 0 | -1 | If "can_work_in_rain" is false, this is the maximum number of ticks left in the goal where rain will not interrupt the goal |
on_arrival | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when the mob reaches their jobsite. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
speed_multiplier | Decimal | 0.5 | Movement speed multiplier of the mob when using this AI Goal |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Villager uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.work": {
"priority": 7,
"active_time": 250,
"on_arrival": {
"event": "minecraft:resupply_trades",
"target": "self"
},
"can_work_in_rain": false,
"speed_multiplier": 0.5,
"goal_cooldown": 200,
"sound_delay_max": 200,
"work_in_rain_tolerance": 100,
"sound_delay_min": 100
}
}Used by 1
Vanilla entities with minecraft:behavior.work in their definition:
Related components
behavior.pickup_itemsbehavior.move_to_villagebehavior.harvest_farm_blockbehavior.lay_eggbehavior.move_indoorsbehavior.move_outdoorsbehavior.place_blockbehavior.raid_gardenbehavior.digbehavior.dragonscanningbehavior.drop_item_forbehavior.eat_blockbehavior.eat_carried_itembehavior.eat_mobbehavior.fertilize_farm_blockbehavior.hold_groundbehavior.inspect_bookshelfbehavior.move_through_villagebehavior.open_doorbehavior.random_search_and_digbehavior.restrict_open_doorbehavior.snackingbehavior.stroll_towards_villagebehavior.take_block