Package org.spongepowered.api.map
Interface MapInfo
-
- All Superinterfaces:
DataHolder
,DataHolder.Mutable
,DataSerializable
,Identifiable
,ValueContainer
public interface MapInfo extends DataHolder.Mutable, Identifiable, DataSerializable
Represents data that may be viewed on amap
. A MapInfo may be attached to multiple maps.- See Also:
Keys.MAP_INFO
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addBannerDecoration(ServerLocation bannerLocation)
Adds the banner at the given location to this map.boolean
isLinked(ItemStack itemStack)
Gets whether the suppliedItemStack
is backed by this MapInfo, such that modifications to this MapInfo would affect the supplied stack.DataContainer
toContainer()
Serializes this object into a comprehensibleDataContainer
.-
Methods inherited from interface org.spongepowered.api.data.DataHolder.Mutable
copyFrom, copyFrom, offer, offer, offer, offer, offerAll, offerAll, offerAll, offerAll, offerAll, offerAll, offerSingle, offerSingle, offerSingle, offerSingle, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeKey, removeKey, removeSingle, removeSingle, transform, transform, tryOffer, tryOffer, tryOffer, undo
-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion
-
Methods inherited from interface org.spongepowered.api.util.Identifiable
uniqueId
-
-
-
-
Method Detail
-
isLinked
boolean isLinked(ItemStack itemStack)
Gets whether the suppliedItemStack
is backed by this MapInfo, such that modifications to this MapInfo would affect the supplied stack.This will always return
false
if the suppliedItemStack
is not of typeItemTypes.FILLED_MAP
.
-
addBannerDecoration
void addBannerDecoration(ServerLocation bannerLocation) throws IllegalArgumentException
Adds the banner at the given location to this map. This is equivalent to right clicking a banner in the world with the corresponding map.- Parameters:
bannerLocation
- Location of the banner to add.- Throws:
IllegalArgumentException
- if the given location is not a bannerIllegalArgumentException
- if the given banner
-
toContainer
DataContainer toContainer()
Serializes this object into a comprehensibleDataContainer
.This has special behaviour for serializing
MapDecorations
A
MapDecoration
on this MapCanvas is only serialized ifMapDecoration.isPersistent()
returns true. This is because non-persistent MapDecorations belong more to the area than the map itself. If you wish to serialize them anyway, obtain theMapDecorations
usingKeys.MAP_DECORATIONS
and serialize each individually.- Specified by:
toContainer
in interfaceDataSerializable
- Returns:
- A newly created DataContainer
-
-