Class BlockLayer
java.lang.Object
net.rodofire.easierworldcreator.blockdata.layer.BlockLayer
Represents a layer in a structure.
Each layer consists of a list of
BlockState objects and an integer.
The list contains all the BlockState objects present in the layer,
while the integer represents the depth of the layer.
Be cautious with the depth parameter: The depth should never be less than 0. There is no benefit to having a depth equal to 0.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockLayer(List<net.minecraft.block.BlockState> states) init the BlockLayerBlockLayer(List<net.minecraft.block.BlockState> states, boolean force) init the BlockLayerBlockLayer(List<net.minecraft.block.BlockState> states, int depth) init the BlockLayerBlockLayer(List<net.minecraft.block.BlockState> states, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayerBlockLayer(List<net.minecraft.block.BlockState> states, List<Short> chances) init the BlockLayerBlockLayer(List<net.minecraft.block.BlockState> states, List<Short> chances, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayerBlockLayer(net.minecraft.block.BlockState state) init the BlockLayerBlockLayer(net.minecraft.block.BlockState state, boolean force) init the BlockLayerBlockLayer(net.minecraft.block.BlockState state, int depth) init the BlockLayerBlockLayer(net.minecraft.block.BlockState state, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayer -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockState(net.minecraft.block.BlockState state) add a BlockState to the layervoidaddBlockState(net.minecraft.block.BlockState state, short chance) add a BlockState to the layervoidaddBlockStates(List<net.minecraft.block.BlockState> states) add multiple BlockStates to the layervoidaddBlockStates(List<net.minecraft.block.BlockState> states, List<Short> chances) add multiple BlockStates to the layervoidaddBlocksToForce(Set<net.minecraft.block.Block> blocksToForce) add a set of blocks to the setvoidaddBlocksToForce(net.minecraft.block.Block block) add a block to the setvoidaddDepth(int depth) add a depth to theBlockLayerget()method to get the blockState as well as his chanceList<net.minecraft.block.BlockState> Method used to get all theBlockStatein aBlockLayer.Set<net.minecraft.block.Block> gives you the Set of every block that can be forcedintgetDepth()method used to get all the depth in aBlockLayerbooleanisForce()get if any block can be replaced by any BlockState of this blockListvoidremoveBlockState(int index) method used to remove aBlockStaterelated to the indexvoidremoveBlockState(List<net.minecraft.block.BlockState> state) removes some BlockStates of the LayervoidremoveBlockState(net.minecraft.block.BlockState state) removes a BlockState of the LayervoidremoveBlocksToForce(Set<net.minecraft.block.Block> blocksToForce) remove a set of blocks to the setvoidremoveBlocksToForce(net.minecraft.block.Block block) remove a block to the setvoidsetBlockStates(List<net.minecraft.block.BlockState> blocks) method used to set all theBlockStatein aBlockLayervoidsetBlocksToForce(Set<net.minecraft.block.Block> blocksToForce) sets all the blocks that can be forced in the case force == falsevoidsetDepth(int depth) set a depth to theBlockLayervoidsetForce(boolean force) sets if any block can be replaced by any BlockState of this blockListintsize()method used to get the size of theBlockLayertoString()
-
Constructor Details
-
BlockLayer
public BlockLayer(List<net.minecraft.block.BlockState> states, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayer- Parameters:
states- list of BlockStatesdepth- depth of the BlockStatesblocksToForce- list of blocks that can be forced by any blockStates of this posList
-
BlockLayer
public BlockLayer(List<net.minecraft.block.BlockState> states, List<Short> chances, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayer- Parameters:
states- list of BlockStateschances- the chance of the related blockStates being chosendepth- depth of the BlockStatesblocksToForce- list of blocks that can be forced by any blockStates of this posList
-
BlockLayer
init the BlockLayer- Parameters:
states- list of BlockStatesforce- set if any block can be replaced by any blockState in this BlockList
-
BlockLayer
public BlockLayer(net.minecraft.block.BlockState state, int depth, Set<net.minecraft.block.Block> blocksToForce) init the BlockLayer- Parameters:
state- if the layer is only composed of one BlockState, you don't necessary need to create a list (created automatically)depth- list of BlockStatesblocksToForce- list of blocks that can be forced by any blockStates of this posList
-
BlockLayer
public BlockLayer(net.minecraft.block.BlockState state, boolean force) init the BlockLayer- Parameters:
state- if the layer is only composed of one BlockState, you don't necessary need to create a list (created automatically)force- set if any block can be replaced by any blockState in this BlockList
-
BlockLayer
init the BlockLayer- Parameters:
states- list of BlockStatesdepth- depth of the BlockStates
-
BlockLayer
init the BlockLayer- Parameters:
states- list of BlockStates
-
BlockLayer
init the BlockLayer- Parameters:
states- list of BlockStateschances- the chance of the state being chosen
-
BlockLayer
public BlockLayer(net.minecraft.block.BlockState state, int depth) init the BlockLayer- Parameters:
state- if the layer is only composed of one BlockState, you don't necessary need to create a list (created automatically)depth- list of BlockStates
-
BlockLayer
public BlockLayer(net.minecraft.block.BlockState state) init the BlockLayer- Parameters:
state- if the layer is only composed of one BlockState, you don't necessary need to create a list (created automatically)
-
-
Method Details
-
getDepth
public int getDepth()method used to get all the depth in aBlockLayer- Returns:
- the depth of the layer
-
setDepth
public void setDepth(int depth) set a depth to theBlockLayer- Parameters:
depth- int to change the layer depth
-
addDepth
public void addDepth(int depth) add a depth to theBlockLayer- Parameters:
depth- int added to the layer depth
-
getBlockStates
Method used to get all theBlockStatein aBlockLayer. The list returned will contain the BlockStates of the list, where each will be present n times, n being the chance related to that BlockState- Returns:
- the blockStates list of the layer
-
get
method to get the blockState as well as his chance- Returns:
- a list of pair corresponding to blockState as well as his chance
-
setBlockStates
method used to set all theBlockStatein aBlockLayer- Parameters:
blocks- change the BlockStates of a layer
-
addBlockState
public void addBlockState(net.minecraft.block.BlockState state) add a BlockState to the layer- Parameters:
state- BlockState to be added
-
addBlockStates
add multiple BlockStates to the layer- Parameters:
states- List of BlockState to be added
-
addBlockState
public void addBlockState(net.minecraft.block.BlockState state, short chance) add a BlockState to the layer- Parameters:
state- BlockState to be addedchance- the chance of a blockState being chosen
-
addBlockStates
add multiple BlockStates to the layer- Parameters:
states- List of BlockState to be addedchances- the chance list related to the states of a blockState being chosen- Throws:
IndexOutOfBoundsException- in the case, the chance list has a size inferior to the BlockStates chance.
-
removeBlockState
removes some BlockStates of the Layer- Parameters:
state- list of BlockStates that will be removed
-
removeBlockState
public void removeBlockState(net.minecraft.block.BlockState state) removes a BlockState of the Layer- Parameters:
state- BlockState that will be removed
-
removeBlockState
public void removeBlockState(int index) method used to remove aBlockStaterelated to the index- Parameters:
index- remove the BlockState at the index
-
size
public int size()method used to get the size of theBlockLayer- Returns:
- the size of the BlockStates
-
getBlocksToForce
gives you the Set of every block that can be forced- Returns:
- the set of the blocks that can be forced
-
setBlocksToForce
sets all the blocks that can be forced in the case force == false- Parameters:
blocksToForce- the set of blocks that can be forced
-
addBlocksToForce
public void addBlocksToForce(net.minecraft.block.Block block) add a block to the set- Parameters:
block- the block added
-
addBlocksToForce
add a set of blocks to the set- Parameters:
blocksToForce- the set that will be added
-
removeBlocksToForce
public void removeBlocksToForce(net.minecraft.block.Block block) remove a block to the set- Parameters:
block- the block removed
-
removeBlocksToForce
remove a set of blocks to the set- Parameters:
blocksToForce- the set that will be removed
-
isForce
public boolean isForce()get if any block can be replaced by any BlockState of this blockList- Returns:
- the boolean related to it
-
setForce
public void setForce(boolean force) sets if any block can be replaced by any BlockState of this blockList- Parameters:
force- the boolean used
-
toString
-