Interface MapDecoration
-
- All Superinterfaces:
DataSerializable
public interface MapDecoration extends DataSerializable
AMapDecoration
represents a symbol that may be placed at a specific point on amap
, which exists as a separate layer on top of aMapCanvas
. A common example of a Decoration is the player marker.Unlike a
MapCanvas
which is a relatively static feature of aMapInfo
, 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
to127
. The bottom left corner of the map is given by the co-ordinates (-128, -128).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MapDecoration.Builder
A builder that createsMapDecoration
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static MapDecoration.Builder
builder()
Creates aMapDecoration.Builder
for generatingMapDecoration
s.boolean
isPersistent()
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.Vector2i
position()
Gets the position on aMapInfo
that this decoration will be placed.MapDecorationOrientation
rotation()
Gets theMapDecorationOrientation
the Map Decoration is pointing invoid
setPosition(Vector2i position)
default void
setRotation(Supplier<MapDecorationOrientation> rotSupplier)
void
setRotation(MapDecorationOrientation rot)
Sets rotation with aMapDecorationOrientation
MapDecorationType
type()
Gets theMapDecorationType
this decoration is displaying-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
-
-
-
Method Detail
-
builder
static MapDecoration.Builder builder()
Creates aMapDecoration.Builder
for generatingMapDecoration
s.- Returns:
- A
MapDecoration.Builder
-
of
static 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.- 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
void setPosition(Vector2i position)
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 -128-127. AKA any valid byte value- Parameters:
position
- Vector2i world x and y cords
-
setRotation
void setRotation(MapDecorationOrientation rot)
Sets rotation with aMapDecorationOrientation
- Parameters:
rot
- MapDecorationOrientation
-
setRotation
default void setRotation(Supplier<MapDecorationOrientation> rotSupplier)
-
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
-
-