Skip to content

Map

endstone.map

Classes relating to plugin handling of map displays.

Classes:

Name Description
MapCanvas

Represents a canvas for drawing to a map. Each canvas is associated with a specific MapRenderer and represents that renderer's layer on the map.

MapCursor

Represents a cursor on a map.

MapRenderer

Represents a renderer for a map.

MapView

Represents a map item.

MapCanvas

Represents a canvas for drawing to a map. Each canvas is associated with a specific MapRenderer and represents that renderer's layer on the map.

Methods:

Name Description
draw_image

Draw an image to the map. The image will be clipped if necessary.

get_pixel

Get a pixel from the canvas.

get_pixel_color

Get a pixel from the canvas.

set_pixel

Draw a pixel to the canvas.

set_pixel_color

Draw a pixel to the canvas.

Attributes:

Name Type Description
cursors list[MapCursor]

Get the cursorS associated with this canvas.

map_view MapView

Get the map this canvas is attached to.

cursors property writable

cursors: list[MapCursor]

Get the cursorS associated with this canvas.

map_view property

map_view: MapView

Get the map this canvas is attached to.

draw_image

draw_image(x: int, y: int, image: ndarray[uint8]) -> None

Draw an image to the map. The image will be clipped if necessary.

get_pixel

get_pixel(x: int, y: int) -> int

Get a pixel from the canvas.

get_pixel_color

get_pixel_color(x: int, y: int) -> tuple[int, ...]

Get a pixel from the canvas.

set_pixel

set_pixel(x: int, y: int, color: int) -> None

Draw a pixel to the canvas.

set_pixel_color

set_pixel_color(
    x: int, y: int, color: tuple[int, ...]
) -> None

Draw a pixel to the canvas.

MapCursor

MapCursor(
    x: int,
    y: int,
    direction: int,
    type: Type,
    visible: bool,
    caption: str = "",
)

Represents a cursor on a map.

Classes:

Name Description
Type

Represents the standard types of map cursors.

Attributes:

Name Type Description
caption str

Get or set the caption on this cursor.

direction int

Get or set the direction of this cursor

is_visible bool

Get or set the visibility statis of this cursor.

type Type

Get or set the type of this cursor.

x int

Get or set the X position of this cursor.

y int

Get or set the Y position of this cursor.

caption property writable

caption: str

Get or set the caption on this cursor.

direction property writable

direction: int

Get or set the direction of this cursor

is_visible property writable

is_visible: bool

Get or set the visibility statis of this cursor.

type property writable

type: Type

Get or set the type of this cursor.

x property writable

x: int

Get or set the X position of this cursor.

y property writable

y: int

Get or set the Y position of this cursor.

Type

Bases: Enum

Represents the standard types of map cursors.

Attributes:

Name Type Description
BLUE_MARKER
CYAN_MARKER
FRAME
GREEN_POINT
JUNGLE_TEMPLE
MANSION
MONUMENT
ORANGE_MARKER
PINK_MARKER
PLAYER
PLAYER_OFF_LIMITS
PLAYER_OFF_MAP
RED_MARKER
SIGN_MARKER
SWAMP_HUT
TARGET_POINT
TARGET_X
TRIAL_CHAMBERS
VILLAGE_DESERT
VILLAGE_PLAINS
VILLAGE_SAVANNA
VILLAGE_SNOWY
VILLAGE_TAIGA
YELLOW_MARKER
BLUE_MARKER class-attribute instance-attribute
BLUE_MARKER = 3
CYAN_MARKER class-attribute instance-attribute
CYAN_MARKER = 11
FRAME class-attribute instance-attribute
FRAME = 1
GREEN_POINT class-attribute instance-attribute
GREEN_POINT = 12
JUNGLE_TEMPLE class-attribute instance-attribute
JUNGLE_TEMPLE = 22
MANSION class-attribute instance-attribute
MANSION = 14
MONUMENT class-attribute instance-attribute
MONUMENT = 15
ORANGE_MARKER class-attribute instance-attribute
ORANGE_MARKER = 9
PINK_MARKER class-attribute instance-attribute
PINK_MARKER = 8
PLAYER class-attribute instance-attribute
PLAYER = 0
PLAYER_OFF_LIMITS class-attribute instance-attribute
PLAYER_OFF_LIMITS = 13
PLAYER_OFF_MAP class-attribute instance-attribute
PLAYER_OFF_MAP = 6
RED_MARKER class-attribute instance-attribute
RED_MARKER = 2
SIGN_MARKER class-attribute instance-attribute
SIGN_MARKER = 7
SWAMP_HUT class-attribute instance-attribute
SWAMP_HUT = 23
TARGET_POINT class-attribute instance-attribute
TARGET_POINT = 5
TARGET_X class-attribute instance-attribute
TARGET_X = 4
TRIAL_CHAMBERS class-attribute instance-attribute
TRIAL_CHAMBERS = 24
VILLAGE_DESERT class-attribute instance-attribute
VILLAGE_DESERT = 17
VILLAGE_PLAINS class-attribute instance-attribute
VILLAGE_PLAINS = 18
VILLAGE_SAVANNA class-attribute instance-attribute
VILLAGE_SAVANNA = 19
VILLAGE_SNOWY class-attribute instance-attribute
VILLAGE_SNOWY = 20
VILLAGE_TAIGA class-attribute instance-attribute
VILLAGE_TAIGA = 21
YELLOW_MARKER class-attribute instance-attribute
YELLOW_MARKER = 10

