Class VolumeApplicators
java.lang.Object
org.spongepowered.api.world.volume.stream.VolumeApplicators
A collection of default implemented
VolumeApplicator
s for various
"traditional" use cases.-
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends BiomeVolume.Modifiable<M>>
VolumeApplicator<M,Biome, Boolean> A potentially usefulVolumeApplicator
that attempts to apply aBiome
onto a targetBiomeVolume
, returningboolean
whether the biome was successfully set.static <M extends BlockEntityVolume.Modifiable<M>>
VolumeApplicator<M,BlockEntity, Boolean> A generic applicator to add aBlockEntity
to a targetvolume
.static <M extends BlockEntityVolume.Modifiable<M> & LocationCreator<@NonNull ?,
? extends ServerLocation>>
VolumeApplicator<M,BlockEntityArchetype, Optional<? extends BlockEntity>> A potentially usefulVolumeApplicator
that attempts to apply aBlockEntityArchetype
onto a targetBlockEntityVolume
, optionally returning a newly placedBlockEntity
.static <M extends BlockEntityArchetypeVolume.Modifiable<M>>
VolumeApplicator<M,BlockEntityArchetype, Boolean> A potentially usefulVolumeApplicator
that attempts to apply aBlockEntityArchetype
onto a targetBlockEntityVolume
, optionally returning a newly placedBlockEntity
.static <M extends BlockVolume.Modifiable<M>>
VolumeApplicator<M,BlockState, Boolean> static <M extends PhysicsAwareMutableBlockVolume<M>>
VolumeApplicator<M,BlockState, Boolean> applyBlocks
(BlockChangeFlag flag) Creates a "physics aware" variation of aVolumeApplicator
that appliesBlockStates
with side effects in accordance with the passed inBlockChangeFlag
.static <M extends EntityVolume.Modifiable<M>>
VolumeApplicator<M,Entity, Boolean> A potentially usefulVolumeApplicator
that attempts to apply aEntity
onto a targetEntityVolume
, returningboolean
whether the entity was successfully spawned.static <M extends EntityVolume.Modifiable<M> & LocationCreator<@NonNull ?,
? extends ServerLocation>>
VolumeApplicator<M,EntityArchetype, Optional<? extends Entity>> static <M extends EntityArchetypeVolume.Modifiable<M>>
VolumeApplicator<M,EntityArchetype, Boolean> static <M extends BlockEntityVolume.Modifiable<M>>
VolumeApplicator<M,Optional<? extends BlockEntity>, Boolean> A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockEntity
/BlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.static <M extends BlockVolume.Modifiable<M>>
VolumeApplicator<M,Optional<BlockState>, Boolean> A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.static <M extends PhysicsAwareMutableBlockVolume<M>>
VolumeApplicator<M,Optional<BlockState>, Boolean> A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.
-
Method Details
-
applyBlocks
public static <M extends BlockVolume.Modifiable<M>> VolumeApplicator<M,BlockState, applyBlocks()Boolean> A standardVolumeApplicator
that applies aBlockState
to anyBlockVolume.Modifiable
.Note that this has a different side effect compared to
applyBlocks(BlockChangeFlag)
if the targetvolume
is aPhysicsAwareMutableBlockVolume
due to the nature of applying blocks with aBlockChangeFlag
. It can be expected that applying blocks directly with this applicator will likely result in side effects playing out to their full extent per block changed.- Type Parameters:
M
- The type of modifiable block volume- Returns:
- A blockstate based VolumeApplicator
-
applyBlocks
public static <M extends PhysicsAwareMutableBlockVolume<M>> VolumeApplicator<M,BlockState, applyBlocksBoolean> (BlockChangeFlag flag) Creates a "physics aware" variation of aVolumeApplicator
that appliesBlockStates
with side effects in accordance with the passed inBlockChangeFlag
.- Type Parameters:
M
- The target volume type that accepts a BlockChangeFlag- Parameters:
flag
- The respective change flag to signal what side effects to play out on application- Returns:
- A blockstate based VolumeApplicator
-
applyBlockEntities
public static <M extends BlockEntityVolume.Modifiable<M>> VolumeApplicator<M,BlockEntity, applyBlockEntities()Boolean> A generic applicator to add aBlockEntity
to a targetvolume
. This does have the best intention of attempting to set the target's containerBlockState
prior to adding theBlockEntity
.- Type Parameters:
M
- The type of modifiable volume- Returns:
- An applicator to add block entities
-
applyOrRemoveBlockEntities
public static <M extends BlockEntityVolume.Modifiable<M>> VolumeApplicator<M,Optional<? extends BlockEntity>, applyOrRemoveBlockEntities()Boolean> A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockEntity
/BlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.- Type Parameters:
M
- The type of modifiable block entity volume- Returns:
- An applicator that conditionally adds block entities or removes blocks
-
applyOrRemoveBlockState
public static <M extends BlockVolume.Modifiable<M>> VolumeApplicator<M,Optional<BlockState>, applyOrRemoveBlockState()Boolean> A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.- Type Parameters:
M
- The type of modifiable block volume- Returns:
- An applicator that conditionally sets a block or removes a block
-
applyOrRemoveBlockState
public static <M extends PhysicsAwareMutableBlockVolume<M>> VolumeApplicator<M,Optional<BlockState>, applyOrRemoveBlockStateBoolean> (BlockChangeFlag flag) A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
. The added change being the flag- Type Parameters:
M
- The type of modifiable block volume- Returns:
- An applicator that conditionally sets a block or removes a block
-
applyBlockEntityArchetype
public static <M extends BlockEntityVolume.Modifiable<M> & LocationCreator<@NonNull ?,? extends ServerLocation>> VolumeApplicator<M,BlockEntityArchetype, applyBlockEntityArchetype()Optional<? extends BlockEntity>> A potentially usefulVolumeApplicator
that attempts to apply aBlockEntityArchetype
onto a targetBlockEntityVolume
, optionally returning a newly placedBlockEntity
.- Type Parameters:
M
- The type of block entity- Returns:
- A volume applicator that applies block entity archetypes
-
applyBlockEntityArchetypes
public static <M extends BlockEntityArchetypeVolume.Modifiable<M>> VolumeApplicator<M,BlockEntityArchetype, applyBlockEntityArchetypes()Boolean> A potentially usefulVolumeApplicator
that attempts to apply aBlockEntityArchetype
onto a targetBlockEntityVolume
, optionally returning a newly placedBlockEntity
.- Type Parameters:
M
- The type of block entity- Returns:
- A volume applicator that applies block entity archetypes
-
applyEntities
public static <M extends EntityVolume.Modifiable<M>> VolumeApplicator<M,Entity, applyEntities()Boolean> A potentially usefulVolumeApplicator
that attempts to apply aEntity
onto a targetEntityVolume
, returningboolean
whether the entity was successfully spawned.- Type Parameters:
M
- The type of entity volume- Returns:
- A volume applicator that applies entities to volumes
-
applyBiomes
A potentially usefulVolumeApplicator
that attempts to apply aBiome
onto a targetBiomeVolume
, returningboolean
whether the biome was successfully set.- Type Parameters:
M
- The type of biome volume- Returns:
- A volume applicator that applies biomes to volumes
-
applyEntityArchetype
public static <M extends EntityVolume.Modifiable<M> & LocationCreator<@NonNull ?,? extends ServerLocation>> VolumeApplicator<M,EntityArchetype, applyEntityArchetype()Optional<? extends Entity>> -
applyEntityArchetypes
public static <M extends EntityArchetypeVolume.Modifiable<M>> VolumeApplicator<M,EntityArchetype, applyEntityArchetypes()Boolean>
-