Class BlockLayerManager

java.lang.Object
fr.rodofire.ewc.blockdata.layer.BlockLayerManager

public class BlockLayerManager 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

    • BlockLayerManager

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

      public BlockLayerManager(BlockLayer... layers)
    • BlockLayerManager

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

      public BlockLayerManager(LayerPlacer placer, net.minecraft.world.level.block.state.BlockState state, short depth)
      Constructs a BlockLayerComparator with the specified layers.
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states, int depth, StructurePlacementRuleManager ruler)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
      depth - depth of the BlockStates
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states, List<Short> chances, int depth, StructurePlacementRuleManager ruler)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
      chances - the chance of the related blockStates being chosen
      depth - depth of the BlockStates
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states, StructurePlacementRuleManager ruler)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, net.minecraft.world.level.block.state.BlockState state, int depth, StructurePlacementRuleManager ruler)
      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
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, net.minecraft.world.level.block.state.BlockState state, StructurePlacementRuleManager ruler)
      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)
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states, int depth)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
      depth - depth of the BlockStates
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, List<net.minecraft.world.level.block.state.BlockState> states, List<Short> chances)
      init the BlockLayer
      Parameters:
      states - list of BlockStates
      chances - the chance of the state being chosen
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, net.minecraft.world.level.block.state.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
    • BlockLayerManager

      public BlockLayerManager(LayerPlacer placer, net.minecraft.world.level.block.state.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

    • 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.world.level.block.state.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
    • isRepeatLayers

      public boolean isRepeatLayers()
      method to know if the layers should repeat
      Returns:
      the boolean value
    • setRepeatLayers

      public void setRepeatLayers(boolean repeatLayers)
      method to repeat the layer in the case the distance is bigger than the sum of all depth of all the BlockLayer
      Parameters:
      repeatLayers - boolean that manage if the layers have to be repeated