MapRenderer

MapRenderer(is_contextual: bool = False)

Represents a renderer for a map.

Initialize the map renderer base with the given contextual status.

Methods:

Name Description
initialize

Initialize this MapRenderer for the given map.

render

Render to the given map.

initialize

initialize(view: MapView) -> None

Initialize this MapRenderer for the given map.

render

render(
    view: MapView, canvas: MapCanvas, player: Player
) -> None

Render to the given map.

MapView

Represents a map item.

Classes:

Name Description
Scale

An enum representing all possible scales a map can be set to.

Methods:

Name Description
add_renderer

Add a renderer to this map.

remove_renderer

Remove a renderer from this map.

Attributes:

Name Type Description
CLOSE
CLOSEST
FAR
FARTHEST
NORMAL
center_x int

Get or set the center X position of this map.

center_z int

Get or set the center Z position of this map.

dimension Dimension

Get or set the dimension that this map is associated with.

id int

Get the ID of this map item for use with MapMeta.

is_unlimited_tracking bool

Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range.

is_virtual bool

Check whether this map is virtual.

locked bool

Whether the map is locked or not. A locked map may not be explored further.

renderers list[MapRenderer]

Get a copied list of MapRenderers currently in effect.

scale Scale

Get or set the scale of this map.

CLOSE class-attribute instance-attribute

CLOSE = CLOSE

CLOSEST class-attribute instance-attribute

CLOSEST = CLOSEST

FAR class-attribute instance-attribute

FAR = FAR

FARTHEST class-attribute instance-attribute

FARTHEST = FARTHEST

NORMAL class-attribute instance-attribute

NORMAL = NORMAL

center_x property writable

center_x: int

Get or set the center X position of this map.

center_z property writable

center_z: int

Get or set the center Z position of this map.

dimension property writable

dimension: Dimension

Get or set the dimension that this map is associated with.

id property

id: int

Get the ID of this map item for use with MapMeta.

is_unlimited_tracking property writable

is_unlimited_tracking: bool

Whether the map will show a smaller position cursor (true), or no position cursor (false) when cursor is outside of map's range.

is_virtual property

is_virtual: bool

Check whether this map is virtual.

locked property writable

locked: bool

Whether the map is locked or not. A locked map may not be explored further.

renderers property

renderers: list[MapRenderer]

Get a copied list of MapRenderers currently in effect.

scale property writable

scale: Scale

Get or set the scale of this map.

Scale

Bases: IntEnum

An enum representing all possible scales a map can be set to.

Attributes:

Name Type Description
CLOSE
CLOSEST
FAR
FARTHEST
NORMAL
CLOSE class-attribute instance-attribute
CLOSE = 1
CLOSEST class-attribute instance-attribute
CLOSEST = 0
FAR class-attribute instance-attribute
FAR = 3
FARTHEST class-attribute instance-attribute
FARTHEST = 4
NORMAL class-attribute instance-attribute
NORMAL = 2

add_renderer

add_renderer(renderer: MapRenderer) -> None

Add a renderer to this map.

remove_renderer

remove_renderer(renderer: MapRenderer) -> bool

Remove a renderer from this map.