Play Strawberry Docs
Scripts

Maps on the screen

Show players a map of the place around them on the HUD and in the Tab list, with markers and a party, on a vanilla Java client.

A vanilla Java client can show a map without any mod: your server's resource pack carries a font whose characters are pictures (the map cut into tiles, the icons, an arrow) and characters that only move the text by some pixels. The server writes those characters into a text the game draws anyway: a boss bar's name at the top of the screen, or the Tab list's header. When the player moves, the server sends the text again with the arrow somewhere else.

The minimap script

The minimap script does all of it for you, together with user_interface (the HUD) and tab-and-scoreboard (the Tab list).

  1. Render the place once: /minimap render city world -256 -256 255 255. The world is read off the game's tick, in steps; you are told when it is done. A world your script generates works the same: rendering an area makes its chunks as the server would make them for a player.
  2. The script puts the map's pictures and font, and the arrows of the ground guide, into your server's resource pack itself; your server needs custom content. After a render the new pack goes to your players, and a player sees the new place once their pack has loaded.
  3. The HUD: add {"text": "{minimap:map}", "font": "minimap:map", "place": "top"} to the elements of user_interface's hud.json, and "fonts": {"minimap:map": {"default": 0}}.
  4. The Tab list: in the minimap's settings in the panel, set "Map in Tab" (tab_map) to the whole area (full) or the explored parts (explored). Then put {minimap:tab} on the first header line of tab-and-scoreboard, with eight empty header lines under it and icons = pack-required.

With explored the Tab map starts dark, and a part of it opens when the player, or anyone in their party, has stood there; the server keeps what was opened. A game about finding the way shows only what a party has found.

The same settings form changes the shape, the marker style and colours, the frame, which players show and how often the map is sent; /minimap reload applies them. A sneaking, invisible or spectating player, and one wearing a carved_pumpkin or a mob head, is not shown to others (the form can show sneaking players). The code is public: github.com/playstrawberry/minimap.

Players hide or show their own map with /minimap off and /minimap on.

Markers and parties from your script

Send the minimap a script message (fields separated by a TAB, lines by a line feed):

text
minimap/1
set	*	shop	world	120.5	-40	shop
set	<player uuid>	goal	world	300	12	quest
party	<player uuid>	red
guide	<player uuid>	world	300	12
clear	*	shop
  • * is a marker everyone in that world sees; a uuid one only that player sees. Icons: player, friend, red, green, blue, yellow, shop, quest.
  • party puts a player into a party (- takes them out). Players of one party see each other on both maps, and share what they opened of the Tab map.
  • The server owner names the scripts that may do this in the minimap's settings (marker_plugins); a message from any other script is refused. A script changes only its own markers.
  • The answer is minimap/1 ok, or an error with its reason; a message that breaks a rule changes nothing.

Arrows on the ground

The minimap can also show a player the way. Send guide <player uuid> world 300 12 in a minimap/1 message (guide <player uuid> - takes it away).

  • Up to ten flat arrows lie on the ground in front of the player, pointing to the place, seen only by that player. They follow and go away on arrival.
  • The way is a straight line, so a game that leads around walls sends the next guide at each turn.
  • Try it yourself with /minimap guide <x> <z> and /minimap guide off.
  • Java and Bedrock players see the arrows; a Bedrock player takes the pack when they join.

Your own font

You can also draw your own picture the same way, for example a map of the places a player has seen in a game whose levels have ceilings. Describe it in your pack's fonts (see Resource packs, "Fonts of your own"). A map there cuts your picture into tiles, one character each, with each row of tiles drawn at its own height, so the whole map is one line of text. The build writes the character of every tile, and how far the text moves after it, into <your pack>-fonts.json. A glyph moves the text by one past its last column that has a pixel, plus one, so a 16-pixel tile moves it by 17. Leave out a tile the player has not seen and send a move of its width instead. Then push the text:

  • to the HUD: placeholders/1 with set <uuid> <key> <text> to user_interface, and the element names the font;
  • to the Tab list: placeholders/1 with glyphs <uuid> <key> <your font> <text> to tab-and-scoreboard.

A value is at most 256 characters. Send it only when it changes, and all players' changes in one message.

What it costs

  • On the server: nothing is read of the world while players play. A map is sent to a player only when what they see changed: they crossed a block or turned, or a marker or a party member moved.
  • On the player's computer: the game keeps a copy of a font picture for each height it is drawn at. /minimap status says how much memory your HUD map takes there, and a render that would take more than 64 MB is refused. The Tab map is small.

Who sees what

Player

HUD map

Tab map

Java, with your pack

yes

yes

Java, without your pack

nothing

nothing

Java with a shader pack

yes (fonts are not shaders)

yes

Bedrock

no map; the arrows on the ground work

nothing (Bedrock has no Tab header)

The map shows the surface, as a vanilla map does: nothing under the ground. Other players appear only with the "Show other players" setting, only if the viewer can see them, and never a spectator.

On this page