Class BlockLayerComparator
java.lang.Object
net.rodofire.easierworldcreator.blockdata.layer.BlockLayerComparator
The
BlockLayerComparator class provides utility methods to manage a collection of BlockLayer objects.
This class allows manipulation of individual layers and their properties, including adding, removing, and modifying
layers, as well as checking for specific conditions such as forced parameters.-
Constructor Summary
ConstructorsConstructorDescriptionBlockLayerComparator(List<BlockLayer> layers) Constructs aBlockLayerComparatorwith the specified list of layers.BlockLayerComparator(BlockLayer layer) Constructs aBlockLayerComparatorwith the specified layers. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockLayers(List<BlockLayer> layers) Adds a collection ofBlockLayerobjects to the list of layers.voidaddLayer(BlockLayer layer) Adds a singleBlockLayerto the list of layers.get(int index) Retrieves theBlockLayerat the specified index.Retrieves the firstBlockLayerin the list.Retrieves the lastBlockLayerin the list.Returns the list ofBlockLayerobjects.booleanChecks whether anyBlockLayerin the list has force parameters enabled.booleanisEmpty()Method to know if the BlockLayer List is emptyvoidmodifyBlocks(int index, List<net.minecraft.block.BlockState> states) Modifies the block states of theBlockLayerat the specified index.voidmodifyDepth(int index, int depth) Modifies the depth of theBlockLayerat the specified index.voidmodifyLayer(int index, BlockLayer layer) Replaces theBlockLayerat the specified index with a new one.remove(int index) Removes and returns theBlockLayerat the specified index.Removes and returns the firstBlockLayerin the list.Removes and returns the lastBlockLayerin the list.voidsetLayers(List<BlockLayer> layers) Replaces the current list ofBlockLayerobjects with the specified list.intsize()Returns the number ofBlockLayerobjects in the list.
-
Constructor Details
-
BlockLayerComparator
Constructs aBlockLayerComparatorwith the specified list of layers.- Parameters:
layers- the initial list ofBlockLayerobjects to manage
-
BlockLayerComparator
Constructs aBlockLayerComparatorwith the specified layers.- Parameters:
layer- the initialBlockLayerobjects to manage
-
-
Method Details
-
getLayers
Returns the list ofBlockLayerobjects.- Returns:
- the list of layers
-
setLayers
Replaces the current list ofBlockLayerobjects with the specified list.- Parameters:
layers- the new list ofBlockLayerobjects
-
addLayer
Adds a singleBlockLayerto the list of layers.- Parameters:
layer- theBlockLayerto add
-
addBlockLayers
Adds a collection ofBlockLayerobjects to the list of layers.- Parameters:
layers- the list ofBlockLayerobjects to add
-
get
Retrieves theBlockLayerat the specified index.- Parameters:
index- the index of theBlockLayerto retrieve- Returns:
- the
BlockLayerat the specified index
-
remove
Removes and returns theBlockLayerat the specified index.- Parameters:
index- the index of theBlockLayerto remove- Returns:
- the removed
BlockLayer
-
getFirstLayer
Retrieves the firstBlockLayerin the list.- Returns:
- the first
BlockLayer
-
removeFirstLayer
Removes and returns the firstBlockLayerin the list.- Returns:
- the removed first
BlockLayer
-
getLastLayer
Retrieves the lastBlockLayerin the list.- Returns:
- the last
BlockLayer
-
removeLastLayer
Removes and returns the lastBlockLayerin the list.- Returns:
- the removed last
BlockLayer
-
modifyBlocks
Modifies the block states of theBlockLayerat the specified index.- Parameters:
index- the index of theBlockLayerto modifystates- the new list ofBlockStateobjects
-
modifyDepth
public void modifyDepth(int index, int depth) Modifies the depth of theBlockLayerat the specified index.- Parameters:
index- the index of theBlockLayerto modifydepth- the new depth value
-
modifyLayer
Replaces theBlockLayerat the specified index with a new one.- Parameters:
index- the index of theBlockLayerto replacelayer- the newBlockLayer
-
size
public int size()Returns the number ofBlockLayerobjects in the list.- Returns:
- the size of the list
-
isEmpty
public boolean isEmpty()Method to know if the BlockLayer List is empty- Returns:
- true if it is empty, false if not
-
hasForceParameters
public boolean hasForceParameters()Checks whether anyBlockLayerin the list has force parameters enabled.- Returns:
trueif any layer has force parameters;falseotherwise
-