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.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 TypeMethodDescriptionlocation()
Gets theServerLocation
of 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 thekey
of the world.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.data.SerializableDataHolder
validateRawData
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Immutable
copy, withRawData
-
Method Details
-
world
ResourceKey world()Gets thekey
of the world.- Returns:
- The key
-
position
Vector3i position()Gets the saved block position.- Returns:
- The saved block position
-
location
Optional<ServerLocation> location()Gets theServerLocation
of the snapshot at which it may have been taken from. TheServerLocation
being immutable signifies that theLocatableSnapshot
can 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
-