Package org.spongepowered.api.world
Interface Archetype<S extends LocatableSnapshot<S>,E>
-
- All Superinterfaces:
CopyableDataHolder
,DataHolder
,DataHolder.Mutable
,DataSerializable
,SerializableDataHolder
,SerializableDataHolder.Mutable
,ValueContainer
- All Known Subinterfaces:
BlockEntityArchetype
,EntityArchetype
public interface Archetype<S extends LocatableSnapshot<S>,E> extends SerializableDataHolder.Mutable
ADataHolder
which has no attachment to any particular world allowing it to be used as a blueprint to create multiple copies of its containing data.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<E>
apply(ServerLocation location)
Creates a new instance based on this archetype at the given location.Archetype<S,E>
copy()
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance.S
toSnapshot(ServerLocation location)
Creates a new immutable snapshot based on this archetype.-
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, toContainer
-
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
-
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Mutable
setRawData
-
-
-
-
Method Detail
-
apply
Optional<E> apply(ServerLocation location)
Creates a new instance based on this archetype at the given location.- Parameters:
location
- The location to create the new instance at- Returns:
- The created type, if successful
-
toSnapshot
S toSnapshot(ServerLocation location)
Creates a new immutable snapshot based on this archetype.- Parameters:
location
- The location for the snapshot to be specified as at- Returns:
- The snapshot
-
copy
Archetype<S,E> copy()
Description copied from interface:CopyableDataHolder
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance. It is not guaranteed that the returning container is of the same type as this container.- Specified by:
copy
in interfaceCopyableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder.Mutable
- Returns:
- The new copy
-
-