minecraft:behavior.move_to_block for you with a switch.Get GodCraftOverview
minecraft:behavior.move_to_block is an entity component: it goes in the components object of a custom mob, or in one of its component groups. AI goal that makes the mob walk to a chosen kind of block and can run events when it gets there or stays a while. Use it for mobs that seek out flowers, beds or similar.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
speed_multiplier | number | 1 | Speed multiplier while walking to the block. |
search_range | integer | 0 | How far sideways, in blocks, the mob looks for the block. |
search_height | integer | 1 | How far up and down, in blocks, the mob looks for the block. |
tick_interval | integer | 20 | About how many ticks pass between tries to start the goal. |
stay_duration | number | 0 | Ticks the mob must stay at the block to finish its visit. |
goal_radius | number | 0.5 | How close the mob must get to count as arrived, which stops it jittering around the spot. |
start_chance | number | 1 | Chance to start each time the tick interval passes. |
target_selection_method | Target Selection Method | "nearest" | How the block is picked: "random" or "nearest". |
target_offset | vec3 | [0,0,0] | X, Y and Z shift added to the chosen block position. |
on_reach | ActorDefinitionTrigger[] | none | Events that fire when the mob reaches the block. |
on_stay_completed | ActorDefinitionTrigger[] | none | Events that fire after the mob has stayed for stay_duration. |
target_blocks | Item Descriptor[] | none | The block types the mob walks to. |
target_block_filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Conditions a block must pass to be picked. |
priority | integer | 0 | Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to … |
control_flags | Goal's control flags[] | none | Which body parts this goal takes over (move, look, jump), so goals using the same parts cannot run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.move_to_block": {
"speed_multiplier": 1,
"search_range": 0,
"search_height": 1,
"tick_interval": 20,
"stay_duration": 0,
"goal_radius": 0.5,
"start_chance": 1,
"target_selection_method": "nearest"
}
}