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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic MapDecoration.Builderbuilder()Creates aMapDecoration.Builderfor generatingMapDecorations.booleanGets 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.position()Gets the position on aMapInfothat this decoration will be placed.rotation()Gets theMapDecorationOrientationthe Map Decoration is pointing invoidsetPosition(Vector2i position) default voidsetRotation(Supplier<MapDecorationOrientation> rotSupplier) voidSets rotation with aMapDecorationOrientationtype()Gets theMapDecorationTypethis decoration is displayingMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
Method Details
-
builder
Creates aMapDecoration.Builderfor generatingMapDecorations.- Returns:
- A
MapDecoration.Builder
-
of
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
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 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 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
-