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
public const DANGER_MARGIN_COST = 8.0Extra cost of a path node next to something the mob avoids (vanilla Java malus of FIRE_IN_NEIGHBOR).
HEURISTIC_WEIGHT
public const HEURISTIC_WEIGHT = 1.5Weight of the distance to the target in the path search (vanilla Java PathFinder.FUDGING).
LAVA_COST
public const LAVA_COST = 8.0Cost of a node in lava for mobs which path over lava (vanilla Java malus of LAVA for wither skeletons).
Methods
avoidsDamageBlocks()
public function avoidsDamageBlocks() : boolAvoids damage blocks and the blocks next to them (vanilla avoid_damage_blocks), see the class documentation.
avoidsSun()
public function avoidsSun() : boolVanilla 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()
public function avoidsWater() : boolPaths go through water only when there is no other way (vanilla avoid_water: a water node costs 8, not 2).
canFloat()
public function canFloat() : boolPaths may go through water floating on it (vanilla can_float: cats and pandas, which lack can_path_over_water).
canPathOverLava()
public function canPathOverLava() : boolPaths 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()
public function canPathOverWater() : boolPaths may swim across water (vanilla can_path_over_water, true unless set otherwise).
canSwim()
public function canSwim() : boolWhether paths may have the mob's feet in water.
canWalkInLava()
public function canWalkInLava() : boolPaths go over lava as if it were land, on its surface (vanilla can_walk_in_lava: striders).
forEntity()
public static function forEntity(string $networkTypeId) : selfReturns 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()
public function getBlocksToAvoid() : intFlags of PathBlockTypes paths never go through (vanilla blocks_to_avoid): PathBlockTypes::POWDER_SNOW, PathBlockTypes::TRAPDOOR.
getDangerMask()
public function getDangerMask() : intFlags 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()
public function isAmphibious() : boolPaths 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()
public function setAmphibious(bool $amphibious) : selfsetAvoidDamageBlocks()
public function setAvoidDamageBlocks(bool $avoidDamageBlocks) : selfsetAvoidSun()
public function setAvoidSun(bool $avoidSun) : selfsetAvoidWater()
public function setAvoidWater(bool $avoidWater) : selfsetBlocksToAvoid()
public function setBlocksToAvoid(int $flags) : selfsetCanFloat()
public function setCanFloat(bool $canFloat) : selfsetCanPathOverLava()
public function setCanPathOverLava(bool $canPathOverLava) : selfsetCanPathOverWater()
public function setCanPathOverWater(bool $canPathOverWater) : selfsetCanWalkInLava()
public function setCanWalkInLava(bool $canWalkInLava) : selfsetWalksThroughFire()
public function setWalksThroughFire(bool $walksThroughFire) : selfwalksThroughFire()
public function walksThroughFire() : boolPaths go through fire and soul fire (BDS: undead mobs without avoid_damage_blocks).
