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 ofDataHolder.Immutable
that may be linked to a particularServerLocation
. Being that aLocatableSnapshot
may be built by anDataHolderBuilder.Immutable
, theServerLocation
may benull
such thatlocation()
returnsOptional.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<ServerLocation>
location()
Gets theServerLocation
of the snapshot at which it may have been taken from.Vector3i
position()
Gets the saved block position.T
withLocation(ServerLocation location)
Creates a copy of the snapshot with the providedServerLocation
.ResourceKey
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 Detail
-
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
java.util.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
T withLocation(ServerLocation location)
Creates a copy of the snapshot with the providedServerLocation
.- Parameters:
location
- The location- Returns:
- The new snapshot
-
-