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
readonlydimension:string
Defined in: packages/prismarine/src/world/savedMap.ts:202
scale
readonlyscale:number
Defined in: packages/prismarine/src/world/savedMap.ts:206
x
readonlyx:number
Defined in: packages/prismarine/src/world/savedMap.ts:204
A position the map covers, in blocks.
z
readonlyz: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
readonlygameTime:number
Defined in: packages/prismarine/src/world/savedMap.ts:142
The level's game time, which spins a marker in the Nether.
x
readonlyx:number
Defined in: packages/prismarine/src/world/savedMap.ts:137
yaw
readonlyyaw:number
Defined in: packages/prismarine/src/world/savedMap.ts:140
Which way it faces, in degrees.
z
readonlyz: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
readonlydecorations:Readonly<Record<string,MapDecorationEntry>>
Defined in: packages/prismarine/src/world/savedMap.ts:67
dimension
readonlydimension:string
Defined in: packages/prismarine/src/world/savedMap.ts:62
scale
readonlyscale:number
Defined in: packages/prismarine/src/world/savedMap.ts:66
x
readonlyx:number
Defined in: packages/prismarine/src/world/savedMap.ts:64
A position the map covers, in blocks.
z
readonlyz: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
readonlycenterX:number
Defined in: packages/prismarine/src/world/savedMap.ts:38
The block at the map's center.
centerZ
readonlycenterZ: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
readonlydecorations: readonlySavedMapDecoration[]
Defined in: packages/prismarine/src/world/savedMap.ts:43
The markers the map was made with, such as an explorer map's target.
dimension
readonlydimension: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
readonlylocked:boolean
Defined in: packages/prismarine/src/world/savedMap.ts:52
Whether a cartography table locked the map, which stops it filling in.
scale
readonlyscale:number
Defined in: packages/prismarine/src/world/savedMap.ts:41
How far the map is zoomed out: one pixel is 2^scale blocks.
trackingPosition
readonlytrackingPosition:boolean
Defined in: packages/prismarine/src/world/savedMap.ts:45
Whether a holder's marker is drawn, Java's trackingPosition.
unlimitedTracking
readonlyunlimitedTracking: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
readonlyrotation:number
Defined in: packages/prismarine/src/world/savedMap.ts:30
Which way it faces, in sixteenths of a turn.
type
readonlytype:string
Defined in: packages/prismarine/src/world/savedMap.ts:25
Namespaced map decoration type, such as minecraft:red_x.
x
readonlyx: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
readonlyy:number
Defined in: packages/prismarine/src/world/savedMap.ts:28
Variables
MAP_SIZE
constMAP_SIZE:128=128
Defined in: packages/prismarine/src/world/savedMap.ts:20
A map's width and height in pixels.
MAX_MAP_SCALE
constMAX_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
Returns
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
Returns
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
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
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
Returns
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
Returns
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
Returns
Java Source
MapItemSavedData.scaled