1. Wiki
  2. /Entities
  3. /minecraft:preferred_path

minecraft:preferred_path

Don't want to write this by hand? GodCraft sets minecraft:preferred_path for you with a switch.Get GodCraft

Overview

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

FieldTypeDefaultDescription
max_fall_blocksinteger3How many blocks the mob is willing to drop down while following its path.
jump_costnumber0Extra cost added for jumping up a block; higher makes the mob avoid jumps.
default_block_costnumber0Cost of walking on any block not in the preferred list.
preferred_path_blocksPreferredPath BlockSet[]noneGroups 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": []
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more