Interface MapDecoration
-
- All Superinterfaces:
DataSerializable
public interface MapDecoration extends DataSerializable
AMapDecorationrepresents 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
MapCanvaswhich 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
-128to127. 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 interfaceMapDecoration.BuilderA builder that createsMapDecoration
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static MapDecoration.Builderbuilder()Creates aMapDecoration.Builderfor generatingMapDecorations.booleanisPersistent()Gets whether thisMapDecorationis persistentstatic MapDecorationof(MapDecorationType type, int x, int y, MapDecorationOrientation rotation)Creates a newMapDecorationgiven aMapDecorationType, position andDirectionwhich represents the rotation of the decoration on the map.Vector2iposition()Gets the position on aMapInfothat this decoration will be placed.MapDecorationOrientationrotation()Gets theMapDecorationOrientationthe Map Decoration is pointing invoidsetPosition(Vector2i position)default voidsetRotation(Supplier<MapDecorationOrientation> rotSupplier)voidsetRotation(MapDecorationOrientation rot)Sets rotation with aMapDecorationOrientationMapDecorationTypetype()Gets theMapDecorationTypethis decoration is displaying-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
-
-
-
Method Detail
-
builder
static MapDecoration.Builder builder()
Creates aMapDecoration.Builderfor generatingMapDecorations.- Returns:
- A
MapDecoration.Builder
-
of
static MapDecoration of(MapDecorationType type, int x, int y, MapDecorationOrientation rotation)
Creates a newMapDecorationgiven aMapDecorationType, position andDirectionwhich represents the rotation of the decoration on the map.- Parameters:
type- TheMapDecorationTypesymbolx- The x co-ordinate of this decorationy- The y co-ordinate of this decorationrotation- TheMapDecorationOrientationthat represents the rotation of the decoration- Returns:
- The
MapDecoration
-
type
MapDecorationType type()
Gets theMapDecorationTypethis decoration is displaying- Returns:
- The
MapDecorationType
-
position
Vector2i position()
Gets the position on aMapInfothat 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 aMapInfo0,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 theMapDecorationOrientationthe Map Decoration is pointing in- Returns:
- MapDecorationOrientation
-
isPersistent
boolean isPersistent()
Gets whether thisMapDecorationis persistentA
MapDecorationbeing 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_PLAYERSis 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
MapDecorationis persistent
-
-