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 anEntity
and all of it's related data in the form ofDataManipulator.Immutable
s andValue.Immutable
s. While anEntity
is a live instance and resides in aWorld
, anEntitySnapshot
may be snapshotted of aWorld
that is not currently loaded, or may not exist any longer.All data associated with the
EntitySnapshot
should be separated from theGame
instance such that external processing, building, and manipulation can take place.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
EntitySnapshot.Builder
AnDataHolderBuilder.Immutable
for buildingEntitySnapshot
s.-
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.Builder
builder()
Creates a newEntitySnapshot.Builder
to build anEntitySnapshot
.EntityArchetype
createArchetype()
Creates a newEntityArchetype
for use withSchematic
s and placing the archetype in multiple locations.Optional<Entity>
restore()
Restores theEntitySnapshot
to theServerLocation
stored within the snapshot.Optional<Transform>
transform()
Gets theTransform
as anOptional
as theServerLocation
may be undefined if thisEntitySnapshot
was 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.Builder
to build anEntitySnapshot
.- Returns:
- The new builder
-
uniqueId
Optional<UUID> uniqueId()
Gets anOptional
containing theUUID
of theEntity
that thisEntitySnapshot
is representing. If theOptional
isOptional.empty()
, then this snapshot must have been created by anEntitySnapshot.Builder
without anEntity
as a source.- Returns:
- The Optional where the UUID may be present
-
transform
Optional<Transform> transform()
Gets theTransform
as anOptional
as theServerLocation
may be undefined if thisEntitySnapshot
was 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 theEntitySnapshot
to theServerLocation
stored within the snapshot. If theServerLocation
is not available, the snapshot will not be restored.- Returns:
- the restored entity if successful
-
createArchetype
EntityArchetype createArchetype()
Creates a newEntityArchetype
for use withSchematic
s and placing the archetype in multiple locations.- Returns:
- The created archetype for re-creating this entity
-
-