Class CircleGen
java.lang.Object
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
net.rodofire.easierworldcreator.shape.block.gen.CircleGen
Class to generate circle 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRadiusX(int radiusX) method to add the radius of the circlevoidaddRadiusY(int radiusZ) method to add the radius of the circlevoidmethod to create an empty oval with rotationsvoidmethod to create a full oval/ with custom fillingintmethod to get the radius of the circleintmethod to get the radius of the circleMap<net.minecraft.util.math.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> method to get all the pos of the circlevoidsetRadiusX(int radiusX) method to set the radius of the circlevoidsetRadiusZ(int radiusZ) method to set the radius of the circleMethods 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
-
CircleGen
public CircleGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator, int radiusX, int radiusZ) init the Circle Shape- Parameters:
pos- the center of the spiralradiusX- the radius of the x-axisradiusZ- the radius of the z-axis
-
CircleGen
public CircleGen(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, int radius) init a circle generator- Parameters:
pos- the center of the spiralradius- the radius of the x-axis
-
-
Method Details
-
getRadiusX
public int getRadiusX()method to get the radius of the circle- Returns:
- the radius of the circle on the x-axis
-
setRadiusX
public void setRadiusX(int radiusX) method to set the radius of the circle- Parameters:
radiusX- the radius that will be set on the x-axis
-
getRadiusZ
public int getRadiusZ()method to get the radius of the circle- Returns:
- the radius of the circle on the z-axis
-
setRadiusZ
public void setRadiusZ(int radiusZ) method to set the radius of the circle- Parameters:
radiusZ- the radius that will be set on the z-axis
-
addRadiusX
public void addRadiusX(int radiusX) method to add the radius of the circle- Parameters:
radiusX- the radius that will be added on the x-axis
-
addRadiusY
public void addRadiusY(int radiusZ) method to add the radius of the circle- Parameters:
radiusZ- the radius that will be added on the z-axis
-
getShapeCoordinates
public Map<net.minecraft.util.math.ChunkPos,it.unimi.dsi.fastutil.longs.LongOpenHashSet> getShapeCoordinates()method to get all the pos of the circle- Specified by:
getShapeCoordinatesin classAbstractBlockShape- Returns:
- the blockPos of the circle. The List is divided into chunkPos, allowing for parallel modification
-
generateFullOval
public void generateFullOval()method to create a full oval/ with custom filling -
generateEmptyOval
public void generateEmptyOval()method to create an empty oval with rotations
-