Map API

Open the world map on a spot, add to its right-click menu, hide the minimap for a while, and ask what the map knows.

ChartedMap is the world map and the minimap from the outside. From Charted 0.1.0.

Open the world map #

Java
if (ChartedMap.isAvailable() && !ChartedMap.isOpen()) {
    ChartedMap.openAt("minecraft:overworld", 120, -300); // or open(), where it was
}

Add to the right-click menu #

Your entry comes after Charted's own. The action is a BiConsumer<String, int[]>: the dimension and {x, y, z} of the spot.

Java
ChartedMap.addMenuEntry("mymod", "teleport", "Teleport here", (dimension, pos) ->
        sendTeleportRequest(dimension, pos[0], pos[1], pos[2]));

// Take it away again.
ChartedMap.removeMenuEntry("mymod", "teleport");

Hide the minimap for a while #

While a BooleanSupplier is true. It is asked every frame, so keep it cheap.

Java
ChartedMap.hideMinimapWhile("mymod", () -> MyCutscene.isPlaying());

// Stop hiding it.
ChartedMap.showMinimap("mymod");

What the map knows #

column(dimension, x, z) is null where the map has nothing, else a map with block, biome, height, water and source (scanned, distant_horizons or imported).

Java
if (ChartedMap.isExplored("minecraft:overworld", x, z)) {
    Map<String, Object> column = ChartedMap.column("minecraft:overworld", x, z);
}

Let go of everything #

release(owner) takes away all you added: menu entries, minimap hiding, your marks in ChartedMarkers and your waypoint listener.

Reference #

ChartedMapWhat it does
isAvailable() / isOpen()Charted is running in a world; the world map is open.
open() / openAt(dimension, x, z)Opens the world map, where it was or on a block.
addMenuEntry(owner, id, label, action)An entry in the world map's right-click menu, after Charted's.
removeMenuEntry(owner, id)Takes it away.
hideMinimapWhile(owner, condition) / showMinimap(owner)Hides the minimap while a BooleanSupplier is true.
isExplored(dimension, x, z)The map has that column in memory.
column(dimension, x, z)What it knows there, or null.
release(owner)Everything you added, here and in ChartedMarkers, and your waypoint listener, gone.

Something missing or wrong on this page? Say so on Discord.