Contents
Interface EntitySnapshot<T extends SelectionSnapshot<?>>
- Type Parameters:
T- The type of snapshot to be returned when restoring this one.
- All Superinterfaces:
SelectionSnapshot<T>
- All Known Implementing Classes:
EntityAddSnapshot, EntityFreezeSnapshot, EntityRemoveSnapshot, EntityScaleSnapshot, EntitySettingsSnapshot, EntityTransformSnapshot
Represents a snapshot relating to an entity.
The default implementation of this interface ensures that the restoration occurs on the main server thread.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Trestore(Ref<EntityStore> ref, PlayerRef playerRef, World world, ComponentAccessor<EntityStore> componentAccessor) Restore the state represented by this snapshot, optionally returning a new snapshot of the subject's current state.restoreEntity(PlayerRef playerRef, World world, ComponentAccessor<EntityStore> componentAccessor) default voidupdateEntityRef(Ref<EntityStore> oldRef, Ref<EntityStore> newRef) Updates the entity reference held by this snapshot.Methods inherited from interface SelectionSnapshot
estimatedBlockWeight
-
Method Details
-
restoreEntity
@Nullable T restoreEntity(@Nonnull PlayerRef playerRef, @Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
updateEntityRef
Updates the entity reference held by this snapshot. Called when an entity is re-created after an undo of a remove operation, so that earlier snapshots in the history can track the new ref instead of the now-invalid old one.- Parameters:
oldRef- the previous (now invalid) entity referencenewRef- the new entity reference after re-creation
-
restore
default T restore(Ref<EntityStore> ref, PlayerRef playerRef, @Nonnull World world, ComponentAccessor<EntityStore> componentAccessor) Description copied from interface:SelectionSnapshotRestore the state represented by this snapshot, optionally returning a new snapshot of the subject's current state.- Specified by:
restorein interfaceSelectionSnapshot<T extends SelectionSnapshot<?>>- Parameters:
ref-playerRef- The Player reference invoking the buildertool operation.world- The World in which the operation is taking place.componentAccessor-- Returns:
- A new snapshot of the subject prior to restoring its state or null.
-