Class Shape
- Direct Known Subclasses:
FillableShape,LineGen,SpiralGen
Since 2.1.0, the shape doesn't return a List<net.minecraft.util.math.BlockPos> but it returns instead a List<Set<BlockPos>>
Before 2.1.0, the BlockPos list was a simple list.
Starting from 2.1.0, the shapes returns a list of ChunkPos that has a set of BlockPos
The change from List to Set was done to avoid duplicates BlockPos wich resulted in unnecessary calculations.
this allow easy multithreading for the Block assignment done in the Shape which result in better performance;
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumset how the blocks/particles will be chosen inside a layerstatic enumchange how the blocks are putstatic enumstatic enumset the type of objects that will be placed -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionShape(@NotNull net.minecraft.world.StructureWorldAccess world, @NotNull net.minecraft.util.math.BlockPos pos, @NotNull Shape.PlaceMoment placeMoment) init the shape genShape(@NotNull net.minecraft.world.StructureWorldAccess world, @NotNull net.minecraft.util.math.BlockPos pos, @NotNull Shape.PlaceMoment placeMoment, List<BlockLayer> layers, boolean force, List<net.minecraft.block.Block> blocksToForce, int xrotation, int yrotation, int secondxrotation) init the shape gen -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockLayer(BlockLayer blockLayer) voidaddBlockLayers(List<BlockLayer> blockLayers) voidaddBlocksToForce(List<net.minecraft.block.Block> blocks) voidaddBlocksToForce(net.minecraft.block.Block block) voidaddPosOffset(net.minecraft.util.math.BlockPos pos1) voidaddSecondxrotation(int secondxrotation) voidaddXrotation(int xrotation) voidaddYrotation(int yrotation) getBlockLayer(int index) List<net.minecraft.block.Block> net.minecraft.block.BlockStategetBlockToPlace(int index, net.minecraft.util.math.BlockPos pos) net.minecraft.block.BlockStategetBlockToPlace(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) net.minecraft.util.math.BlockPosgetCoordinatesRotation(float x, float y, float z, net.minecraft.util.math.BlockPos pos) net.minecraft.util.math.BlockPosgetCoordinatesRotation(net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.BlockPos centerPos) List<net.minecraft.util.math.BlockPos> getCoordinatesRotationList(List<net.minecraft.util.math.Vec3d> poslist, net.minecraft.util.math.BlockPos centerPos) getCylindricalBlocks(Set<net.minecraft.util.math.BlockPos> posList) Set<net.minecraft.util.math.BlockPos> getFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist) this is basically the same as previous except that it can't verify if it can place the Block.booleangetForce()voidgetGenTime(long startTime, boolean place) place the layers of the structure starting from the first layer to the second to the thirdgetNoise()net.minecraft.util.math.BlockPosgetPos()getRadialBlocks(Set<net.minecraft.util.math.BlockPos> posList) voidgetRotations(int xrotation, int yrotation, int secondxrotation) intabstract List<net.minecraft.util.math.Vec3d> getVec3d()net.minecraft.world.StructureWorldAccessgetWorld()intintvoidplace()voidThis method is the method to place the related BlocksvoidplaceBlocks(int index, net.minecraft.util.math.BlockPos pos) voidplaceBlocks(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) booleanplaceBlocksWithVerification(int index, net.minecraft.util.math.BlockPos pos) place a block in the world at the pos if it is able tobooleanplaceBlocksWithVerification(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) place a block in the world at the pos if it is able to precomputed list for little performance improvementvoidplaceCylindricalBlocks(Set<net.minecraft.util.math.BlockPos> posList) Set<net.minecraft.util.math.BlockPos> placeFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist) This method returns a temporary blockPos list of the first layer after verification.voidplaceLayers(Set<net.minecraft.util.math.BlockPos> firstposlist) place the layers of the structure depending on theShape.LayersTypevoidplaceRadialBlocks(Set<net.minecraft.util.math.BlockPos> posList) placeSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> poslist, int layerIndex) This method is used to determine and place the layers of the structurevoidremoveBlockLayer(int index) voidremoveBlockLayer(List<BlockLayer> blockLayers) voidremoveBlockLayer(BlockLayer blockLayer) voidsetBlockLayers(List<BlockLayer> blockLayers) voidsetBlockLayers(BlockLayer... layers) voidsetBlocksToForce(List<net.minecraft.block.Block> blocksToForce) voidsetForce(boolean force) voidsetLayerDirection(net.minecraft.util.math.Vec3d vect) voidsetLayerPlace(Shape.LayerPlace layerPlace) voidsetLayersType(Shape.LayersType layersType) voidsetNoise(FastNoiseLite noise) voidsetPlaceMoment(Shape.PlaceMoment placeMoment) voidsetPlaceType(Shape.PlaceType placeType) voidsetPos(net.minecraft.util.math.BlockPos pos) voidsetSecondxrotation(int secondxrotation) voidsetXrotation(int xrotation) voidsetYrotation(int yrotation) booleanverifyBlocks(net.minecraft.util.math.BlockPos pos)
-
Field Details
-
biggerThanChunk
protected boolean biggerThanChunk
-
-
Constructor Details
-
Shape
public Shape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull Shape.PlaceMoment placeMoment, List<BlockLayer> layers, boolean force, List<net.minecraft.block.Block> blocksToForce, int xrotation, int yrotation, int secondxrotation) init the shape gen- Parameters:
world- the world the shape will be generatedpos- the pos of the structure center -------------------------------------------------------------------------------------layers- a list of layers that will be placed by the structureforce- force the blockPos if true (be careful if true, your structure will replace every block, you might destruct some constructions if it is bad used)blocksToForce- list of blocks that the structure can still replace if @param force = false
-
Shape
public Shape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull Shape.PlaceMoment placeMoment) init the shape gen- Parameters:
world- the world the shape will be generatedpos- the pos of the structure center
-
-
Method Details
-
getRotations
public void getRotations(int xrotation, int yrotation, int secondxrotation) -
getLayersType
-
setLayersType
-
setLayerDirection
public void setLayerDirection(net.minecraft.util.math.Vec3d vect) -
getForce
public boolean getForce() -
setForce
public void setForce(boolean force) -
setLayerPlace
-
getLayerPlace
-
getBlocksToForce
-
setBlocksToForce
-
addBlocksToForce
public void addBlocksToForce(net.minecraft.block.Block block) -
addBlocksToForce
-
getXrotation
public int getXrotation() -
setXrotation
public void setXrotation(int xrotation) -
getYrotation
public int getYrotation() -
setYrotation
public void setYrotation(int yrotation) -
getSecondXrotation
public int getSecondXrotation() -
setSecondxrotation
public void setSecondxrotation(int secondxrotation) -
addXrotation
public void addXrotation(int xrotation) -
addYrotation
public void addYrotation(int yrotation) -
addSecondxrotation
public void addSecondxrotation(int secondxrotation) -
getPos
public net.minecraft.util.math.BlockPos getPos() -
setPos
public void setPos(net.minecraft.util.math.BlockPos pos) -
addPosOffset
public void addPosOffset(net.minecraft.util.math.BlockPos pos1) -
getWorld
public net.minecraft.world.StructureWorldAccess getWorld() -
addBlockLayers
-
addBlockLayer
-
removeBlockLayer
-
removeBlockLayer
-
removeBlockLayer
public void removeBlockLayer(int index) -
getBlockLayers
-
setBlockLayers
-
setBlockLayers
-
getBlockLayer
-
setNoise
-
getNoise
-
setPlaceType
-
getPlaceType
-
getPlaceMoment
-
setPlaceMoment
-
place
- Throws:
IOException
-
place
This method is the method to place the related Blocks- Parameters:
posList- theListofSetofBlockPoscalculated before, that will be placed- Throws:
IOException
-
getBlockPos
-
getVec3d
-
getLayers
place the layers of the structure starting from the first layer to the second to the third- Parameters:
firstposlist- list of BlockPos of the structure
-
placeLayers
place the layers of the structure depending on theShape.LayersType- Parameters:
firstposlist- list of BlockPos of the structure
-
placeFirstSurfaceBlockLayers
public Set<net.minecraft.util.math.BlockPos> placeFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist) This method returns a temporary blockPos list of the first layer after verification. The first layer will the be placed inplaceSurfaceBlockLayers(Set, int)- Parameters:
firstposlist- the list of BlockPos to verify at first- Returns:
- the list of verified BlockPos
-
placeSurfaceBlockLayers
public List<Set<net.minecraft.util.math.BlockPos>> placeSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> poslist, int layerIndex) This method is used to determine and place the layers of the structure
It determines for every
BlockPosprovided if the pos can be replaced by the new Layer.To determine it, it gets the depth of the previous layer. It verifies if there is in the
Listthe actualBlockPoswith an offset of the depth-if there is, it adds the
BlockPosin a newListand remove theBlockPosfrom the existing list.-If not, it does nothing.
- Parameters:
poslist- the list ofBlockPosof the precedent LayerlayerIndex- the index to get the depth- Returns:
- two
List. One corresponding to the finalList<BlockPos>of the previous layer. The other one, the rest of theList<BlockPos>of the structure that will be used by the next iteration.
-
placeCylindricalBlocks
-
placeRadialBlocks
-
getFirstSurfaceBlockLayers
public Set<net.minecraft.util.math.BlockPos> getFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist) this is basically the same as previous except that it can't verify if it can place the Block.- Parameters:
firstposlist- the firstList- Returns:
-
getCylindricalBlocks
-
getRadialBlocks
-
getCoordinatesRotation
public net.minecraft.util.math.BlockPos getCoordinatesRotation(net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.BlockPos centerPos) -
getCoordinatesRotation
public net.minecraft.util.math.BlockPos getCoordinatesRotation(float x, float y, float z, net.minecraft.util.math.BlockPos pos) -
getCoordinatesRotationList
-
getGenTime
public void getGenTime(long startTime, boolean place) -
placeBlocks
public void placeBlocks(int index, net.minecraft.util.math.BlockPos pos) -
placeBlocks
public void placeBlocks(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) -
placeBlocksWithVerification
public boolean placeBlocksWithVerification(int index, net.minecraft.util.math.BlockPos pos) place a block in the world at the pos if it is able to- Parameters:
index- the index of the theBlockLayerpos- the pos of the block- Returns:
- boolean if the block was placed
-
placeBlocksWithVerification
public boolean placeBlocksWithVerification(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) place a block in the world at the pos if it is able to precomputed list for little performance improvement- Parameters:
states- the states that will be choosedpos- the pos of the block- Returns:
- boolean if the block was placed
-
getBlockToPlace
public net.minecraft.block.BlockState getBlockToPlace(int index, net.minecraft.util.math.BlockPos pos) -
getBlockToPlace
public net.minecraft.block.BlockState getBlockToPlace(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos) -
verifyBlocks
public boolean verifyBlocks(net.minecraft.util.math.BlockPos pos)
-