minecraft:preferred_path for you with a switch.Get GodCraftOverview
minecraft:preferred_path is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Gives the mob a list of blocks it likes to walk on and how much it dislikes others, so it sticks to roads and paths. Villagers use this to follow dirt paths.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
max_fall_blocks | integer | 3 | How many blocks the mob is willing to drop down while following its path. |
jump_cost | number | 0 | Extra cost added for jumping up a block; higher makes the mob avoid jumps. |
default_block_cost | number | 0 | Cost of walking on any block not in the preferred list. |
preferred_path_blocks | PreferredPath BlockSet[] | none | Groups of blocks and the cost of walking on each; lower cost means the mob prefers it. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:preferred_path": {
"max_fall_blocks": 3,
"jump_cost": 0,
"default_block_cost": 0,
"preferred_path_blocks": []
}
}