API reference / @jsprismarine/prismarine / entity/data/navigationView
entity/data/navigationView
Interfaces
CachedNavigationView
Defined in: packages/prismarine/src/entity/data/navigationView.ts:100
The path finder's block view and the cache control the owning runtime needs.
Properties
persistsAcrossTicks
readonlypersistsAcrossTicks:boolean
Defined in: packages/prismarine/src/entity/data/navigationView.ts:103
Whether loaded chunk identities and revisions make reads safe to retain between ticks.
view
readonlyview:EntityBlockView
Defined in: packages/prismarine/src/entity/data/navigationView.ts:101
Methods
invalidateBlockCache()
invalidateBlockCache(
chunkX?,chunkZ?):void
Defined in: packages/prismarine/src/entity/data/navigationView.ts:105
Drops all cached reads, or just the reads for one changed or unloaded chunk.
Parameters
chunkX?
number
chunkZ?
number
Returns
void
EntityBlockView
Defined in: packages/prismarine/src/entity/data/navigationView.ts:84
The path finder's block view, with the block shapes entity physics collides with.
Extends
Methods
blockAt()
blockAt(
position):string|undefined
Defined in: packages/entity-goals/src/navigation/view.ts:30
The block identifier, such as minecraft:stone, or undefined outside the loaded world.
Parameters
position
Returns
string | undefined
Inherited from
canSeeSky()?
optionalcanSeeSky(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:46
Whether Java's level says the block column can see the sky.
Parameters
position
Returns
boolean
Inherited from
collisionAt()
collisionAt(
position): readonlyBedrockCollisionBox[] |undefined
Defined in: packages/prismarine/src/entity/data/navigationView.ts:89
The collision boxes of the block at a position, normalized to its cell, or undefined outside the loaded world. A box may reach past the cell, as a fence's does.
Parameters
position
Returns
readonly BedrockCollisionBox[] | undefined
collisionQuery()?
optionalcollisionQuery(): (position) => readonlyBedrockCollisionBox[] |undefined
Defined in: packages/prismarine/src/entity/data/navigationView.ts:96
A EntityBlockView.collisionAt for one collision query, which asks the world for each chunk the query reaches once rather than once per cell. A query reads and never writes, so the chunk it found for its first cell still holds the cells after it. Drop it when the query ends: a block may change before the next one.
Returns
(position) => readonly BedrockCollisionBox[] | undefined
collisionTop()?
optionalcollisionTop(position):number
Defined in: packages/entity-goals/src/navigation/view.ts:69
How high the block's collision shape reaches above the block's own floor, in blocks: 1 for a full block, 1.5 for a fence or a wall, 0 for a block with no collision. A block that reaches above 1 can neither be stood on nor stepped over, Java's PathType.FENCE.
Parameters
position
Returns
number
Java See
PathType.FENCE
Inherited from
doorAt()?
optionaldoorAt(position):DoorState|undefined
Defined in: packages/entity-goals/src/navigation/view.ts:40
The door at the block, or undefined when it is not a door.
Parameters
position
Returns
DoorState | undefined
Inherited from
isClimbable()?
optionalisClimbable(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:59
Whether an entity climbs the block, such as a ladder or a vine.
Parameters
position
Returns
boolean
Inherited from
isDamaging()?
optionalisDamaging(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:42
Whether standing in the block hurts, for avoid_damage_blocks.
Parameters
position
Returns
boolean
Inherited from
isLadder()?
optionalisLadder(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:61
Whether the block is a ladder, which minecraft:can_climb lets entities climb.
Parameters
position
Returns
boolean
Inherited from
isLava()
isLava(
position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:38
Whether the block is lava.
Parameters
position
Returns
boolean
Inherited from
isPassable()
isPassable(
position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:32
Whether an entity fits in the block, which liquids and plants allow and full blocks do not.
Parameters
position
Returns
boolean
Inherited from
isPortal()?
optionalisPortal(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:57
Whether the block is a portal, for avoid_portals.
Parameters
position
Returns
boolean
Inherited from
isSolid()
isSolid(
position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:34
Whether the block holds an entity standing on top of it.
Parameters
position
Returns
boolean
Inherited from
isSunlit()?
optionalisSunlit(position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:44
Whether the sky reaches the block, for avoid_sun.
Parameters
position
Returns
boolean
Inherited from
isWater()
isWater(
position):boolean
Defined in: packages/entity-goals/src/navigation/view.ts:36
Whether the block is water or waterlogged.
Parameters
position
Returns
boolean
Inherited from
lightPathfindingCost()?
optionallightPathfindingCost(position):number
Defined in: packages/entity-goals/src/navigation/view.ts:55
Java's LevelReader.getPathfindingCostFromLightLevels at the block: its light-dependent brightness less 0.5, which an animal's walk-target value is off grass.
Parameters
position
Returns
number
Java See
LevelReader.getPathfindingCostFromLightLevels
Inherited from
NavigationView.lightPathfindingCost
walkTargetValue()?
optionalwalkTargetValue(position):number
Defined in: packages/entity-goals/src/navigation/view.ts:48
A monster's Java walk-target value at the block, for hide-position searches.
Parameters
position
Returns
number
Inherited from
NavigationView.walkTargetValue
Functions
isLavaIdentifier()
isLavaIdentifier(
identifier):boolean
Defined in: packages/prismarine/src/entity/data/navigationView.ts:32
Whether a block identifier is lava, as EntityBlockView.isLava reads a cell.
Parameters
identifier
string | undefined
Returns
boolean
isWaterIdentifier()
isWaterIdentifier(
identifier):boolean
Defined in: packages/prismarine/src/entity/data/navigationView.ts:28
Whether a block identifier is water, as EntityBlockView.isWater reads a cell.
Parameters
identifier
string | undefined
Returns
boolean
navigationViewOf()
navigationViewOf(
blocks,content,level?,maxCachedBlocks?):CachedNavigationView
Defined in: packages/prismarine/src/entity/data/navigationView.ts:122
Builds the path finder's view of one dimension.
Built once per runtime rather than per query, because the memo below is what makes a path search affordable: one A* expands up to 512 nodes and reads about eight cells at each, so a stroll that finds nothing costs four thousand block reads, and a server runs one of those per wandering mob per tick.
Parameters
blocks
Block state and lighting queries for the dimension.
content
() => ServerContent
The loaded content, for its block behavior table.
level?
The dimension clock and sky settings; omitted by callers with no level view.
maxCachedBlocks?
number = MAX_CACHED_BLOCKS
A smaller bound for deterministic eviction tests.