minecraft:behavior.work for you with a switch.Get GodCraftOverview
minecraft:behavior.work is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes a villager walk to its job site block and work there for a while during the day.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
sound_delay_min | integer | 0 | Shortest wait between work sounds.Range: 0 to … |
sound_delay_max | integer | 0 | Longest wait between work sounds.Range: 0 to … |
goal_cooldown | integer | 0 | Ticks before the goal can be used again.Range: 0 to … |
active_time | integer | 0 | Ticks the mob stays at its work spot.Range: 0 to … |
can_work_in_rain | boolean | false | If true, the mob keeps working when rain falls on its job site. |
work_in_rain_tolerance | integer | -1 | When can_work_in_rain is false: if the goal has fewer than this many ticks left, rain won't stop it.Range: 0 to … |
on_arrival | 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 reaches its job site. |
speed_multiplier | number | 0.5 | Speeds the mob up or slows it down while this goal runs: 1 is normal speed. |
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.work": {
"sound_delay_min": 0,
"sound_delay_max": 0,
"goal_cooldown": 0,
"active_time": 0,
"can_work_in_rain": false,
"work_in_rain_tolerance": -1,
"on_arrival": {
"event": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"target": "self"
},
"speed_multiplier": 0.5
}
}