Skip to content

API reference / @jsprismarine/prismarine / world/savedMap

world/savedMap ​

Interfaces ​

BlankSavedMap ​

Defined in: packages/prismarine/src/world/savedMap.ts:201

What a blank map is made from; see blankSavedMap.

Properties ​

dimension ​

readonly dimension: string

Defined in: packages/prismarine/src/world/savedMap.ts:202

scale ​

readonly scale: number

Defined in: packages/prismarine/src/world/savedMap.ts:206

x ​

readonly x: number

Defined in: packages/prismarine/src/world/savedMap.ts:204

A position the map covers, in blocks.

z ​

readonly z: number

Defined in: packages/prismarine/src/world/savedMap.ts:205


MapHolderPosition ​

Defined in: packages/prismarine/src/world/savedMap.ts:136

Where a holder stands, for its marker.

Properties ​

gameTime ​

readonly gameTime: number

Defined in: packages/prismarine/src/world/savedMap.ts:142

The level's game time, which spins a marker in the Nether.

x ​

readonly x: number

Defined in: packages/prismarine/src/world/savedMap.ts:137

yaw ​

readonly yaw: number

Defined in: packages/prismarine/src/world/savedMap.ts:140

Which way it faces, in degrees.

z ​

readonly z: number

Defined in: packages/prismarine/src/world/savedMap.ts:138


NewSavedMap ​

Defined in: packages/prismarine/src/world/savedMap.ts:61

What a new map is made from; see newSavedMap.

Properties ​

decorations ​

readonly decorations: Readonly<Record<string, MapDecorationEntry>>

Defined in: packages/prismarine/src/world/savedMap.ts:67

dimension ​

readonly dimension: string

Defined in: packages/prismarine/src/world/savedMap.ts:62

scale ​

readonly scale: number

Defined in: packages/prismarine/src/world/savedMap.ts:66

x ​

readonly x: number

Defined in: packages/prismarine/src/world/savedMap.ts:64

A position the map covers, in blocks.

z ​

readonly z: number

Defined in: packages/prismarine/src/world/savedMap.ts:65


SavedMap ​

Defined in: packages/prismarine/src/world/savedMap.ts:34

One map, as a level keeps it under its id.

Properties ​

centerX ​

readonly centerX: number

Defined in: packages/prismarine/src/world/savedMap.ts:38

The block at the map's center.

centerZ ​

readonly centerZ: number

Defined in: packages/prismarine/src/world/savedMap.ts:39

colors ​

colors: Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/prismarine/src/world/savedMap.ts:57

Java's packed color ids, x + z * 128, with 0 for an undrawn pixel; see mapColors.ts. Undefined for an explorer map whose biome preview is not drawn yet.

decorations ​

readonly decorations: readonly SavedMapDecoration[]

Defined in: packages/prismarine/src/world/savedMap.ts:43

The markers the map was made with, such as an explorer map's target.

dimension ​

readonly dimension: string

Defined in: packages/prismarine/src/world/savedMap.ts:36

The level's id for the dimension the map shows, such as minecraft:overworld.

locked ​

readonly locked: boolean

Defined in: packages/prismarine/src/world/savedMap.ts:52

Whether a cartography table locked the map, which stops it filling in.

scale ​

readonly scale: number

Defined in: packages/prismarine/src/world/savedMap.ts:41

How far the map is zoomed out: one pixel is 2^scale blocks.

trackingPosition ​

readonly trackingPosition: boolean

Defined in: packages/prismarine/src/world/savedMap.ts:45

Whether a holder's marker is drawn, Java's trackingPosition.

unlimitedTracking ​

readonly unlimitedTracking: boolean

Defined in: packages/prismarine/src/world/savedMap.ts:50

Whether a marker outside the map stays on it, pinned to the edge, and a holder far off it is still drawn as a small dot. Java makes explorer maps this way and empty maps not.


SavedMapDecoration ​

Defined in: packages/prismarine/src/world/savedMap.ts:23

One marker on a saved map, in Java's map coordinates.

Properties ​

rotation ​

readonly rotation: number

Defined in: packages/prismarine/src/world/savedMap.ts:30

Which way it faces, in sixteenths of a turn.

type ​

readonly type: string

Defined in: packages/prismarine/src/world/savedMap.ts:25

Namespaced map decoration type, such as minecraft:red_x.

x ​

readonly x: number

Defined in: packages/prismarine/src/world/savedMap.ts:27

The marker's offset from the map's center in half pixels, a signed byte as Java stores it.

y ​

readonly y: number

Defined in: packages/prismarine/src/world/savedMap.ts:28

Variables ​

MAP_SIZE ​

const MAP_SIZE: 128 = 128

Defined in: packages/prismarine/src/world/savedMap.ts:20

A map's width and height in pixels.


MAX_MAP_SCALE ​

