Markers API
Points and areas of your own on the minimap and the world map: claims, towns, quest targets.
ChartedMarkers draws points and areas on both maps. They are not saved and not the player's: they last until you take them away or the game closes. From Charted 0.1.0.
isAvailable() is always true here, so marks can be set before a world is joined, and from any thread.
A point #
// A dot at a block, with its label under it on the world map.
ChartedMarkers.point("mymod", "quest", "minecraft:overworld", 120, -300, 0xFFAA00, "The old mill");An area #
A box of blocks, both corners included. fill and outline are 0xAARRGGBB; alpha 0 leaves that part out.
ChartedMarkers.area("mymod", "town", "minecraft:overworld",
-64, -64, 63, 63, // x1, z1, x2, z2
0x40_3080FF, 0xFF_3080FF, // fill, outline
"Riverside");Many chunks #
For anything big, a set of chunks as one mark: chunks holds x, z pairs. Call it again with the same id to replace the set.
int[] chunks = { 0, 0, 1, 0, 1, 1 }; // chunk 0,0, chunk 1,0 and chunk 1,1
ChartedMarkers.chunks("mymod", "claim/red", "minecraft:overworld", chunks,
0x40_FF4040, 0xFF_FF4040, "Red team");Replacing and outlines #
- The same owner and id again replaces the mark.
- Areas of one owner with the same outline color that touch share one outline, so a claim of many chunks reads as one shape.
- Up to 8192 points and as many areas per owner.
Without a compile dependency #
Every call takes plain Java types, so reflection is enough. A claims mod:
if (FabricLoader.getInstance().isModLoaded("charted")) {
Class<?> markers = Class.forName("com.charted.api.ChartedMarkers");
Method area = markers.getMethod("area", String.class, String.class, String.class,
int.class, int.class, int.class, int.class, int.class, int.class, String.class);
for (ChunkPos c : team.chunks()) {
area.invoke(null, "myclaims", team.id() + "/" + c.x() + "," + c.z(), "minecraft:overworld",
c.x() * 16, c.z() * 16, c.x() * 16 + 15, c.z() * 16 + 15,
0x40_3080FF, 0xFF_3080FF, team.name());
}
}Reference #
| ChartedMarkers | What it does |
|---|---|
point(owner, id, dimension, x, z, rgb, label) | A dot at a block, label under it on the world map. |
area(owner, id, dimension, x1, z1, x2, z2, fill, outline, label) | A box of blocks, both corners included. |
chunks(owner, id, dimension, chunks, fill, outline, label) | A set of chunks as one mark, chunks being x, z pairs. |
has(owner, id) | Whether you have a mark with that id. |
remove(owner, id) / clear(owner) | Takes one, or all of yours, away. |
Something missing or wrong on this page? Say so on Discord.