Skip to content

NavigationOptions 5.47.0 ​

final class · pocketmine\entity\ai\navigation\NavigationOptions · source

What a walking mob's paths may go through: the vanilla Bedrock navigation component of the mob (navigation.walk, navigation.climb, navigation.generic...). NavigationOptions::forEntity() has the values of the vanilla mobs (behavior pack 1.26.50); PathNavigator::setOptions() applies them. Spiders' cobweb immunity (block_movement_slowdown_immunity) needs nothing here: no mob's paths avoid cobwebs.

How the path finder uses them, as observed on BDS 1.26.52 (a mob chasing its target across a line of blocks with a gap in it):

  • every mob avoids lava, magma, lit campfires, cactus and sweet berry bushes with berries;
  • fire too, except undead mobs without avoid_damage_blocks (zombies, husks, drowned, zombie villagers and wither skeletons walk through it; vindicators don't), see NavigationOptions::setWalksThroughFire();
  • mobs with avoid_damage_blocks also avoid the small sweet berry bushes, and the blocks next to fire, lit campfires, cactus and sweet berry bushes (not next to lava or magma: a wolf walks between two magma or lava blocks, not between two fires);
  • wither roses, powder snow and cobwebs are avoided by no mob (wolves walk into wither roses and die);
  • every mob gets a cost for nodes next to lava, magma, fire or anything else it avoids (vanilla Java FIRE_IN_NEIGHBOR / DAMAGING_IN_NEIGHBOR malus 8), so its paths keep clear of them when they can;
  • avoid_water makes water cost 8 instead of 2: a fox or an ocelot takes a detour of 9 blocks over a bridge rather than swim 3 blocks, and swims when there is no way round; a wolf swims straight across;
  • striders walk on the surface of lava, mobs with can_path_over_lava wade through lava with a floor below.

Constants ​

DANGER_MARGIN_COST ​

php
public const DANGER_MARGIN_COST = 8.0

Extra cost of a path node next to something the mob avoids (vanilla Java malus of FIRE_IN_NEIGHBOR).

HEURISTIC_WEIGHT ​

php
public const HEURISTIC_WEIGHT = 1.5

Weight of the distance to the target in the path search (vanilla Java PathFinder.FUDGING).

LAVA_COST ​

php
public const LAVA_COST = 8.0

Cost of a node in lava for mobs which path over lava (vanilla Java malus of LAVA for wither skeletons).

Methods ​

avoidsDamageBlocks() ​

php
public function avoidsDamageBlocks() : bool

Avoids damage blocks and the blocks next to them (vanilla avoid_damage_blocks), see the class documentation.

avoidsSun() ​

php
public function avoidsSun() : bool

Vanilla avoid_sun (the skeletons and drowned): by day, paths of a mob in the shade end before the first node under the open sky (see PathNavigator).

avoidsWater() ​

php
public function avoidsWater() : bool

Paths go through water only when there is no other way (vanilla avoid_water: a water node costs 8, not 2).

canFloat() ​

php
public function canFloat() : bool

Paths may go through water floating on it (vanilla can_float: cats and pandas, which lack can_path_over_water).

canPathOverLava() ​

php
public function canPathOverLava() : bool

Paths may wade through lava with a floor below, at a cost of NavigationOptions::LAVA_COST (vanilla can_path_over_lava: wither skeletons, zombified piglins, wardens).

canPathOverWater() ​

php
public function canPathOverWater() : bool

Paths may swim across water (vanilla can_path_over_water, true unless set otherwise).

canSwim() ​

php
public function canSwim() : bool

Whether paths may have the mob's feet in water.

canWalkInLava() ​

php
public function canWalkInLava() : bool

Paths go over lava as if it were land, on its surface (vanilla can_walk_in_lava: striders).

forEntity() ​

php
public static function forEntity(string $networkTypeId) : self

Returns the navigation of a vanilla mob (behavior pack 1.26.50, components and their default component groups), or the defaults for other entity types.

getBlocksToAvoid() ​

php
public function getBlocksToAvoid() : int

Flags of PathBlockTypes paths never go through (vanilla blocks_to_avoid): PathBlockTypes::POWDER_SNOW, PathBlockTypes::TRAPDOOR.

getDangerMask() ​

php
public function getDangerMask() : int

Flags of the blocks the mob's paths never go into, onto or through (see PathFinder::setDangerMask()). Mobs which walk in lava keep LAVA there: they walk on its surface, not through it (lava is their floor, see PathFinder::setFloorMask()).

isAmphibious() ​

php
public function isAmphibious() : bool

Paths may go through water along its bottom (vanilla is_amphibious): the mobs without FloatGoal (zombies, skeletons, the skeleton horse) sink and walk there; for the others this lets their paths into water like can_path_over_water.

setAmphibious() ​

php
public function setAmphibious(bool $amphibious) : self

setAvoidDamageBlocks() ​

php
public function setAvoidDamageBlocks(bool $avoidDamageBlocks) : self

setAvoidSun() ​

php
public function setAvoidSun(bool $avoidSun) : self

setAvoidWater() ​

php
public function setAvoidWater(bool $avoidWater) : self

setBlocksToAvoid() ​

php
public function setBlocksToAvoid(int $flags) : self

setCanFloat() ​

php
public function setCanFloat(bool $canFloat) : self

setCanPathOverLava() ​

php
public function setCanPathOverLava(bool $canPathOverLava) : self

setCanPathOverWater() ​

php
public function setCanPathOverWater(bool $canPathOverWater) : self

setCanWalkInLava() ​

php
public function setCanWalkInLava(bool $canWalkInLava) : self

setWalksThroughFire() ​

php
public function setWalksThroughFire(bool $walksThroughFire) : self

walksThroughFire() ​

php
public function walksThroughFire() : bool

Paths go through fire and soul fire (BDS: undead mobs without avoid_damage_blocks).

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.