java.lang.Object
net.rodofire.easierworldcreator.blockdata.blocklist.BlockList

public class BlockList extends Object

Class used to connect BlockPos to a BlockState.


the class is composed of a LongArrayList that store all the 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

This approach allows for many improvements:
  • BlockStates are not doubled, saving a lot of memory comparing to Pair<BlockState, BlockPos> since that no BlockState are duplicated
  • BlockPos are compressed into a LongArrayList, saving ~30% memory and allowing for ~70% more performance
  • Provides some describing on how should the Block be placed: overrideBlocks and force
  • provide some useful methods to simplify it's usage
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    BlockList(net.minecraft.block.BlockState state, long pos)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, it.unimi.dsi.fastutil.longs.LongArrayList posList)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, List<net.minecraft.util.math.BlockPos> posList)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, long pos)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, it.unimi.dsi.fastutil.longs.LongArrayList posList)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, List<net.minecraft.util.math.BlockPos> posList)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, net.minecraft.util.math.BlockPos pos)
    init a BlockShapeManager
    BlockList(net.minecraft.block.BlockState state, net.minecraft.util.math.BlockPos pos)
    init a BlockShapeManager
  • Method Summary

    Modifier and Type
    Method
    Description
    addAllPos(it.unimi.dsi.fastutil.longs.LongArrayList posList)
     
    addAllPos(List<net.minecraft.util.math.BlockPos> posList)
     
    void
    addCustomProperty(com.google.gson.JsonObject json)
     
    addPos(long pos)
     
    addPos(net.minecraft.util.math.BlockPos pos)
     
     
    List<net.minecraft.util.math.BlockPos>
     
    long
     
    net.minecraft.util.math.BlockPos
     
    long
     
    net.minecraft.util.math.BlockPos
     
    long
    getLongPos(int index)
     
    net.minecraft.util.math.BlockPos
    getPos(int index)
     
    it.unimi.dsi.fastutil.longs.LongArrayList
     
    long
     
    long
    getRandomLongPos(net.minecraft.util.math.random.Random random)
     
    net.minecraft.util.math.BlockPos
     
    net.minecraft.util.math.BlockPos
    getRandomPos(net.minecraft.util.math.random.Random random)
     
     
    net.minecraft.block.BlockState
     
    Optional<net.minecraft.nbt.NbtCompound>
     
    void
    init(net.minecraft.world.StructureWorldAccess world)
     
    boolean
    place(net.minecraft.world.StructureWorldAccess world, int index)
     
    boolean
    place(net.minecraft.world.StructureWorldAccess world, int index, int flag)
     
    boolean
    placeAll(net.minecraft.world.StructureWorldAccess worldAccess)
     
    boolean
    placeAll(net.minecraft.world.StructureWorldAccess worldAccess, int flag)
     
    boolean
    placeAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess)
     
    boolean
    placeAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess, int flag)
     
    boolean
    placeFirst(net.minecraft.world.StructureWorldAccess world)
     
    boolean
    placeFirst(net.minecraft.world.StructureWorldAccess world, int flag)
     
    void
    placeJson(net.minecraft.util.math.ChunkPos chunkPos)
     
    void
    placeJson(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos)
     
    boolean
    placeLast(net.minecraft.world.StructureWorldAccess world)
     
    boolean
    placeLast(net.minecraft.world.StructureWorldAccess world, int flag)
     
    boolean
    placeLastNDelete(net.minecraft.world.StructureWorldAccess world)
     
    boolean
    placeNDelete(net.minecraft.world.StructureWorldAccess world, int index)
    for the most performance, it is recommended to not use this method where placeLastNDelete() can be applied
    boolean
    placeNDelete(net.minecraft.world.StructureWorldAccess world, int index, int flag)
    for the most performance, it is recommended to not use this method where placeLastNDelete() can be applied
    removeAll(List<net.minecraft.util.math.BlockPos> list)
    time complexity of O(n * m), m being the length of the provided List<> avoid using it in performance crucial applications
    net.minecraft.util.math.BlockPos
     
    net.minecraft.util.math.BlockPos
     
    net.minecraft.util.math.BlockPos
    removePos(int index)
     
    removePos(net.minecraft.util.math.BlockPos pos)
    time complexity of O(n), avoid using this in performance crucial applications
    replacePos(int index, long newPos)
     
    replacePos(int index, net.minecraft.util.math.BlockPos newPos)
     
    set(int index, net.minecraft.util.math.BlockPos newPos)
     
    void
     
    setPosList(it.unimi.dsi.fastutil.longs.LongArrayList posList)
     
    setPosList(List<net.minecraft.util.math.BlockPos> posList)
     
    void
     
    void
    setState(net.minecraft.block.BlockState state)
     
    void
    setTag(net.minecraft.nbt.NbtCompound tag)
     
    int
     
    com.google.gson.JsonObject
    toJson(net.minecraft.util.math.ChunkPos chunkPos)
     
    com.google.gson.JsonObject
    toJson(net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos)
     

    Methods inherited from class java.lang.Object

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

    • BlockList

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

      public BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, net.minecraft.util.math.BlockPos pos)
      init a BlockShapeManager
      Parameters:
      state - the blockState related to the pos list
      pos - pos of the blockState
    • BlockList

      public BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, it.unimi.dsi.fastutil.longs.LongArrayList posList)
      init a BlockShapeManager
      Parameters:
      state - the state related to the pos list
      posList - pos of the state
    • BlockList

      public BlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, long pos)
      init a BlockShapeManager
      Parameters:
      state - the blockState related to the pos list
      pos - pos of the blockState
    • BlockList

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

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

      public BlockList(net.minecraft.block.BlockState state, it.unimi.dsi.fastutil.longs.LongArrayList posList)
      init a BlockShapeManager
      Parameters:
      state - the state related to the pos list
      posList - pos of the state
    • BlockList

      public BlockList(net.minecraft.block.BlockState state, long pos)
      init a BlockShapeManager
      Parameters:
      state - the blockState related to the pos list
      pos - pos of the blockState
    • BlockList

      public BlockList()
  • Method Details

    • size

      public int size()
    • replacePos

      public BlockList replacePos(int index, net.minecraft.util.math.BlockPos newPos)
    • replacePos

      public BlockList replacePos(int index, long newPos)
    • addAllPos

      public BlockList addAllPos(List<net.minecraft.util.math.BlockPos> posList)
    • addAllPos

      public BlockList addAllPos(it.unimi.dsi.fastutil.longs.LongArrayList posList)
    • addPos

      public BlockList addPos(net.minecraft.util.math.BlockPos pos)
    • addPos

      public BlockList addPos(long pos)
    • setPosList

      public BlockList setPosList(List<net.minecraft.util.math.BlockPos> posList)
    • setPosList

      public BlockList setPosList(it.unimi.dsi.fastutil.longs.LongArrayList posList)
    • set

      public BlockList set(int index, net.minecraft.util.math.BlockPos newPos)
    • getConvertedPosList

      public List<net.minecraft.util.math.BlockPos> getConvertedPosList()
    • getPosList

      public it.unimi.dsi.fastutil.longs.LongArrayList getPosList()
    • getPos

      public net.minecraft.util.math.BlockPos getPos(int index)
    • getFirstPos

      public net.minecraft.util.math.BlockPos getFirstPos()
    • getLastPos

      public net.minecraft.util.math.BlockPos getLastPos()
    • getRandomPos

      public net.minecraft.util.math.BlockPos getRandomPos()
    • getRandomPos

      public net.minecraft.util.math.BlockPos getRandomPos(net.minecraft.util.math.random.Random random)
    • getLongPos

      public long getLongPos(int index)
    • getFirstLongPos

      public long getFirstLongPos()
    • getLastLongPos

      public long getLastLongPos()
    • getRandomLongPos

      public long getRandomLongPos()
    • getRandomLongPos

      public long getRandomLongPos(net.minecraft.util.math.random.Random random)
    • removePos

      public net.minecraft.util.math.BlockPos removePos(int index)
    • removeLastPos

      public net.minecraft.util.math.BlockPos removeLastPos()
    • removeFirstPos

      public net.minecraft.util.math.BlockPos removeFirstPos()
    • removePos

      public BlockList removePos(net.minecraft.util.math.BlockPos pos)
      time complexity of O(n), avoid using this in performance crucial applications
      Returns:
      the removed pos
    • getTag

      public Optional<net.minecraft.nbt.NbtCompound> getTag()
    • setTag

      public void setTag(net.minecraft.nbt.NbtCompound tag)
    • removeAll

      public BlockList removeAll(List<net.minecraft.util.math.BlockPos> list)
      time complexity of O(n * m), m being the length of the provided List<> avoid using it in performance crucial applications
      Returns:
      the instance of the object
    • getRuler

      public StructurePlacementRuleManager getRuler()
    • setRuler

      public void setRuler(StructurePlacementRuleManager ruler)
    • getState

      public net.minecraft.block.BlockState getState()
    • setState

      public void setState(net.minecraft.block.BlockState state)
    • getBlockData

      public BlockDataKey getBlockData()
    • setBlockData

      public void setBlockData(BlockDataKey data)
    • placeLast

      public boolean placeLast(net.minecraft.world.StructureWorldAccess world)
    • placeFirst

      public boolean placeFirst(net.minecraft.world.StructureWorldAccess world)
    • place

      public boolean place(net.minecraft.world.StructureWorldAccess world, int index)
    • placeAll

      public boolean placeAll(net.minecraft.world.StructureWorldAccess worldAccess, int flag)
    • placeLast

      public boolean placeLast(net.minecraft.world.StructureWorldAccess world, int flag)
    • placeFirst

      public boolean placeFirst(net.minecraft.world.StructureWorldAccess world, int flag)
    • place

      public boolean place(net.minecraft.world.StructureWorldAccess world, int index, int flag)
    • placeAll

      public boolean placeAll(net.minecraft.world.StructureWorldAccess worldAccess)
    • placeLastNDelete

      public boolean placeLastNDelete(net.minecraft.world.StructureWorldAccess world)
    • placeNDelete

      public boolean placeNDelete(net.minecraft.world.StructureWorldAccess world, int index)
      for the most performance, it is recommended to not use this method where placeLastNDelete() can be applied
    • placeNDelete

      public boolean placeNDelete(net.minecraft.world.StructureWorldAccess world, int index, int flag)
      for the most performance, it is recommended to not use this method where placeLastNDelete() can be applied
    • placeAllNDelete

      public boolean placeAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess)
    • placeAllNDelete

      public boolean placeAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess, int flag)
    • toJson

      public com.google.gson.JsonObject toJson(net.minecraft.util.math.ChunkPos chunkPos)
    • toJson

      public com.google.gson.JsonObject toJson(net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos)
    • addCustomProperty

      public void addCustomProperty(com.google.gson.JsonObject json)
    • placeJson

      public void placeJson(net.minecraft.util.math.ChunkPos chunkPos)
    • placeJson

      public void placeJson(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos)
    • init

      public void init(net.minecraft.world.StructureWorldAccess world)