const MAX_MAP_SCALE: 4 = 4

Defined in: packages/prismarine/src/world/savedMap.ts:198

Java's MapItemSavedData.MAX_SCALE, the furthest a map zooms out.

Java Source ​

MapItemSavedData.MAX_SCALE

Functions ​

biomePreviewColors() ​

biomePreviewColors(map, isWater, dataVersion?): Uint8Array

Defined in: packages/prismarine/src/world/savedMap.ts:263

Java's MapItem.renderBiomePreviewMap: the outline of the water an explorer map is drawn with before anyone has walked it.

Every pixel samples one biome at sea level and asks whether it is in #minecraft:water_on_map_outlines. A water pixel with dry neighbors is drawn as an orange coast, darker the drier its neighborhood; open water is left blank except for a wavy band of stripes. A dry pixel beside water is drawn brown. The outermost ring of pixels is never drawn.

Parameters ​

map ​

Pick<SavedMap, "centerX" | "centerZ" | "scale">

The map's center and scale.

isWater ​

(x, z) => boolean

Whether the biome at a block, sampled at sea level, is outlined as water.

dataVersion? ​

number

The data version of the Java release the level runs, whose Mth.sin draws the water's stripes; undefined draws the oldest release's.

Returns ​

Uint8Array

Java's packed color ids, x + z * 128, with 0 for an undrawn pixel.

Java Source ​

MapItem.renderBiomePreviewMap


blankSavedMap() ​

blankSavedMap(request): SavedMap

Defined in: packages/prismarine/src/world/savedMap.ts:215

A map with nothing drawn on it, made around a position: Java's MapItemSavedData.createFresh as an empty map and a zoomed-out copy make it, tracking its holders within reach of the map.

Parameters ​

request ​

BlankSavedMap

Returns ​

SavedMap

Java Source ​

MapItemSavedData.createFresh


decorationOnMap() ​

decorationOnMap(map, entry): SavedMapDecoration

Defined in: packages/prismarine/src/world/savedMap.ts:107

One marker placed on a map, as Java's addDecoration places it.

An explorer map is made with unlimited tracking, so a marker outside the map stays on it, pinned to the edge, rather than being dropped.

Parameters ​

map ​

Pick<SavedMap, "centerX" | "centerZ" | "scale">

entry ​

MapDecorationEntry

Returns ​

SavedMapDecoration


drawnColors() ​

drawnColors(map, isWater, dataVersion?): Uint8Array

Defined in: packages/prismarine/src/world/savedMap.ts:237

The pixels of a map, drawing an explorer map's biome preview first when it has none yet.

Parameters ​

map ​

SavedMap

isWater ​

(x, z) => boolean

Whether the biome at a block, sampled at sea level, is outlined as water.

dataVersion? ​

number

The data version of the Java release the level runs, whose Mth.sin draws the water's stripes; undefined draws the oldest release's.

Returns ​

Uint8Array


holderDecorationOnMap() ​

holderDecorationOnMap(map, position): SavedMapDecoration | undefined

Defined in: packages/prismarine/src/world/savedMap.ts:150

A holder's marker on a map, as Java's addDecoration places a minecraft:player: an arrow on the map, a dot at its edge within 320 pixels of it, and a small dot further off for a map with unlimited tracking. Undefined when the holder is too far off to draw.

Parameters ​

map ​

Pick<SavedMap, "centerX" | "centerZ" | "scale" | "dimension" | "unlimitedTracking">

position ​

MapHolderPosition

Returns ​

SavedMapDecoration | undefined


lockedSavedMap() ​

lockedSavedMap(map): SavedMap

Defined in: packages/prismarine/src/world/savedMap.ts:327

A locked copy of a map, as a cartography table locks one with a glass pane: the same center, zoom, markers and pixels, which no holder fills in any further.

Parameters ​

map ​

SavedMap

Returns ​

SavedMap

Java Source ​

MapItemSavedData.locked()Lnet/minecraft/world/level/saveddata/maps/MapItemSavedData;


newSavedMap() ​

newSavedMap(request): SavedMap

Defined in: packages/prismarine/src/world/savedMap.ts:178

An explorer map made around a position, Java's MapItem.create with unlimited tracking and the decorations it starts with. Its pixels are the biome preview, drawn later.

Parameters ​

request ​

NewSavedMap

Returns ​

SavedMap

Java Source ​

MapItem.create


scaledSavedMap() ​

scaledSavedMap(map): SavedMap

Defined in: packages/prismarine/src/world/savedMap.ts:340

A map one step further out than map, around the same center, as a map extended with paper in a crafting table becomes: Java's MapItemSavedData.scaled. Nothing is drawn on it yet.

Parameters ​

map ​

SavedMap

Returns ​

SavedMap

Java Source ​

MapItemSavedData.scaled