Class CylinderGen
java.lang.Object
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
net.rodofire.easierworldcreator.shape.block.gen.CylinderGen
Class to generate cylinder related shapes
The Main purpose of this class is to generate the coordinates based on a shape. The coordinates are organized depending on a
The Main purpose of this class is to generate the coordinates based on a shape. The coordinates are organized depending on a
Map<ChunkPos, LongOpenHashSet>.
It emply some things:
- The coordinates are divided in chunk
- It uses
LongOpenHashSetfor several reasons.- First, We use a set to avoid doing unnecessary calculations on the shape. It ensures that no duplicate is present.
- Second, it compresses the BlockPos: The
BlockPosare saved under long usingLongPosHelper. It saves some memory since that we save four bytes of data for eachBlockPos, and there should not have overhead since that we use primitive data type. - Third, since that we use primitive data types and that they take less memory,
coordinate generation, accession or deletion is much faster than using a
Set<BlockPos>. Encoding and decoding blockPos and then adding it intoLongOpenHashSetis extremely faster compared to only adding aBlockPos. ~60- 70% facter.
Dividing Coordinates into Chunk has some advantages :
- allow a multithreaded block assignement when using
LayerManager - allow to be used during WG, when using
DividedBlockListManageror when placing usingShapePlacer
-
Nested Class Summary
Nested classes/interfaces inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
AbstractFillableBlockShape.Type -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCylinderGen(@NotNull net.minecraft.util.math.BlockPos pos, int radius, int height) init a cylinder objectCylinderGen(@NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator, int radiusX, int radiusZ, int height) init a Cylinder object -
Method Summary
Modifier and TypeMethodDescriptionvoidthis generates a full cylinder.voidthis generates a full cylinderintGets the height of the cylinder.intGets the radius of the cylinder along the X-axis.intGets the radius of the cylinder along the Z-axis.Map<net.minecraft.util.math.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> Method to get the BlockPos of the shapevoidsetHeight(int height) Sets the height of the cylinder.voidsetRadiusX(int radius) Sets the radius of the cylinder along the X-axis.voidsetRadiusZ(int radius) Sets the radius of the cylinder along the Z-axis.Methods inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
getCustomFill, getFillingType, setCustomFill, setFill, setFillingTypeMethods inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
modifyChunkMap, setRotator
-
Constructor Details
-
CylinderGen
public CylinderGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator, int radiusX, int radiusZ, int height) init a Cylinder object- Parameters:
pos- the center of the spiralradiusX- the radius of the cylinder on the x-axisradiusZ- the radius of the cylinder on the z-axisheight- the height of the cylinder
-
CylinderGen
public CylinderGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, int radius, int height) init a cylinder object- Parameters:
pos- the center of the spiralradius- the radius of the cylinderheight- the height of the cylinder
-
-
Method Details
-
setHeight
public void setHeight(int height) Sets the height of the cylinder.The height defines the vertical size of the cylinder.
- Parameters:
height- the height of the cylinder, in units.
-
getHeight
public int getHeight()Gets the height of the cylinder.The height represents the vertical size of the cylinder.
- Returns:
- the height of the cylinder, in units.
-
setRadiusX
public void setRadiusX(int radius) Sets the radius of the cylinder along the X-axis.The radius along the X-axis determines the horizontal size of the cylinder in the X direction.
- Parameters:
radius- the radius of the cylinder along the X-axis, in units.
-
getRadiusX
public int getRadiusX()Gets the radius of the cylinder along the X-axis.The radius along the X-axis determines the horizontal size of the cylinder in the X direction.
- Returns:
- the radius of the cylinder along the X-axis, in units.
-
setRadiusZ
public void setRadiusZ(int radius) Sets the radius of the cylinder along the Z-axis.The radius along the Z-axis determines the horizontal size of the cylinder in the Z direction.
- Parameters:
radius- the radius of the cylinder along the Z-axis, in units.
-
getRadiusZ
public int getRadiusZ()Gets the radius of the cylinder along the Z-axis.The radius along the Z-axis determines the horizontal size of the cylinder in the Z direction.
- Returns:
- the radius of the cylinder along the Z-axis, in units.
-
getShapeCoordinates
public Map<net.minecraft.util.math.ChunkPos,it.unimi.dsi.fastutil.longs.LongOpenHashSet> getShapeCoordinates()Method to get the BlockPos of the shape- Specified by:
getShapeCoordinatesin classAbstractBlockShape- Returns:
- the blockPos divided into chunkPos
-
generateFullCylinder
public void generateFullCylinder()this generates a full cylinder -
generateEmptyCylinder
public void generateEmptyCylinder()this generates a full cylinder.
-