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 DataHolder
DataHolder.Immutable<I>, DataHolder.MutableNested classes/interfaces inherited from interface SerializableDataHolder
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 DataHolder.Immutable
mergeWith, mergeWith, transform, transform, with, with, with, without, without, withoutMethods inherited from interface DataSerializable
contentVersion, toContainer, toViewMethods inherited from interface LocatableSnapshot
location, position, withLocation, worldMethods inherited from interface SerializableDataHolder
validateRawDataMethods inherited from interface SerializableDataHolder.Immutable
copy, withRawDataMethods inherited from interface ValueContainer
get, getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, streamKeys, streamValues, supports, supports
-
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
-
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
-