Package org.spongepowered.api.entity
Interface EntitySnapshot
-
- All Superinterfaces:
CopyableDataHolder,DataHolder,DataHolder.Immutable<EntitySnapshot>,DataSerializable,LocatableSnapshot<EntitySnapshot>,SerializableDataHolder,SerializableDataHolder.Immutable<EntitySnapshot>,ValueContainer
public interface EntitySnapshot extends LocatableSnapshot<EntitySnapshot>
Represents a snapshot of anEntityand all of it's related data in the form ofDataManipulator.Immutables andValue.Immutables. While anEntityis a live instance and resides in aWorld, anEntitySnapshotmay be snapshotted of aWorldthat is not currently loaded, or may not exist any longer.All data associated with the
EntitySnapshotshould be separated from theGameinstance such that external processing, building, and manipulation can take place.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceEntitySnapshot.BuilderAnDataHolderBuilder.Immutablefor buildingEntitySnapshots.-
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 Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static EntitySnapshot.Builderbuilder()Creates a newEntitySnapshot.Builderto build anEntitySnapshot.EntityArchetypecreateArchetype()Creates a newEntityArchetypefor use withSchematics and placing the archetype in multiple locations.Optional<Entity>restore()Restores theEntitySnapshotto theServerLocationstored within the snapshot.Optional<Transform>transform()Gets theTransformas anOptionalas theServerLocationmay be undefined if thisEntitySnapshotwas built without a location.EntityType<?>type()Gets theEntityType.Optional<UUID>uniqueId()-
Methods inherited from interface org.spongepowered.api.data.DataHolder.Immutable
mergeWith, mergeWith, transform, transform, with, with, with, without, without, without
-
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
-
Methods inherited from interface org.spongepowered.api.world.LocatableSnapshot
location, position, withLocation, world
-
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
-
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Immutable
copy, withRawData
-
-
-
-
Method Detail
-
builder
static EntitySnapshot.Builder builder()
Creates a newEntitySnapshot.Builderto build anEntitySnapshot.- Returns:
- The new builder
-
uniqueId
Optional<UUID> 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
Optional<Transform> 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
Optional<Entity> 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
-
-