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

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

    • BlockLayer

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

      public BlockLayer(LayerPlacer placer, List<net.minecraft.block.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
    • BlockLayer

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

      public BlockLayer(LayerPlacer placer, net.minecraft.block.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
    • BlockLayer

      public BlockLayer(LayerPlacer placer, net.minecraft.block.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)
    • BlockLayer

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

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

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

      public BlockLayer(LayerPlacer placer, 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(LayerPlacer placer, 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

    • getRuler

      public StructurePlacementRuleManager getRuler()
    • setRuler

      public void setRuler(StructurePlacementRuleManager ruler)
    • getPlacer

      public LayerPlacer getPlacer()
    • setPlacer

      public void setPlacer(LayerPlacer placer)
    • getDepth

      public int getDepth()
      method used to get all the depth in a BlockLayer
      Returns:
      the depth of the layer
    • setDepth

      public void setDepth(int depth)
      set a depth to the BlockLayer
      Parameters:
      depth - int to change the layer depth
    • addDepth

      public void addDepth(int depth)
      add a depth to the BlockLayer
      Parameters:
      depth - int added to the layer depth
    • getBlockStates

      public List<net.minecraft.block.BlockState> getBlockStates()
      Method used to get all the BlockState in a BlockLayer. 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

      public List<net.minecraft.util.Pair<net.minecraft.block.BlockState,Short>> 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

      public void setBlockStates(List<net.minecraft.block.BlockState> blocks)
      method used to set all the BlockState in a BlockLayer
      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

      public void addBlockStates(List<net.minecraft.block.BlockState> states)
      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 added
      chance - the chance of a blockState being chosen
    • addBlockStates

      public void addBlockStates(List<net.minecraft.block.BlockState> states, List<Short> chances)
      add multiple BlockStates to the layer
      Parameters:
      states - List of BlockState to be added
      chances - 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

      public void removeBlockState(List<net.minecraft.block.BlockState> state)
      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 a BlockState related to the index
      Parameters:
      index - remove the BlockState at the index
    • size

      public int size()
      method used to get the size of the BlockLayer
      Returns:
      the size of the BlockStates
    • toString

      public String toString()
      Overrides:
      toString in class Object