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

public interface EntitySnapshot<T extends SelectionSnapshot<?>> extends SelectionSnapshot<T>
Represents a snapshot relating to an entity. The default implementation of this interface ensures that the restoration occurs on the main server thread.
  • Method Details

    • restoreEntity

      @Nullable T restoreEntity(@Nonnull PlayerRef playerRef, @Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • updateEntityRef

      default void updateEntityRef(@Nonnull Ref<EntityStore> oldRef, @Nonnull Ref<EntityStore> newRef)
      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 reference
      newRef - 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: SelectionSnapshot
      Restore the state represented by this snapshot, optionally returning a new snapshot of the subject's current state.
      Specified by:
      restore in interface SelectionSnapshot<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.