Package org.spongepowered.api.world
Interface LocatableSnapshot<T extends LocatableSnapshot<T>>
- Type Parameters:
T- The type of location snapshot for self referencing
- All Superinterfaces:
CopyableDataHolder,DataHolder,DataHolder.Immutable<T>,DataSerializable,SerializableDataHolder,SerializableDataHolder.Immutable<T>,ValueContainer
- All Known Subinterfaces:
BlockSnapshot,EntitySnapshot
public interface LocatableSnapshot<T extends LocatableSnapshot<T>>
extends SerializableDataHolder.Immutable<T>
A type of
DataHolder.Immutable that may be linked to a particular
ServerLocation. Being that a LocatableSnapshot may be built
by an DataHolderBuilder.Immutable, the ServerLocation may be
null such that location() returns
Optional.empty().-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable -
Method Summary
Modifier and TypeMethodDescriptionlocation()Gets theServerLocationof the snapshot at which it may have been taken from.position()Gets the saved block position.withLocation(ServerLocation location) Creates a copy of the snapshot with the providedServerLocation.world()Gets thekeyof the world.Methods inherited from interface org.spongepowered.api.data.DataHolder.Immutable
mergeWith, mergeWith, transform, transform, with, with, with, without, without, withoutMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainerMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawDataMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Immutable
copy, withRawData
-
Method Details
-
world
ResourceKey world()Gets thekeyof the world.- Returns:
- The key
-
position
Vector3i position()Gets the saved block position.- Returns:
- The saved block position
-
location
Optional<ServerLocation> location()Gets theServerLocationof the snapshot at which it may have been taken from. TheServerLocationbeing immutable signifies that theLocatableSnapshotcan be re-created at the desiredServerLocation.- Returns:
- The location of where the snapshot was taken, if available
-
withLocation
Creates a copy of the snapshot with the providedServerLocation.- Parameters:
location- The location- Returns:
- The new snapshot
-