Class BlockList
java.lang.Object
net.rodofire.easierworldcreator.blockdata.blocklist.BlockList
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
- BlockStates are not doubled, saving a lot of memory comparing to
Pair<BlockState, BlockPos>since that noBlockStateare 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:
overrideBlocksandforce - provide some useful methods to simplify it's usage
-
Constructor Summary
ConstructorsConstructorDescriptionBlockList(net.minecraft.block.BlockState state, long pos) init a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, it.unimi.dsi.fastutil.longs.LongArrayList posList) init a BlockShapeManagerinit a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, long pos) init a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, it.unimi.dsi.fastutil.longs.LongArrayList posList) init a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, List<net.minecraft.util.math.BlockPos> posList) init a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, net.minecraft.nbt.NbtCompound tag, net.minecraft.util.math.BlockPos pos) init a BlockShapeManagerBlockList(net.minecraft.block.BlockState state, net.minecraft.util.math.BlockPos pos) init a BlockShapeManager -
Method Summary
Modifier and TypeMethodDescriptionaddAllPos(it.unimi.dsi.fastutil.longs.LongArrayList posList) voidaddCustomProperty(com.google.gson.JsonObject json) addPos(long pos) addPos(net.minecraft.util.math.BlockPos pos) List<net.minecraft.util.math.BlockPos> longnet.minecraft.util.math.BlockPoslongnet.minecraft.util.math.BlockPoslonggetLongPos(int index) net.minecraft.util.math.BlockPosgetPos(int index) it.unimi.dsi.fastutil.longs.LongArrayListlonglonggetRandomLongPos(net.minecraft.util.math.random.Random random) net.minecraft.util.math.BlockPosnet.minecraft.util.math.BlockPosgetRandomPos(net.minecraft.util.math.random.Random random) getRuler()net.minecraft.block.BlockStategetState()Optional<net.minecraft.nbt.NbtCompound> getTag()voidinit(net.minecraft.world.StructureWorldAccess world) booleanplace(net.minecraft.world.StructureWorldAccess world, int index) booleanplace(net.minecraft.world.StructureWorldAccess world, int index, int flag) booleanplaceAll(net.minecraft.world.StructureWorldAccess worldAccess) booleanplaceAll(net.minecraft.world.StructureWorldAccess worldAccess, int flag) booleanplaceAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess) booleanplaceAllNDelete(net.minecraft.world.StructureWorldAccess worldAccess, int flag) booleanplaceFirst(net.minecraft.world.StructureWorldAccess world) booleanplaceFirst(net.minecraft.world.StructureWorldAccess world, int flag) voidplaceJson(net.minecraft.util.math.ChunkPos chunkPos) voidplaceJson(net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos) booleanplaceLast(net.minecraft.world.StructureWorldAccess world) booleanplaceLast(net.minecraft.world.StructureWorldAccess world, int flag) booleanplaceLastNDelete(net.minecraft.world.StructureWorldAccess world) booleanplaceNDelete(net.minecraft.world.StructureWorldAccess world, int index) for the most performance, it is recommended to not use this method whereplaceLastNDelete()can be appliedbooleanplaceNDelete(net.minecraft.world.StructureWorldAccess world, int index, int flag) for the most performance, it is recommended to not use this method whereplaceLastNDelete()can be appliedtime complexity of O(n * m), m being the length of the providedList<>avoid using it in performance crucial applicationsnet.minecraft.util.math.BlockPosnet.minecraft.util.math.BlockPosnet.minecraft.util.math.BlockPosremovePos(int index) removePos(net.minecraft.util.math.BlockPos pos) time complexity of O(n), avoid using this in performance crucial applicationsreplacePos(int index, long newPos) replacePos(int index, net.minecraft.util.math.BlockPos newPos) set(int index, net.minecraft.util.math.BlockPos newPos) voidsetBlockData(BlockDataKey data) setPosList(it.unimi.dsi.fastutil.longs.LongArrayList posList) setPosList(List<net.minecraft.util.math.BlockPos> posList) voidvoidsetState(net.minecraft.block.BlockState state) voidsetTag(net.minecraft.nbt.NbtCompound tag) intsize()com.google.gson.JsonObjecttoJson(net.minecraft.util.math.ChunkPos chunkPos) com.google.gson.JsonObjecttoJson(net.minecraft.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos)
-
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 listposList- 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 listpos- 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 listposList- 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 listpos- 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 listposList- 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 listpos- 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 listposList- 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 listpos- pos of the blockState
-
BlockList
public BlockList()
-
-
Method Details
-
size
public int size() -
replacePos
-
replacePos
-
addAllPos
-
addAllPos
-
addPos
-
addPos
-
setPosList
-
setPosList
-
set
-
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
time complexity of O(n), avoid using this in performance crucial applications- Returns:
- the removed pos
-
getTag
-
setTag
public void setTag(net.minecraft.nbt.NbtCompound tag) -
removeAll
time complexity of O(n * m), m being the length of the providedList<>avoid using it in performance crucial applications- Returns:
- the instance of the object
-
getRuler
-
setRuler
-
getState
public net.minecraft.block.BlockState getState() -
setState
public void setState(net.minecraft.block.BlockState state) -
getBlockData
-
setBlockData
-
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 whereplaceLastNDelete()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 whereplaceLastNDelete()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.util.math.ChunkPos offset, net.minecraft.util.math.ChunkPos chunkPos) -
init
public void init(net.minecraft.world.StructureWorldAccess world)
-