Skip to content

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 ​

readonly persistsAcrossTicks: 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 ​

readonly view: 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 ​

EntityPosition

Returns ​

string | undefined

Inherited from ​

NavigationView.blockAt

canSeeSky()? ​

optional canSeeSky(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 ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.canSeeSky

collisionAt() ​

collisionAt(position): readonly BedrockCollisionBox[] | 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 ​

EntityPosition

Returns ​

readonly BedrockCollisionBox[] | undefined

collisionQuery()? ​

optional collisionQuery(): (position) => readonly BedrockCollisionBox[] | 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()? ​

optional collisionTop(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 ​

EntityPosition

Returns ​

number

Java See ​

PathType.FENCE

Inherited from ​

NavigationView.collisionTop

doorAt()? ​

optional doorAt(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 ​

EntityPosition

Returns ​

DoorState | undefined

Inherited from ​

NavigationView.doorAt

isClimbable()? ​

optional isClimbable(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 ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isClimbable

isDamaging()? ​

optional isDamaging(position): boolean

Defined in: packages/entity-goals/src/navigation/view.ts:42

Whether standing in the block hurts, for avoid_damage_blocks.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isDamaging

isLadder()? ​

optional isLadder(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 ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isLadder

isLava() ​

isLava(position): boolean

Defined in: packages/entity-goals/src/navigation/view.ts:38

Whether the block is lava.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isLava

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 ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isPassable

isPortal()? ​

optional isPortal(position): boolean

Defined in: packages/entity-goals/src/navigation/view.ts:57

Whether the block is a portal, for avoid_portals.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isPortal

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 ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isSolid

isSunlit()? ​

optional isSunlit(position): boolean

Defined in: packages/entity-goals/src/navigation/view.ts:44

Whether the sky reaches the block, for avoid_sun.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isSunlit

isWater() ​

isWater(position): boolean

Defined in: packages/entity-goals/src/navigation/view.ts:36

Whether the block is water or waterlogged.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

Inherited from ​

NavigationView.isWater

lightPathfindingCost()? ​

optional lightPathfindingCost(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 ​

EntityPosition

Returns ​

number

Java See ​

LevelReader.getPathfindingCostFromLightLevels

Inherited from ​

NavigationView.lightPathfindingCost

walkTargetValue()? ​

optional walkTargetValue(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 ​

EntityPosition

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(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 ​

ContentBlockAccess

Block state and lighting queries for the dimension.

content ​

() => ServerContent

The loaded content, for its block behavior table.

level? ​

ContentLevelFacts

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.

Returns ​

CachedNavigationView