Interface MapDecoration
- All Superinterfaces:
DataSerializable
MapDecoration
represents a symbol that may be placed at a specific
point on a map
, which exists as a separate layer on top of a
MapCanvas
. A common example of a Decoration is the player marker.
Unlike a MapCanvas
which is a relatively static feature of a
MapInfo
, the position and rotation of decorations can be updated
more easily.
The co-ordinate system used when getting or setting a decoration's
location on a map is independent of any world a map may be based on.
Instead, valid co-ordinates range from -128
to
127
. The bottom left corner of the map is given by the
co-ordinates (-128, -128).
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MapDecoration.Builder
builder()
Creates aMapDecoration.Builder
for generatingMapDecoration
s.boolean
Gets whether thisMapDecoration
is persistentstatic MapDecoration
of
(MapDecorationType type, int x, int y, MapDecorationOrientation rotation) Creates a newMapDecoration
given aMapDecorationType
, position andDirection
which represents the rotation of the decoration on the map.position()
Gets the position on aMapInfo
that this decoration will be placed.rotation()
Gets theMapDecorationOrientation
the Map Decoration is pointing invoid
setPosition
(Vector2i position) default void
setRotation
(Supplier<MapDecorationOrientation> rotSupplier) void
Sets rotation with aMapDecorationOrientation
type()
Gets theMapDecorationType
this decoration is displayingMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
Method Details
-
builder
Creates aMapDecoration.Builder
for generatingMapDecoration
s.- Returns:
- A
MapDecoration.Builder
-
of
Creates a newMapDecoration
given aMapDecorationType
, position andDirection
which represents the rotation of the decoration on the map.- Parameters:
type
- TheMapDecorationType
symbolx
- The x co-ordinate of this decorationy
- The y co-ordinate of this decorationrotation
- TheMapDecorationOrientation
that represents the rotation of the decoration- Returns:
- The
MapDecoration
-
type
MapDecorationType type()Gets theMapDecorationType
this decoration is displaying- Returns:
- The
MapDecorationType
-
position
Vector2i position()Gets the position on aMapInfo
that this decoration will be placed.- Returns:
- Vector2i Co-ordinate position in world
-
setPosition
Sets the position of where the MapDecoration is on Maps, or where it would be if applied to aMapInfo
0,0 is the center of the map Ranges from 0x80-0x7f. AKA any valid byte value- Parameters:
position
- Vector2i world x and y cords
-
setRotation
Sets rotation with aMapDecorationOrientation
- Parameters:
rot
- MapDecorationOrientation
-
setRotation
-
rotation
MapDecorationOrientation rotation()Gets theMapDecorationOrientation
the Map Decoration is pointing in- Returns:
- MapDecorationOrientation
-
isPersistent
boolean isPersistent()Gets whether thisMapDecoration
is persistentA
MapDecoration
being persistent means it cannot be changed apart from by a plugin.Examples of persistent MapDecorations:
- - Plugin added MapDecorations
- - Structures located on the map, i.e Guardian Temple
Examples of non-persistent MapDecorations:
- - MapDecorations marking a
Player
's current location, (ifKeys.MAP_TRACKS_PLAYERS
is true and if they are in range). - - MapDecorations marking a
ItemFrame
's position.
This affects whether this will be serialized in
DataSerializable.toContainer()
. Go there if you want more detailsThis does not affect
DataSerializable.toContainer()
, which will serialize fine.- Returns:
- true if this
MapDecoration
is persistent
-