Class TorusGen
java.lang.Object
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
net.rodofire.easierworldcreator.shape.block.gen.TorusGen
Class to generate torus 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 ClassesModifier and TypeClassDescriptionstatic enumchange the outside filling of the torus it is different from the Filling Type the torus type changes the exterior filling while the other one change the interior filling typeNested classes/interfaces inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
AbstractFillableBlockShape.Type -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTorusGen(@NotNull net.minecraft.util.math.BlockPos pos, int innerRadius, int outerRadius) init the Torus ShapeTorusGen(@NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator, int innerRadiusX, int outerRadiusX, int innerRadiusZ, int outerRadiusZ) init the Torus Shape -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerates an empty torus the shape with the torus might be different from the full one if you're using custom torus fillingvoidgenerates a full torus / tore with custom filling the shape with the torus might be different from the empty one if you're using custom torus fillingfloat[]getEllipsoidalToreCoordinates(int u, int v) floatGets the horizontal torus ratio.doublegetInnerRadius(float angle) intGets the inner radius of the torus along the X-axis.intGets the inner radius of the torus along the Z-axis.doublegetOuterRadius(float angle) intGets the outer radius of the torus along the X-axis.intGets the outer radius of the torus along the Z-axis.Map<net.minecraft.util.math.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> Method to get all the BlockPos needed to place the shapeGets the type of the torus.floatGets the vertical torus ratio.voidsetHorizontalTorus(float horizontalTorus) Sets the horizontal torus ratio.voidsetInnerRadiusX(int innerRadiusX) Sets the inner radius of the torus along the X-axis.voidsetInnerRadiusZ(int innerRadiusZ) Sets the inner radius of the torus along the Z-axis.voidsetOuterRadiusX(int outerRadiusX) Sets the outer radius of the torus along the X-axis.voidsetOuterRadiusZ(int outerRadiusZ) Sets the outer radius of the torus along the Z-axis.voidsetTorusType(TorusGen.TorusType torusType) Sets the type of the torus.voidsetVerticalTorus(float verticalTorus) Sets the vertical torus ratio.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
-
TorusGen
public TorusGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator, int innerRadiusX, int outerRadiusX, int innerRadiusZ, int outerRadiusZ) init the Torus Shape- Parameters:
pos- the center of the spiralinnerRadiusX- the radius of the inner circle on the x-axisouterRadiusX- the radius of the outer circle on the x-axisinnerRadiusZ- the radius of the inner circle on the z-axisouterRadiusZ- the radius of the outer circle on the z-axis
-
TorusGen
public TorusGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, int innerRadius, int outerRadius) init the Torus Shape- Parameters:
pos- the center of the spiralinnerRadius- the radius of the inner circleouterRadius- the radius of the outer circle
-
-
Method Details
-
getInnerRadiusX
public int getInnerRadiusX()Gets the inner radius of the torus along the X-axis.- Returns:
- the inner radius along the X-axis.
-
setInnerRadiusX
public void setInnerRadiusX(int innerRadiusX) Sets the inner radius of the torus along the X-axis.- Parameters:
innerRadiusX- the inner radius to set along the X-axis.
-
getOuterRadiusX
public int getOuterRadiusX()Gets the outer radius of the torus along the X-axis.- Returns:
- the outer radius along the X-axis.
-
setOuterRadiusX
public void setOuterRadiusX(int outerRadiusX) Sets the outer radius of the torus along the X-axis.- Parameters:
outerRadiusX- the outer radius to set along the X-axis.
-
getInnerRadiusZ
public int getInnerRadiusZ()Gets the inner radius of the torus along the Z-axis.- Returns:
- the inner radius along the Z-axis.
-
setInnerRadiusZ
public void setInnerRadiusZ(int innerRadiusZ) Sets the inner radius of the torus along the Z-axis.- Parameters:
innerRadiusZ- the inner radius to set along the Z-axis.
-
getOuterRadiusZ
public int getOuterRadiusZ()Gets the outer radius of the torus along the Z-axis.- Returns:
- the outer radius along the Z-axis.
-
setOuterRadiusZ
public void setOuterRadiusZ(int outerRadiusZ) Sets the outer radius of the torus along the Z-axis.- Parameters:
outerRadiusZ- the outer radius to set along the Z-axis.
-
getTorusType
Gets the type of the torus.The torus type determines the configuration of the torus, such as whether it is hollow, solid, or has other specific properties.
- Returns:
- the
TorusGen.TorusTypeof the torus.
-
setTorusType
Sets the type of the torus.The torus type determines the configuration of the torus, such as whether it is hollow, solid, or has other specific properties.
- Parameters:
torusType- theTorusGen.TorusTypeto set.
-
getVerticalTorus
public float getVerticalTorus()Gets the vertical torus ratio.The vertical torus determines the percentage of the torus's height relative to its overall dimensions.
- Returns:
- the vertical torus ratio as a float.
-
setVerticalTorus
public void setVerticalTorus(float verticalTorus) Sets the vertical torus ratio.The vertical torus determines the percentage of the torus's height relative to its overall dimensions.
- Parameters:
verticalTorus- the vertical torus ratio to set, as a float.
-
getHorizontalTorus
public float getHorizontalTorus()Gets the horizontal torus ratio.The horizontal torus determines the percentage of the torus's width relative to its overall dimensions.
- Returns:
- the horizontal torus ratio as a float.
-
setHorizontalTorus
public void setHorizontalTorus(float horizontalTorus) Sets the horizontal torus ratio.The horizontal torus determines the percentage of the torus's width relative to its overall dimensions.
- Parameters:
horizontalTorus- the horizontal torus ratio to set, as a float.
-
getShapeCoordinates
public Map<net.minecraft.util.math.ChunkPos,it.unimi.dsi.fastutil.longs.LongOpenHashSet> getShapeCoordinates()Method to get all the BlockPos needed to place the shape- Specified by:
getShapeCoordinatesin classAbstractBlockShape- Returns:
- a list that contain divided BlockPos depending in the chunkPos
-
generateFullTore
public void generateFullTore()generates a full torus / tore with custom filling the shape with the torus might be different from the empty one if you're using custom torus filling -
generateEmptyTore
public void generateEmptyTore()generates an empty torus the shape with the torus might be different from the full one if you're using custom torus filling -
getEllipsoidalToreCoordinates
public float[] getEllipsoidalToreCoordinates(int u, int v) -
getInnerRadius
public double getInnerRadius(float angle) -
getOuterRadius
public double getOuterRadius(float angle)
-