Package org.spongepowered.api.entity
Interface EntitySnapshot
- All Superinterfaces:
CopyableDataHolder,DataHolder,DataHolder.Immutable<EntitySnapshot>,DataSerializable,LocatableSnapshot<EntitySnapshot>,SerializableDataHolder,SerializableDataHolder.Immutable<EntitySnapshot>,ValueContainer
Represents a snapshot of an
Entity and all of it's related data in
the form of DataManipulator.Immutables and Value.Immutables.
While an Entity is a live instance and resides in a
World, an EntitySnapshot may be snapshotted of a
World that is not currently loaded, or may not exist any longer.
All data associated with the EntitySnapshot should be separated
from the Game instance such that external processing, building,
and manipulation can take place.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAnDataHolderBuilder.Immutablefor buildingEntitySnapshots.Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable -
Method Summary
Modifier and TypeMethodDescriptionstatic EntitySnapshot.Builderbuilder()Creates a newEntitySnapshot.Builderto build anEntitySnapshot.Creates a newEntityArchetypefor use withSchematics and placing the archetype in multiple locations.restore()Restores theEntitySnapshotto theServerLocationstored within the snapshot.Gets theTransformas anOptionalas theServerLocationmay be undefined if thisEntitySnapshotwas built without a location.EntityType<?> type()Gets theEntityType.uniqueId()Methods inherited from interface org.spongepowered.api.data.DataHolder.Immutable
mergeWith, mergeWith, transform, transform, with, with, with, without, without, withoutMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainerMethods inherited from interface org.spongepowered.api.world.LocatableSnapshot
location, position, withLocation, worldMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawDataMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Immutable
copy, withRawData
-
Method Details
-
builder
Creates a newEntitySnapshot.Builderto build anEntitySnapshot.- Returns:
- The new builder
-
uniqueId
Gets anOptionalcontaining theUUIDof theEntitythat thisEntitySnapshotis representing. If theOptionalisOptional.empty(), then this snapshot must have been created by anEntitySnapshot.Builderwithout anEntityas a source.- Returns:
- The Optional where the UUID may be present
-
transform
Gets theTransformas anOptionalas theServerLocationmay be undefined if thisEntitySnapshotwas built without a location. This method is linked toLocatableSnapshot.location()such that if there is aServerLocation, there is usually aTransform.- Returns:
- The transform, if available
-
type
EntityType<?> type()Gets theEntityType.- Returns:
- The EntityType
-
restore
Restores theEntitySnapshotto theServerLocationstored within the snapshot. If theServerLocationis not available, the snapshot will not be restored.- Returns:
- the restored entity if successful
-
createArchetype
EntityArchetype createArchetype()Creates a newEntityArchetypefor use withSchematics and placing the archetype in multiple locations.- Returns:
- The created archetype for re-creating this entity
-