Class VolumeApplicators
- java.lang.Object
-
- org.spongepowered.api.world.volume.stream.VolumeApplicators
-
public final class VolumeApplicators extends java.lang.Object
A collection of default implementedVolumeApplicator
s for various "traditional" use cases.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <M extends BiomeVolume.Modifiable<M>>
VolumeApplicator<M,Biome,java.lang.Boolean>applyBiomes()
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,java.lang.Boolean>applyBlockEntities()
A generic applicator to add aBlockEntity
to a targetvolume
.static <M extends BlockEntityVolume.Modifiable<M> & LocationCreator<?,? extends ServerLocation>>
VolumeApplicator<M,BlockEntityArchetype,java.util.Optional<? extends BlockEntity>>applyBlockEntityArchetype()
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,java.lang.Boolean>applyBlockEntityArchetypes()
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,java.lang.Boolean>applyBlocks()
static <M extends PhysicsAwareMutableBlockVolume<M>>
VolumeApplicator<M,BlockState,java.lang.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,java.lang.Boolean>applyEntities()
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<?,? extends ServerLocation>>
VolumeApplicator<M,EntityArchetype,java.util.Optional<? extends Entity>>applyEntityArchetype()
static <M extends EntityArchetypeVolume.Modifiable<M>>
VolumeApplicator<M,EntityArchetype,java.lang.Boolean>applyEntityArchetypes()
static <M extends BlockEntityVolume.Modifiable<M>>
VolumeApplicator<M,java.util.Optional<? extends BlockEntity>,java.lang.Boolean>applyOrRemoveBlockEntities()
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,java.util.Optional<BlockState>,java.lang.Boolean>applyOrRemoveBlockState()
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,java.util.Optional<BlockState>,java.lang.Boolean>applyOrRemoveBlockState(BlockChangeFlag flag)
A potentially usefulVolumeApplicator
that conditionally adds or removes aBlockState
based on the element'sOptional
state of beingOptional.empty()
orOptional.isPresent()
.
-
-
-
Method Detail
-
applyBlocks
public static <M extends BlockVolume.Modifiable<M>> VolumeApplicator<M,BlockState,java.lang.Boolean> applyBlocks()
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,java.lang.Boolean> applyBlocks(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,java.lang.Boolean> applyBlockEntities()
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,java.util.Optional<? extends BlockEntity>,java.lang.Boolean> applyOrRemoveBlockEntities()
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,java.util.Optional<BlockState>,java.lang.Boolean> applyOrRemoveBlockState()
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,java.util.Optional<BlockState>,java.lang.Boolean> applyOrRemoveBlockState(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<?,? extends ServerLocation>> VolumeApplicator<M,BlockEntityArchetype,java.util.Optional<? extends BlockEntity>> applyBlockEntityArchetype()
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,java.lang.Boolean> applyBlockEntityArchetypes()
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,java.lang.Boolean> applyEntities()
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
public static <M extends BiomeVolume.Modifiable<M>> VolumeApplicator<M,Biome,java.lang.Boolean> 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<?,? extends ServerLocation>> VolumeApplicator<M,EntityArchetype,java.util.Optional<? extends Entity>> applyEntityArchetype()
-
applyEntityArchetypes
public static <M extends EntityArchetypeVolume.Modifiable<M>> VolumeApplicator<M,EntityArchetype,java.lang.Boolean> applyEntityArchetypes()
-
-