Class BlockList
java.lang.Object
fr.rodofire.ewc.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.Palette
- 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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlockList(BlockDataKey blockDataKey, StructurePlacementRuleManager ruleManager, List<Long> longs) BlockList(net.minecraft.world.level.block.state.BlockState state, long pos) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, it.unimi.dsi.fastutil.longs.LongArrayList posList) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, List<net.minecraft.core.BlockPos> posList) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, long pos) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, it.unimi.dsi.fastutil.longs.LongArrayList posList) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, List<net.minecraft.core.BlockPos> posList) init a BlockShapeManagerBlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, net.minecraft.core.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.core.BlockPos pos) List<net.minecraft.core.BlockPos> longnet.minecraft.core.BlockPoslongnet.minecraft.core.BlockPoslonggetLongPos(int index) net.minecraft.core.BlockPosgetPos(int index) it.unimi.dsi.fastutil.longs.LongArrayListlonglonggetRandomLongPos(net.minecraft.util.RandomSource random) net.minecraft.core.BlockPosnet.minecraft.core.BlockPosgetRandomPos(net.minecraft.util.RandomSource random) getRuler()net.minecraft.world.level.block.state.BlockStategetState()Optional<net.minecraft.nbt.CompoundTag> getTag()voidinit(net.minecraft.world.level.WorldGenLevel world) booleanplace(net.minecraft.world.level.WorldGenLevel world, int index) booleanplace(net.minecraft.world.level.WorldGenLevel world, int index, int flag) booleanplaceAll(net.minecraft.world.level.WorldGenLevel worldAccess) booleanplaceAll(net.minecraft.world.level.WorldGenLevel worldAccess, int flag) booleanplaceAllNDelete(net.minecraft.world.level.WorldGenLevel worldAccess) booleanplaceAllNDelete(net.minecraft.world.level.WorldGenLevel worldAccess, int flag) booleanplaceFirst(net.minecraft.world.level.WorldGenLevel world) booleanplaceFirst(net.minecraft.world.level.WorldGenLevel world, int flag) voidplaceJson(net.minecraft.world.level.ChunkPos chunkPos) voidplaceJson(net.minecraft.world.level.WorldGenLevel world, net.minecraft.world.level.ChunkPos offset, net.minecraft.world.level.ChunkPos chunkPos) booleanplaceLast(net.minecraft.world.level.WorldGenLevel world) booleanplaceLast(net.minecraft.world.level.WorldGenLevel world, int flag) booleanplaceLastNDelete(net.minecraft.world.level.WorldGenLevel world) booleanplaceNDelete(net.minecraft.world.level.WorldGenLevel world, int index) for the most performance, it is recommended to not use this method whereplaceLastNDelete()can be appliedbooleanplaceNDelete(net.minecraft.world.level.WorldGenLevel 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.core.BlockPosnet.minecraft.core.BlockPosnet.minecraft.core.BlockPosremovePos(int index) removePos(net.minecraft.core.BlockPos pos) time complexity of O(n), avoid using this in performance crucial applicationsreplacePos(int index, long newPos) replacePos(int index, net.minecraft.core.BlockPos newPos) set(int index, net.minecraft.core.BlockPos newPos) voidsetBlockData(BlockDataKey data) setPosList(it.unimi.dsi.fastutil.longs.LongArrayList posList) setPosList(List<net.minecraft.core.BlockPos> posList) voidvoidsetState(net.minecraft.world.level.block.state.BlockState state) voidsetTag(net.minecraft.nbt.CompoundTag tag) intsize()com.google.gson.JsonObjecttoJson(net.minecraft.world.level.ChunkPos chunkPos) com.google.gson.JsonObjecttoJson(net.minecraft.world.level.ChunkPos offset, net.minecraft.world.level.ChunkPos chunkPos)
-
Field Details
-
CODEC
-
-
Constructor Details
-
BlockList
public BlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, List<net.minecraft.core.BlockPos> posList) init a BlockShapeManager- Parameters:
state- the state related to the pos listposList- pos of the state
-
BlockList
public BlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, net.minecraft.core.BlockPos pos) init a BlockShapeManager- Parameters:
state- the blockState related to the pos listpos- pos of the blockState
-
BlockList
public BlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag 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.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag tag, long pos) init a BlockShapeManager- Parameters:
state- the blockState related to the pos listpos- pos of the blockState
-
BlockList
public BlockList(net.minecraft.world.level.block.state.BlockState state, List<net.minecraft.core.BlockPos> posList) init a BlockShapeManager- Parameters:
state- the state related to the pos listposList- pos of the state
-
BlockList
public BlockList(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos) init a BlockShapeManager- Parameters:
state- the blockState related to the pos listpos- pos of the blockState
-
BlockList
public BlockList(net.minecraft.world.level.block.state.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.world.level.block.state.BlockState state, long pos) init a BlockShapeManager- Parameters:
state- the blockState related to the pos listpos- pos of the blockState
-
BlockList
public BlockList() -
BlockList
public BlockList(BlockDataKey blockDataKey, StructurePlacementRuleManager ruleManager, List<Long> longs)
-
-
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.core.BlockPos getPos(int index) -
getFirstPos
public net.minecraft.core.BlockPos getFirstPos() -
getLastPos
public net.minecraft.core.BlockPos getLastPos() -
getRandomPos
public net.minecraft.core.BlockPos getRandomPos() -
getRandomPos
public net.minecraft.core.BlockPos getRandomPos(net.minecraft.util.RandomSource 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.RandomSource random) -
removePos
public net.minecraft.core.BlockPos removePos(int index) -
removeLastPos
public net.minecraft.core.BlockPos removeLastPos() -
removeFirstPos
public net.minecraft.core.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.CompoundTag 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.world.level.block.state.BlockState getState() -
setState
public void setState(net.minecraft.world.level.block.state.BlockState state) -
getBlockData
-
setBlockData
-
placeLast
public boolean placeLast(net.minecraft.world.level.WorldGenLevel world) -
placeFirst
public boolean placeFirst(net.minecraft.world.level.WorldGenLevel world) -
place
public boolean place(net.minecraft.world.level.WorldGenLevel world, int index) -
placeAll
public boolean placeAll(net.minecraft.world.level.WorldGenLevel worldAccess, int flag) -
placeLast
public boolean placeLast(net.minecraft.world.level.WorldGenLevel world, int flag) -
placeFirst
public boolean placeFirst(net.minecraft.world.level.WorldGenLevel world, int flag) -
place
public boolean place(net.minecraft.world.level.WorldGenLevel world, int index, int flag) -
placeAll
public boolean placeAll(net.minecraft.world.level.WorldGenLevel worldAccess) -
placeLastNDelete
public boolean placeLastNDelete(net.minecraft.world.level.WorldGenLevel world) -
placeNDelete
public boolean placeNDelete(net.minecraft.world.level.WorldGenLevel 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.level.WorldGenLevel 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.level.WorldGenLevel worldAccess) -
placeAllNDelete
public boolean placeAllNDelete(net.minecraft.world.level.WorldGenLevel worldAccess, int flag) -
toJson
public com.google.gson.JsonObject toJson(net.minecraft.world.level.ChunkPos chunkPos) -
toJson
public com.google.gson.JsonObject toJson(net.minecraft.world.level.ChunkPos offset, net.minecraft.world.level.ChunkPos chunkPos) -
addCustomProperty
public void addCustomProperty(com.google.gson.JsonObject json) -
placeJson
public void placeJson(net.minecraft.world.level.ChunkPos chunkPos) -
placeJson
public void placeJson(net.minecraft.world.level.WorldGenLevel world, net.minecraft.world.level.ChunkPos offset, net.minecraft.world.level.ChunkPos chunkPos) -
init
public void init(net.minecraft.world.level.WorldGenLevel world)
-