java.lang.Object
net.rodofire.easierworldcreator.blockdata.blocklist.basic.DefaultBlockList
All Implemented Interfaces:
BlockListManager
Direct Known Subclasses:
CompoundBlockList, ForceBlockList

public class DefaultBlockList extends Object implements BlockListManager

Class used to connect BlockPos to a BlockState.


the class is composed of a List<BlockPos> related to a BlockState.

This means that all the BlockPos of the object are connected to the BlockState


this is an easier version of the StructureTemplate.StructureBlockInfo

It also allows for better manipulation of how blocks behave and allows to save memory since that there is no double blockStates.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultBlockList(List<net.minecraft.util.math.BlockPos> posList, net.minecraft.block.BlockState blockState)
    init a BlockShapeManager
    DefaultBlockList(net.minecraft.util.math.BlockPos pos, net.minecraft.block.BlockState state)
    init a BlockShapeManager
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBlockPos(List<net.minecraft.util.math.BlockPos> pos)
    allow you to add multiple BlockPos to the existing list
    void
    addBlockPos(net.minecraft.util.math.BlockPos pos)
    allow you to add a BlockPos to the existing list
    net.minecraft.block.BlockState
    used to get the blockState
    net.minecraft.util.math.BlockPos
    method to get the first blockPos of the posList
    net.minecraft.util.math.BlockPos
    method to get the last blockPos of the posList
    net.minecraft.util.math.BlockPos
    getPos(int index)
    method to get a certain pos from an index in the posList
    List<net.minecraft.util.math.BlockPos>
    used to get the list of blockPos related to a layer
    net.minecraft.util.math.BlockPos
    Method to get a random BlockPos in the posList by using a new minecraft Random
    net.minecraft.util.math.BlockPos
    getRandomPos(net.minecraft.util.math.random.Random random)
    Method to get a random BlockPos in the posList based on a provided random
    void
    removeBlockPos(List<net.minecraft.util.math.BlockPos> pos)
    allow you to remove a list of BlockPos to the existing list
    void
    removeBlockPos(net.minecraft.util.math.BlockPos pos)
    allow you to remove a BlockPos to the existing list
    void
    replaceBlockPos(net.minecraft.util.math.BlockPos oldPos, net.minecraft.util.math.BlockPos newPos)
    method to replace one blockPos to another one
    void
    setBlockState(net.minecraft.block.BlockState blockState)
    change the blockState of the BlockShapeManager
    void
    setPosList(List<net.minecraft.util.math.BlockPos> posList)
    It uses a list of blockPos to allow multiple BlockPos to have a BlockState
    int
    method to get the number of BlockPos present in the related BlockList
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DefaultBlockList

      public DefaultBlockList(List<net.minecraft.util.math.BlockPos> posList, net.minecraft.block.BlockState blockState)
      init a BlockShapeManager
      Parameters:
      posList - pos of the blockState
      blockState - the blockState related to the pos list
    • DefaultBlockList

      public DefaultBlockList(net.minecraft.util.math.BlockPos pos, net.minecraft.block.BlockState state)
      init a BlockShapeManager
      Parameters:
      pos - pos of the blockState
      state - the blockState related to the pos list
  • Method Details

    • getPosList

      public List<net.minecraft.util.math.BlockPos> getPosList()
      used to get the list of blockPos related to a layer
      Specified by:
      getPosList in interface BlockListManager
      Returns:
      the list of BlockPos
    • setPosList

      public void setPosList(List<net.minecraft.util.math.BlockPos> posList)
      It uses a list of blockPos to allow multiple BlockPos to have a BlockState
      Specified by:
      setPosList in interface BlockListManager
      Parameters:
      posList - a list of BlockPos
    • addBlockPos

      public void addBlockPos(net.minecraft.util.math.BlockPos pos)
      allow you to add a BlockPos to the existing list
      Specified by:
      addBlockPos in interface BlockListManager
      Parameters:
      pos - the pos added
    • addBlockPos

      public void addBlockPos(List<net.minecraft.util.math.BlockPos> pos)
      allow you to add multiple BlockPos to the existing list
      Specified by:
      addBlockPos in interface BlockListManager
      Parameters:
      pos - the pos list added
    • removeBlockPos

      public void removeBlockPos(net.minecraft.util.math.BlockPos pos)
      allow you to remove a BlockPos to the existing list
      Specified by:
      removeBlockPos in interface BlockListManager
      Parameters:
      pos - the pos removed
    • removeBlockPos

      public void removeBlockPos(List<net.minecraft.util.math.BlockPos> pos)
      allow you to remove a list of BlockPos to the existing list
      Specified by:
      removeBlockPos in interface BlockListManager
      Parameters:
      pos - the list pos removed
    • replaceBlockPos

      public void replaceBlockPos(net.minecraft.util.math.BlockPos oldPos, net.minecraft.util.math.BlockPos newPos)
      method to replace one blockPos to another one
      Specified by:
      replaceBlockPos in interface BlockListManager
      Parameters:
      oldPos - the oldPos that will be replaced
      newPos - the newPos that will replace the other blockPos
    • getPos

      public net.minecraft.util.math.BlockPos getPos(int index)
      method to get a certain pos from an index in the posList
      Specified by:
      getPos in interface BlockListManager
      Parameters:
      index - the index of the BlockPos
      Returns:
      the BlockPos of the index
    • getLastPos

      public net.minecraft.util.math.BlockPos getLastPos()
      method to get the last blockPos of the posList
      Specified by:
      getLastPos in interface BlockListManager
      Returns:
      the last blockPos of the posList
    • getFirstPos

      public net.minecraft.util.math.BlockPos getFirstPos()
      method to get the first blockPos of the posList
      Specified by:
      getFirstPos in interface BlockListManager
      Returns:
      the first blockPos of the posList
    • getRandomPos

      public net.minecraft.util.math.BlockPos getRandomPos()
      Method to get a random BlockPos in the posList by using a new minecraft Random
      Specified by:
      getRandomPos in interface BlockListManager
      Returns:
      a random BlockPos
    • getRandomPos

      public net.minecraft.util.math.BlockPos getRandomPos(net.minecraft.util.math.random.Random random)
      Method to get a random BlockPos in the posList based on a provided random
      Specified by:
      getRandomPos in interface BlockListManager
      Parameters:
      random - the random object that will be used to get the index
      Returns:
      a random BlockPos
    • getBlockState

      public net.minecraft.block.BlockState getBlockState()
      used to get the blockState
      Specified by:
      getBlockState in interface BlockListManager
      Returns:
      the blockState of the BlockShapeManager
    • setBlockState

      public void setBlockState(net.minecraft.block.BlockState blockState)
      change the blockState of the BlockShapeManager
      Specified by:
      setBlockState in interface BlockListManager
      Parameters:
      blockState - the blockState related to the BlockPos list
    • size

      public int size()
      method to get the number of BlockPos present in the related BlockList
      Specified by:
      size in interface BlockListManager
      Returns:
      the number of BlockPos
    • toString

      public String toString()
      Overrides:
      toString in class Object