Skip to content
Jonko edited this page Nov 22, 2023 · 4 revisions

Crafting the Computerized Cartographer

image

The computerized cartographer can be crafted using seven stone blocks, one redstone dust, and a cartography table, laid out as shown above.

One crafted, simply it place it adjacent to any computer and it will be attached as a peripheral. To access it from Lua, you can simply run:

cart = peripheral.find("cartographer")

Lua Functions

The peripheral has the following Lua functions:

getAvailableIntegrations

  • Parameters: None
  • Returns: String[]

Returns the currently available integrations (the mapping plugins you currently have enabled)

cart.getAvailableIntegrations()

refreshIntegrations

  • Parameters: None
  • Returns: void

Refreshes integrations manually in case new ones have come online since you placed the computerized cartographer

cart.refreshIntegrations()

setCurrentIntegration

  • Parameters: String integrationName
  • Returns: boolean success

If there is only one integration, it is selected by default. However, if there are multiple integrations, you will need to select one using this command.

cart.setCurrentIntegration("bluemap")

getAvailableMaps

  • Parameters: None
  • Returns: String[]

Returns an array of the currently available maps you can select for creating markers on

cart.getAvailableMaps()

getCurrentMap

  • Parameters: None
  • Returns: String

Returns the name of the currently selected map. Note that the name of this map will vary between integrations (e.g. minecraft:the_nether in Pl3xMap is DIM-1 in Dynmap)

cart.getCurrentMap()

setCurrentMap

  • Parameters: String mapName
  • Returns: boolean success

Sets the map to add markers to

cart.setCurrentMap("minecraft:overworld")

addMarkerSet

  • Parameters: String id, String label
  • Returns: boolean success

Adds a new marker set of ID id and labeled with label. The id is how it will be referred to by other commands while the label is how it appears in the GUI.

cart.addMarkerSet("test", "Test Markers")

removeMarkerSet

  • Parameters: String id
  • Returns: boolean success

Removes the marker set of ID id.

cart.removeMarkerSet("test")

getMarkerSets

  • Parameters: None
  • Returns: String[]

Returns the IDs of all the marker sets currently available for use.

cart.getMarkerSets()

clearMarkerSet

  • Parameters: String id
  • Returns: boolean success

Removes all markers from the given set.

cart.clearMarkerSet("test")

addPOIMarker

  • Parameters: String markerSetId, String markerId, String label, String detail, double x, double y, double z, String icon (optional)
  • Returns: boolean success

Adds a "point-of-interest" marker to the map. The optional icon parameter can be specified as a built-in marker for a particular integration, a marker you've previously added to the marker set, or a URL of an image to be used as a marker.

cart.addPOIMarker("test", "wills_tree", "Will's Tree", "This tree belongs to Will", -121, 83, -173, "https://minecraftfaces.com/wp-content/bigfaces/big-husk-face.png")

addLineMarker

  • Parameters: String markerSetId, String markerId, String label, String detail, String color, double colorAlpha, int width, table points
  • Returns: boolean success

Adds a line marker to the map. The color parameter should be specified as an RGB hex value prepended with # (e.g. #FF0000 is red). Alpha is specified separately in the next parameter with a value between 0 (transparent) and 1 (opaque). The structure of the points table can be seen in the example.

cart.addLineMarker("test", "tunnel_route", "Tunnel Route", "The route the tunnel will take", "#FF0000", 0.7, 3, { { x = 0, y = 63, z = 0 }, { x = 17, y = 65, z = 20 }, { x = 256, y = 0, z = 40} })

addCircleMarker

  • Parameters: String markerSetId, String markerId, String label, String detail, String lineColor, double lineAlpha, String fillColor, double fillAlpha, int lineWidth, double x, double y, double z, double radius
  • Returns: boolean success

Creates a circular marker on the map centered on x, y, z with radius radius. lineColor and fillColor are both specified as RGB hex values prepended with # (e.g. #0000FF is blue). Their alphas are specified separately in the following parameters with a value between 0 (transparent) and 1 (opaque).

cart.addCircleMarker("test", "spawn_protect", "Spawn Protection Radius", "Area in which you can't modify blocks around spawn", "#000088", 0.9, "#0000FF", 0.5, 5, 0, 63, 0, 15)

addRectangleMarker

  • Parameters: String markerSetId, String markerId, String label, String detail, String lineColor, double lineAlpha, String fillColor, double fillAlpha, int lineWidth, double x1, double z1, double x2, double z2
  • Returns: boolean success

Creates a rectangular marker on the map with boundaries between (x1, z1) and (x2, z2). lineColor and fillColor are both specified as RGB hex values prepended with # (e.g. #0000FF is blue). Their alphas are specified separately in the following parameters with a value between 0 (transparent) and 1 (opaque).

cart.addRectangleMarker("test", "hotbox", "Hotbox", "", "#006600", 0.8, "#00CC00", 0.6, 2, 69, 420, 420, 69)

addAreaMarker

  • Parameters: String markerSetId, String markerId, String label, String detail, String lineColor, double lineAlpha, String fillColor, double fillAlpha, int lineWidth, table points
  • Returns: boolean success

Creates an arbitrarily-shaped polygon marker on the map with its boundaries defined by the points provided. lineColor and fillColor are both specified as RGB hex values prepended with # (e.g. #0000FF is blue). Their alphas are specified separately in the following parameters with a value between 0 (transparent) and 1 (opaque). The structure of the points table can be seen in the example.

cart.addRectangleMarker("test", "test_area", "Test Area", "", "#FFFFFF", 0.6, "#00000", 0.2, 9, { { x = 0, y = 63, z = 0 }, { x = 17, y = 65, z = 20 }, { x = 256, y = 0, z = 40} })

removeMarker

  • Parameters: String markerSetId, String markerId
  • Returns: boolean success

Removes the specified marker from the specified marker set.

cart.removeMarker("test", "hotbox")

Notes

Any markers created are not persistent and won't survive a server/map reboot, so please make sure to serialize and save your markers if you need to use them again. You can simply have a startup routine read from a serialized file on the computer's disk and loop through adding any markers it finds to the map.