Class BlockLayerComparator

java.lang.Object
net.rodofire.easierworldcreator.blockdata.layer.BlockLayerComparator

public class BlockLayerComparator extends Object
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 Details

    • BlockLayerComparator

      public BlockLayerComparator(List<BlockLayer> layers)
      Constructs a BlockLayerComparator with the specified list of layers.
      Parameters:
      layers - the initial list of BlockLayer objects to manage
    • BlockLayerComparator

      public BlockLayerComparator(BlockLayer layer)
      Constructs a BlockLayerComparator with the specified layers.
      Parameters:
      layer - the initial BlockLayer objects to manage
  • Method Details

    • getLayers

      public List<BlockLayer> getLayers()
      Returns the list of BlockLayer objects.
      Returns:
      the list of layers
    • setLayers

      public void setLayers(List<BlockLayer> layers)
      Replaces the current list of BlockLayer objects with the specified list.
      Parameters:
      layers - the new list of BlockLayer objects
    • addLayer

      public void addLayer(BlockLayer layer)
      Adds a single BlockLayer to the list of layers.
      Parameters:
      layer - the BlockLayer to add
    • addBlockLayers

      public void addBlockLayers(List<BlockLayer> layers)
      Adds a collection of BlockLayer objects to the list of layers.
      Parameters:
      layers - the list of BlockLayer objects to add
    • get

      public BlockLayer get(int index)
      Retrieves the BlockLayer at the specified index.
      Parameters:
      index - the index of the BlockLayer to retrieve
      Returns:
      the BlockLayer at the specified index
    • remove

      public BlockLayer remove(int index)
      Removes and returns the BlockLayer at the specified index.
      Parameters:
      index - the index of the BlockLayer to remove
      Returns:
      the removed BlockLayer
    • getFirstLayer

      public BlockLayer getFirstLayer()
      Retrieves the first BlockLayer in the list.
      Returns:
      the first BlockLayer
    • removeFirstLayer

      public BlockLayer removeFirstLayer()
      Removes and returns the first BlockLayer in the list.
      Returns:
      the removed first BlockLayer
    • getLastLayer

      public BlockLayer getLastLayer()
      Retrieves the last BlockLayer in the list.
      Returns:
      the last BlockLayer
    • removeLastLayer

      public BlockLayer removeLastLayer()
      Removes and returns the last BlockLayer in the list.
      Returns:
      the removed last BlockLayer
    • modifyBlocks

      public void modifyBlocks(int index, List<net.minecraft.block.BlockState> states)
      Modifies the block states of the BlockLayer at the specified index.
      Parameters:
      index - the index of the BlockLayer to modify
      states - the new list of BlockState objects
    • modifyDepth

      public void modifyDepth(int index, int depth)
      Modifies the depth of the BlockLayer at the specified index.
      Parameters:
      index - the index of the BlockLayer to modify
      depth - the new depth value
    • modifyLayer

      public void modifyLayer(int index, BlockLayer layer)
      Replaces the BlockLayer at the specified index with a new one.
      Parameters:
      index - the index of the BlockLayer to replace
      layer - the new BlockLayer
    • size

      public int size()
      Returns the number of BlockLayer objects 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 any BlockLayer in the list has force parameters enabled.
      Returns:
      true if any layer has force parameters; false otherwise