Developers Other addons

Markers on BedrockMap

Any behaviour pack in a world running BedrockRelay can put markers on the world's BedrockMap map, such as death points, waypoints or shops, by firing a script event. No web requests, no key in your addon, and it works on Realms.

How it works

Your addon fires bedrockmap:marker or bedrockmap:remove. BedrockRelay picks it up in the world and sends it to the world's map with the world's own link, so your addon needs no internet access and holds no key.

It works when all of these are true:

  • The world is linked to its map on BedrockRelay. See BedrockMap in the help.
  • The world's owner allows it on BedrockMap, with Addons may add markers on the world's Developers page there. Markers are a BedrockMap Premium feature, and count towards the map's marker limit.
  • BedrockRelay pack v0.10.0 or later on a dedicated server, or the Realm pack v1.5.0 or later on a Realm.

Otherwise your events are ignored, so you can fire them in every world without checking.

bedrockmap:marker

Adds a marker, or moves and renames one your addon placed before with the same ref. The event's message is a JSON string.

FieldTypeDescription
appstring, requiredYour addon's name: letters, numbers, spaces, - and _, up to 32 characters. Your markers belong to it, and the owner sees them listed under it.
namestring, requiredWhat the marker is called on the map. Up to 80 characters.
x, znumber, requiredWhere it goes.
ynumberIts height.
dimensionstring, requiredoverworld, nether or the_end, or a dimension id like minecraft:nether. player.dimension.id works as it is.
refstringYour own name for this marker, up to 64 characters, like death:Steve. Unique among your addon's markers in that world: sending the same ref again replaces the marker, and bedrockmap:remove needs it.
notestringShown when someone clicks the marker. Up to 1,000 characters.
typestring or numberThe marker's icon: one of the map's marker types, by id (shop, home, custom:31) or by name (Graves).
import { system, world } from "@minecraft/server";

world.afterEvents.entityDie.subscribe(({ deadEntity }) => {
  if (deadEntity.typeId !== "minecraft:player") return;
  const { x, y, z } = deadEntity.location;
  system.sendScriptEvent("bedrockmap:marker", JSON.stringify({
    app: "DeathPoints",
    ref: `death:${deadEntity.name}`,
    name: `${deadEntity.name} died here`,
    x: Math.floor(x), y: Math.floor(y), z: Math.floor(z),
    dimension: deadEntity.dimension.id,
    type: "Graves",
  }));
});

bedrockmap:remove

Removes one of your addon's markers, by the ref you gave it. Takes app and ref, both required.

system.sendScriptEvent("bedrockmap:remove", JSON.stringify({
  app: "DeathPoints",
  ref: "death:Steve",
}));

Markers don't expire. Remove yours when they stop being true, such as a death point once its items are collected.

Limits and what to expect

  • Up to 20 events a second and 60 a minute for each world; more are dropped.
  • Several events for the same app and ref within 2 seconds are sent as one: the last. So a waypoint that follows a player every tick costs one marker change every 2 seconds.
  • A script event's message is limited to 2,048 characters. Minecraft colour codes are removed from text, and longer text is cut to the limits above.
  • An event with malformed JSON or a missing required field is ignored.
  • Nothing answers your addon: it can't tell whether a marker was taken. The world's owner sees your markers, and removes them if they want, on BedrockMap.
  • Events are passed on only while BedrockRelay is connected; unlike discord:message, they aren't kept for later. Events fired as the world starts, before BedrockRelay connects, are lost, and on a Realm so are events fired while our bot isn't there. If a marker must get there, fire it again on discord:ready: with a ref, sending it twice does no harm.

Building something outside Minecraft, such as a Discord bot or a website? BedrockMap has its own API for markers, with a key the owner makes on the same Developers page.

Running a Minecraft world rather than building for one? The help covers everything from setup to troubleshooting.

Read the help