endstone/map
Classes
| Name | Description |
|---|---|
MapCanvas | Represents a canvas for drawing to a map. |
MapCursor | Represents a cursor on a map. |
MapRenderer | Represents a renderer for a map. |
MapView | Represents a map item. |
classMapCanvas
Defined in <endstone/map/map_canvas.h>
Represents a canvas for drawing to a map.
Note
Each canvas is associated with a specific MapRenderer and represents that renderer's layer on the map.
Methods
| Name | Description |
|---|---|
~MapCanvas | |
getMapView | Get the map this canvas is attached to. |
getCursors | Get the cursors associated with this canvas. |
setCursors | Set the cursors associated with this canvas. |
setPixelColor | Draw a pixel to the canvas. |
getPixelColor | Get a pixel from the canvas. |
getBasePixelColor | Get a pixel from the layers below this canvas. |
setPixel | Draw a pixel to the canvas. |
getPixel | Get a pixel from the canvas. |
getBasePixel | Get a pixel from the layers below this canvas. |
drawImage | Draw an image to the map. The image will be clipped if necessary. |
meth~MapCanvasvirtual
~MapCanvas() =defaultmethgetMapViewabstractconst
MapView& getMapView() const =0Get the map this canvas is attached to.
methgetCursorsabstractconst
std::vector<MapCursor> getCursors() const =0Get the cursors associated with this canvas.
Returns
| Type | Description |
|---|---|
std::vector<MapCursor> | The MapCursorCollection associated with this canvas. |
methsetCursorsabstract
void setCursors(const std::vector<MapCursor>& cursors) =0Set the cursors associated with this canvas.
Parameters
| Name | Type | Description |
|---|---|---|
cursors | const std::vector<MapCursor>& | The MapCursorCollection to associate with this canvas. |
methsetPixelColorabstract
void setPixelColor(int x, int y, Color color) =0Draw a pixel to the canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
color | Color | The color |
methgetPixelColorabstractconst
Color getPixelColor(int x, int y) const =0Get a pixel from the canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
Returns
| Type | Description |
|---|---|
Color | The color |
methgetBasePixelColorabstractconst
Color getBasePixelColor(int x, int y) const =0Get a pixel from the layers below this canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
Returns
| Type | Description |
|---|---|
Color | The color |
methsetPixelabstract
void setPixel(int x, int y, std::uint32_t color) =0Draw a pixel to the canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
color | std::uint32_t | The color. |
methgetPixelabstractconst
std::uint32_t getPixel(int x, int y) const =0Get a pixel from the canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
Returns
| Type | Description |
|---|---|
std::uint32_t | The color. |
methgetBasePixelabstractconst
std::uint32_t getBasePixel(int x, int y) const =0Get a pixel from the layers below this canvas.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The x coordinate, from 0 to 127. |
y | int | The y coordinate, from 0 to 127. |
Returns
| Type | Description |
|---|---|
std::uint32_t | The color. |
methdrawImageabstract
void drawImage(int x, int y, const Image& image) =0Draw an image to the map. The image will be clipped if necessary.
classMapCursor
Defined in <endstone/map/map_cursor.h>
Represents a cursor on a map.
Enums
| Name | Description |
|---|---|
Type | Represents the standard types of map cursors. |
Methods
| Name | Description |
|---|---|
MapCursor | Initialize the map cursor. |
getX | Get the X position of this cursor. |
getY | Get the Y position of this cursor. |
getDirection | Get the direction of this cursor. |
getType | Get the type of this cursor. |
isVisible | Get the visibility status of this cursor. |
setX | Set the X position of this cursor. |
setY | Set the Y position of this cursor. |
setDirection | Set the direction of this cursor. |
setType | Set the type of this cursor. |
setVisible | |
getCaption | Gets the caption on this cursor. |
setCaption | Sets the caption on this cursor. |
enumType
TypeRepresents the standard types of map cursors.
Values
| Name | Value | Description |
|---|---|---|
Player | 0 | |
Frame | 1 | |
RedMarker | 2 | |
BlueMarker | 3 | |
TargetX | 4 | |
TargetPoint | 5 | |
PlayerOffMap | 6 | |
SignMarker | 7 | |
PinkMarker | 8 | |
OrangeMarker | 9 | |
YellowMarker | 10 | |
CyanMarker | 11 | |
GreenPoint | 12 | |
PlayerOffLimits | 13 | |
Mansion | 14 | |
Monument | 15 | |
VillageDesert | 17 | |
VillagePlains | 18 | |
VillageSavanna | 19 | |
VillageSnowy | 20 | |
VillageTaiga | 21 | |
JungleTemple | 22 | |
SwampHut | 23 | |
TrialChambers | 24 |
methMapCursor
MapCursor(std::int8_t x, std::int8_t y, std::int8_t direction, Type type, bool visible, std::string caption = "")Initialize the map cursor.
Parameters
| Name | Type | Description |
|---|---|---|
x | std::int8_t | The x coordinate, from -128 to 127. |
y | std::int8_t | The y coordinate, from -128 to 127. |
direction | std::int8_t | The facing of the cursor, from 0 to 15. |
type | Type | The type (color/style) of the map cursor. |
visible | bool | Whether the cursor is visible by default. |
caption | std::string | cursor caption |
methgetXconst
std::int8_t getX() constGet the X position of this cursor.
Returns
| Type | Description |
|---|---|
std::int8_t | The X coordinate. |
methgetYconst
std::int8_t getY() constGet the Y position of this cursor.
Returns
| Type | Description |
|---|---|
std::int8_t | The Y coordinate. |
methgetDirectionconst
std::int8_t getDirection() constGet the direction of this cursor.
Returns
| Type | Description |
|---|---|
std::int8_t | The facing of the cursor, from 0 to 15. |
methgetTypeconst
Type getType() constGet the type of this cursor.
Returns
| Type | Description |
|---|---|
Type | The type (color/style) of the map cursor. |
methisVisibleconst
bool isVisible() constGet the visibility status of this cursor.
Returns
| Type | Description |
|---|---|
bool | True if visible, false otherwise. |
methsetX
void setX(const std::int8_t x)Set the X position of this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
x | const std::int8_t | The X coordinate. |
methsetY
void setY(const std::int8_t y)Set the Y position of this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
y | const std::int8_t | The Y coordinate. |
methsetDirection
void setDirection(std::int8_t direction)Set the direction of this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
direction | std::int8_t | The facing of the cursor, from 0 to 15. |
methsetType
void setType(Type type)Set the type of this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
type | Type | The type (color/style) of the map cursor. |
methsetVisible
void setVisible(bool visible)Set the visibility status of this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
visible | bool | True if visible. |
methgetCaptionconst
std::string getCaption() constGets the caption on this cursor.
Returns
| Type | Description |
|---|---|
std::string | caption |
methsetCaption
void setCaption(std::string caption)Sets the caption on this cursor.
Parameters
| Name | Type | Description |
|---|---|---|
caption | std::string | new caption |
classMapRenderer
Defined in <endstone/map/map_renderer.h>
Represents a renderer for a map.
Methods
| Name | Description |
|---|---|
MapRenderer | Initialize the map renderer base with the given contextual status. |
~MapRenderer | |
isContextual | Get whether the renderer is contextual, i.e. has different canvases for different players. |
initialize | Initialize this MapRenderer for the given map. |
render | Render to the given map. |
methMapRendererexplicit
MapRenderer(const bool is_contextual = false)Initialize the map renderer base with the given contextual status.
Parameters
| Name | Type | Description |
|---|---|---|
is_contextual | const bool | Whether the renderer is contextual. See isContextual(). |
meth~MapRenderervirtual
~MapRenderer() =defaultmethisContextualconst
bool isContextual() constGet whether the renderer is contextual, i.e. has different canvases for different players.
Returns
| Type | Description |
|---|---|
bool | true if contextual, false otherwise. |
methinitializevirtual
void initialize(MapView& map)Initialize this MapRenderer for the given map.
methrenderabstract
Render to the given map.
classMapView
Defined in <endstone/map/map_view.h>
Represents a map item.
Enums
| Name | Description |
|---|---|
Scale | An enum representing all possible scales a map can be set to. |
Methods
| Name | Description |
|---|---|
~MapView | |
getId | Get the ID of this map item for use with MapMeta. |
isVirtual | Check whether this map is virtual. |
getScale | Get the scale of this map. |
setScale | Set the scale of this map. |
getCenterX | Get the center X position of this map. |
getCenterZ | Get the center Z position of this map. |
setCenterX | Set the center X position of this map. |
setCenterZ | Set the center Z position of this map. |
getDimension | Get the dimension that this map is associated with. |
setDimension | Set the dimension that this map is associated with. |
getRenderers | Get a list of MapRenderers currently in effect. |
addRenderer | Add a renderer to this map. |
removeRenderer | Remove a renderer from this map. |
isUnlimitedTracking | Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range. |
setUnlimitedTracking | Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range. |
isLocked | Gets whether the map is locked or not. A locked map may not be explored further. |
setLocked | Sets whether the map is locked or not. A locked map may not be explored further. |
enumScale
uint8_t ScaleAn enum representing all possible scales a map can be set to.
Values
| Name | Value | Description |
|---|---|---|
Closest | 0 | |
Close | 1 | |
Normal | 2 | |
Far | 3 | |
Farthest | 4 |
meth~MapViewvirtual
~MapView() =defaultmethgetIdabstractconst
std::int64_t getId() const =0Get the ID of this map item for use with MapMeta.
Returns
| Type | Description |
|---|---|
std::int64_t | The unique ID of the map. |
methisVirtualabstractconst
bool isVirtual() const =0Check whether this map is virtual.
A map is virtual if its lowermost MapRenderer is plugin-provided.
Returns
| Type | Description |
|---|---|
bool | True if the map is virtual. |
methgetScaleabstractconst
Scale getScale() const =0Get the scale of this map.
Returns
| Type | Description |
|---|---|
Scale | The scale of the map. |
methsetScaleabstract
void setScale(Scale scale) =0Set the scale of this map.
Parameters
| Name | Type | Description |
|---|---|---|
scale | Scale | The scale to set. |
methgetCenterXabstractconst
int getCenterX() const =0Get the center X position of this map.
Returns
| Type | Description |
|---|---|
int | The center X position. |
methgetCenterZabstractconst
int getCenterZ() const =0Get the center Z position of this map.
Returns
| Type | Description |
|---|---|
int | The center Z position. |
methsetCenterXabstract
void setCenterX(int x) =0Set the center X position of this map.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | The center X position. |
methsetCenterZabstract
void setCenterZ(int z) =0Set the center Z position of this map.
Parameters
| Name | Type | Description |
|---|---|---|
z | int | The center Z position. |
methgetDimensionabstractconst
Dimension* getDimension() const =0Get the dimension that this map is associated with.
Returns
| Type | Description |
|---|---|
Dimension* | Pointer to the World this map is associated with, or nullptr. |
methsetDimensionabstract
void setDimension(const Dimension& dimension) =0Set the dimension that this map is associated with.
methgetRenderersabstractconst
std::vector<std::shared_ptr<MapRenderer>> getRenderers() const =0Get a list of MapRenderers currently in effect.
Returns
| Type | Description |
|---|---|
std::vector<std::shared_ptr<MapRenderer>> | A list of references to each MapRenderer. |
methaddRendererabstract
void addRenderer(std::shared_ptr<MapRenderer> renderer) =0Add a renderer to this map.
Parameters
| Name | Type | Description |
|---|---|---|
renderer | std::shared_ptr<MapRenderer> | The MapRenderer to add. |
methremoveRendererabstract
bool removeRenderer(const std::shared_ptr<MapRenderer>& renderer) =0Remove a renderer from this map.
Parameters
| Name | Type | Description |
|---|---|---|
renderer | const std::shared_ptr<MapRenderer>& | The MapRenderer to remove. |
Returns
| Type | Description |
|---|---|
bool | True if the renderer was successfully removed. |
methisUnlimitedTrackingabstractconst
bool isUnlimitedTracking() const =0Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range.
Returns
| Type | Description |
|---|---|
bool | True if unlimited tracking is enabled. |
methsetUnlimitedTrackingabstract
void setUnlimitedTracking(bool unlimited) =0Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range.
Parameters
| Name | Type | Description |
|---|---|---|
unlimited | bool | True to enable unlimited tracking. |
methisLockedabstractconst
bool isLocked() const =0Gets whether the map is locked or not. A locked map may not be explored further.
Returns
| Type | Description |
|---|---|
bool | True if the map is locked. |
methsetLockedabstract
void setLocked(bool locked) =0Sets whether the map is locked or not. A locked map may not be explored further.
Parameters
| Name | Type | Description |
|---|---|---|
locked | bool | True to lock the map. |