Skip to content

API reference / @jsprismarine/prismarine / world/mapCarriers / MapCarriers

Class: MapCarriers ​

Defined in: packages/prismarine/src/world/mapCarriers.ts:103

The carriers of one map.

Constructors ​

Constructor ​

new MapCarriers(map): MapCarriers

Defined in: packages/prismarine/src/world/mapCarriers.ts:109

Parameters ​

map ​

SavedMap

Returns ​

MapCarriers

Methods ​

decorations() ​

decorations(viewer?): readonly SavedMapDecoration[]

Defined in: packages/prismarine/src/world/mapCarriers.ts:131

Every marker one player is shown: the saved ones, then the holders'.

A holder's marker stays until some carrier of the map ticks, as in Java, so a holder that left or put the map away since, or that hides from maps, is left out here. Java sends a player the markers right after that player's own tick has taken those off; a map asked for outside a tick has no such tick. The viewer's own marker is always shown.

Parameters ​

viewer? ​

MapCarrier

The player shown the map, or undefined for nobody's own marker.

Returns ​

readonly SavedMapDecoration[]


nextStep() ​

nextStep(carrier): number

Defined in: packages/prismarine/src/world/mapCarriers.ts:166

Advances a holder's step and answers it, for updateMapAround.

Parameters ​

carrier ​

MapCarrier

Returns ​

number


nextUpdate() ​

nextUpdate(carrier): MapUpdate | undefined

Defined in: packages/prismarine/src/world/mapCarriers.ts:186

What a holder has not been sent yet, or undefined when it is up to date or not a holder.

Parameters ​

carrier ​

MapCarrier

Returns ​

MapUpdate | undefined


paint() ​

readonly paint(x, z, packedColor): boolean

Defined in: packages/prismarine/src/world/mapCarriers.ts:176

Writes a pixel and marks it dirty for every holder, Java's updateColor.

Parameters ​

x ​

number

z ​

number

packedColor ​

number

Returns ​

boolean

Whether the pixel changed.


tickCarriedBy() ​

tickCarriedBy(ticking): void

Defined in: packages/prismarine/src/world/mapCarriers.ts:147

Java's tickCarriedBy for a map in a player's inventory: registers the player, then moves every holder's marker and drops each holder that left or no longer carries the map.

Parameters ​

ticking ​

MapCarrier

Returns ​

void


unsent() ​

unsent(carrier, update): void

Defined in: packages/prismarine/src/world/mapCarriers.ts:197

Owes a holder an update again after it failed to reach the player, so the next one carries its pixels and markers rather than leaving them stale on the client.

Parameters ​

carrier ​

MapCarrier

update ​

MapUpdate

Returns ​

void