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.Immutable
s and Value.Immutable
s.
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
Modifier and TypeInterfaceDescriptionstatic interface
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
Modifier and TypeMethodDescriptionstatic EntitySnapshot.Builder
builder()
Creates a newEntitySnapshot.Builder
to build anEntitySnapshot
.Creates a newEntityArchetype
for use withSchematic
s and placing the archetype in multiple locations.restore()
Restores theEntitySnapshot
to theServerLocation
stored within the snapshot.Gets theTransform
as anOptional
as theServerLocation
may be undefined if thisEntitySnapshot
was 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, 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 Details
-
builder
Creates a newEntitySnapshot.Builder
to build anEntitySnapshot
.- Returns:
- The new builder
-
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
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
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
-