Interface LocationBaseDataHolder.Mutable
- All Superinterfaces:
LocationBaseDataHolder
- All Known Subinterfaces:
Chunk<P>
,ClientWorld
,GenerationChunk
,GenerationRegion
,Schematic
,ServerWorld
,TrackedVolume
,World<W,
,L> WorldChunk
,WorldLike<P>
- Enclosing interface:
- LocationBaseDataHolder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
LocationBaseDataHolder.Mutable
-
Method Summary
Modifier and TypeMethodDescriptiondefault DataTransactionResult
copyFrom
(int xTo, int yTo, int zTo, int xFrom, int yFrom, int zFrom) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.copyFrom
(int xTo, int yTo, int zTo, int xFrom, int yFrom, int zFrom, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.copyFrom
(int xTo, int yTo, int zTo, ValueContainer from) Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.copyFrom
(int xTo, int yTo, int zTo, ValueContainer from, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.default DataTransactionResult
copyFrom
(Vector3i to, ValueContainer from) Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.default DataTransactionResult
copyFrom
(Vector3i to, ValueContainer from, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.default DataTransactionResult
Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.default DataTransactionResult
copyFrom
(Vector3i positionTo, Vector3i positionFrom, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.default <E> DataTransactionResult
Offers the givenValue
to the block at the given position.default <E> DataTransactionResult
offer
(int x, int y, int z, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, E value) Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.default <E> DataTransactionResult
Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.default <E> DataTransactionResult
Offers the givenValue
to the block at the given position.default <E> DataTransactionResult
offer
(Vector3i position, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, E value) Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.Attempts to remove the data associated with the providedKey
from the block at the provided location.default DataTransactionResult
remove
(int x, int y, int z, DefaultedRegistryReference<? extends Key<?>> key) Attempts to remove the data associated with the providedKey
from the block at the provided location.default DataTransactionResult
Attempts to remove the data associated with the providedKey
from the block at the provided location.default DataTransactionResult
remove
(Vector3i position, DefaultedRegistryReference<? extends Key<?>> key) Attempts to remove the data associated with the providedKey
from the block at the provided location.void
setRawData
(int x, int y, int z, DataView container) Attempts to set all data of the block at the given position according to theDataContainer
's held information.default void
setRawData
(Vector3i position, DataView container) Attempts to set all data of the block at the given position according to theDataContainer
's held information.default <E> DataTransactionResult
Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.default <E> DataTransactionResult
transform
(int x, int y, int z, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.default <E> DataTransactionResult
Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.default <E> DataTransactionResult
transform
(Vector3i position, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.undo
(int x, int y, int z, DataTransactionResult result) Attempts to undo aDataTransactionResult
.default DataTransactionResult
undo
(Vector3i position, DataTransactionResult result) Attempts to undo aDataTransactionResult
.boolean
validateRawData
(int x, int y, int z, DataView container) Validates the container with known data required to set the raw data to the block at the given position.default boolean
validateRawData
(Vector3i position, DataView container) Validates the container with known data required to set the raw data to the block at the given position.Methods inherited from interface org.spongepowered.api.world.volume.game.LocationBaseDataHolder
get, get, get, get, getDouble, getDouble, getDouble, getDouble, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getValue, getValue, getValue, getValue, getValues, getValues, keys, keys, orElse, orElse, orElse, orElse, orElse, orElse, orElse, orElse, orNull, orNull, orNull, orNull, require, require, require, require, supports, supports, supports, supports, supports, supports
-
Method Details
-
transform
default <E> DataTransactionResult transform(Vector3i position, Key<? extends Value<E>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.- Type Parameters:
E
- The type of data- Parameters:
position
- The position of the blockkey
- The key to the datafunction
- The function applying the transformation- Returns:
- The transaction result
-
transform
default <E> DataTransactionResult transform(Vector3i position, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.- Type Parameters:
E
- The type of data- Parameters:
position
- The position of the blockkey
- The key to the datafunction
- The function applying the transformation- Returns:
- The transaction result
-
transform
default <E> DataTransactionResult transform(int x, int y, int z, Key<? extends Value<E>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.- Type Parameters:
E
- The type of data- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key to the datafunction
- The function applying the transformation- Returns:
- The transaction result
-
transform
default <E> DataTransactionResult transform(int x, int y, int z, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, Function<E, E> function) Applies a transformation on the pre-existing value of the data keyed by the providedKey
and returns aDataTransactionResult
of said transformation.- Type Parameters:
E
- The type of data- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key to the datafunction
- The function applying the transformation- Returns:
- The transaction result
-
offer
Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of data being offered- Parameters:
position
- The position of the blockkey
- The key for the datavalue
- The value to offer- Returns:
- The transaction result
-
offer
default <E> DataTransactionResult offer(Vector3i position, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, E value) Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of data being offered- Parameters:
position
- The position of the blockkey
- The key for the datavalue
- The value to offer- Returns:
- The transaction result
-
offer
Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of data being offered- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key for the datavalue
- The value to offer- Returns:
- The transaction result
-
offer
default <E> DataTransactionResult offer(int x, int y, int z, DefaultedRegistryReference<? extends Key<? extends Value<E>>> key, E value) Offers the givenE
value that is keyed by the providedKey
to the block at the provided location.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of data being offered- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key for the datavalue
- The value to offer- Returns:
- The transaction result
-
offer
Offers the givenValue
to the block at the given position.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of the element wrapped by the value- Parameters:
position
- The position of the blockvalue
- The value to offer- Returns:
- The transaction result
-
offer
Offers the givenValue
to the block at the given position.If any data is rejected or existing data is replaced, the
DataTransactionResult
will retain the rejected and replaced data.- Type Parameters:
E
- The type of the element wrapped by the value- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionvalue
- The value to offer- Returns:
- The transaction result
-
remove
Attempts to remove the data associated with the providedKey
from the block at the provided location.- Parameters:
position
- The position of the blockkey
- The key to the data to remove- Returns:
- The transaction result
-
remove
default DataTransactionResult remove(Vector3i position, DefaultedRegistryReference<? extends Key<?>> key) Attempts to remove the data associated with the providedKey
from the block at the provided location.- Parameters:
position
- The position of the blockkey
- The key to the data to remove- Returns:
- The transaction result
-
remove
Attempts to remove the data associated with the providedKey
from the block at the provided location.- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key of the data to remove- Returns:
- The transaction result
-
remove
default DataTransactionResult remove(int x, int y, int z, DefaultedRegistryReference<? extends Key<?>> key) Attempts to remove the data associated with the providedKey
from the block at the provided location.- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionkey
- The key of the data to remove- Returns:
- The transaction result
-
undo
Attempts to undo aDataTransactionResult
. Specifically, allValue.Immutable
s that were successfully added are removed, and all replacedValue.Immutable
s are offered.- Parameters:
position
- The position of the blockresult
- The transaction result to undo- Returns:
- The transaction result
-
undo
Attempts to undo aDataTransactionResult
. Specifically, allValue.Immutable
s that were successfully added are removed, and all replacedValue.Immutable
s are offered.- Parameters:
x
- The X positiony
- The Y positionz
- The Z positionresult
- The transaction result to undo- Returns:
- The transaction result
-
copyFrom
Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.- Parameters:
to
- The position of the blockfrom
- The data holder to copy data from- Returns:
- The transaction result
-
copyFrom
Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.- Parameters:
xTo
- The X posyTo
- The Y poszTo
- The Z posfrom
- The data holder to copy data from- Returns:
- The transaction result
-
copyFrom
Attempts to copy all the relevant data from the providedDataHolder
to the block at the provided position.- Parameters:
positionTo
- The position of the blockpositionFrom
- The position of the block to copy data from- Returns:
- The transaction result
-
copyFrom
Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position.- Parameters:
xTo
- The X position of the block to copy data toyTo
- The Y position of the block to copy data tozTo
- The Z position of the block to copy data toxFrom
- The X position of the block to copy data fromyFrom
- The Y position of the block to copy data fromzFrom
- The Z position of the block to copy data from- Returns:
- The transaction result
-
copyFrom
Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position. Any conflicting data is handled through the providedMergeFunction
.- Parameters:
to
- The block position to copy tofrom
- the data holder to copy data fromfunction
- The merge function to resolve conflicts- Returns:
- The transaction result
-
copyFrom
DataTransactionResult copyFrom(int xTo, int yTo, int zTo, ValueContainer from, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position. Any conflicting data is handled through the providedMergeFunction
.- Parameters:
xTo
- The X pos of the block to copy data toyTo
- The Y pos of the block to copy data tozTo
- The Z pos of the block to copy data tofrom
- The data holder to copy data fromfunction
- The merge function to resolve conflicts- Returns:
- The transaction result
-
copyFrom
default DataTransactionResult copyFrom(Vector3i positionTo, Vector3i positionFrom, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position. Any conflicting data is handled through the providedMergeFunction
.- Parameters:
positionTo
- The position of the block copying data topositionFrom
- The position of the block to copy data fromfunction
- The merge function to resolve conflicts- Returns:
- The transaction result
-
copyFrom
DataTransactionResult copyFrom(int xTo, int yTo, int zTo, int xFrom, int yFrom, int zFrom, MergeFunction function) Attempts to copy allValue.Immutable
s from the provided block to provided block to the provided block position. Any conflicting data is handled through the providedMergeFunction
.- Parameters:
xTo
- The X positionyTo
- The Y positionzTo
- The Z positionxFrom
- The X positionyFrom
- The Y positionzFrom
- The Z positionfunction
- The merge resolving function- Returns:
- The transaction result
-
validateRawData
Validates the container with known data required to set the raw data to the block at the given position. If the container is incomplete or contains invalid data,false
is returned.This validation should be checked prior to calling
setRawData(Vector3i, DataView)
to avoid exceptions.- Parameters:
position
- The position of the blockcontainer
- The raw data to validate- Returns:
- True if the data is valid
-
validateRawData
Validates the container with known data required to set the raw data to the block at the given position. If the container is incomplete or contains invalid data,false
is returned.This validation should be checked prior to calling
setRawData(Vector3i, DataView)
to avoid exceptions.- Parameters:
x
- The X positiony
- The Y positionz
- The Z positioncontainer
- The raw data to validate- Returns:
- True if the data is valid
-
setRawData
Attempts to set all data of the block at the given position according to theDataContainer
's held information. Using this to modify knownDataManipulator
s is unsupported and if the data is invalid, anInvalidDataException
is thrown.This setter is used to provide setting custom data that is not represented by the Data API, including forge mods and other unknown data. Attempts at validating known
DataManipulator
s contained in the data container are made with the assumption that all necessary data exists.- Parameters:
position
- The position of the blockcontainer
- A container containing all raw data to set on the block at the given position- Throws:
InvalidDataException
- If the container is missing or has invalid data that this holder will refuse
-
setRawData
Attempts to set all data of the block at the given position according to theDataContainer
's held information. Using this to modify knownDataManipulator
s is unsupported and if the data is invalid, anInvalidDataException
is thrown.This setter is used to provide setting custom data that is not represented by the Data API, including forge mods and other unknown data. Attempts at validating known
DataManipulator
s contained in the data container are made with the assumption that all necessary data exists.- Parameters:
x
- The X positiony
- The Y positionz
- The Z positioncontainer
- A container containing all raw data to set on the block at the given position- Throws:
InvalidDataException
- If the container is missing or has invalid data that this holder will refuse
-