Class AbstractFillableBlockShape
java.lang.Object
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
net.rodofire.easierworldcreator.shape.block.instanciator.AbstractFillableBlockShape
- Direct Known Subclasses:
CircleGen,CylinderGen,SphereGen,TorusGen
class to change the filling of the structure
since that all structure may not need or can't have a custom filling like the line generation, it is not implemented in the ShapeGen class
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
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
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 how the structure is filled -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatif ==0, there will be no circle if ==1f, it will be a full circle Don't need to care ifAbstractFillableBlockShapeis not set on CUSTOMprotected AbstractFillableBlockShape.Typeset the default filling typeFields inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
centerPos, centerX, centerY, centerZ, chunkMap, covered, lastChunkX, lastChunkZ, rotator -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFillableBlockShape(@NotNull net.minecraft.util.math.BlockPos pos) init the ShapeFillingAbstractFillableBlockShape(@NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator) init the ShapeFilling -
Method Summary
Modifier and TypeMethodDescriptionvoidsetCustomFill(float customFill) method to set the custom fillprotected voidsetFill()method to set the custom fill set the filling value depending on the filling typevoidsetFillingType(AbstractFillableBlockShape.Type fillingType) method to change the filling TypeMethods inherited from class net.rodofire.easierworldcreator.shape.block.instanciator.AbstractBlockShape
getCoveredChunks, getShapeCoordinates, modifyChunkMap, setRotator, shouldAddChunk, shouldAddChunkPrecomputedX
-
Field Details
-
customFill
protected float customFillif ==0, there will be no circle if ==1f, it will be a full circle Don't need to care ifAbstractFillableBlockShapeis not set on CUSTOM -
fillingType
set the default filling type
-
-
Constructor Details
-
AbstractFillableBlockShape
public AbstractFillableBlockShape(@NotNull @NotNull net.minecraft.util.math.BlockPos pos) init the ShapeFilling- Parameters:
pos- the center of the spiral
-
AbstractFillableBlockShape
public AbstractFillableBlockShape(@NotNull @NotNull net.minecraft.util.math.BlockPos pos, Rotator rotator) init the ShapeFilling- Parameters:
pos- the pos of the shape (usually the center of the structure)rotator- the object that is used to rotate the structure
-
-
Method Details
-
setFillingType
method to change the filling Type- Parameters:
fillingType- change the fillingType
-
setCustomFill
public void setCustomFill(float customFill) method to set the custom fill- Parameters:
customFill- change the custom fill used to change the percentage of the radius that will be filled
-
setFill
protected void setFill()method to set the custom fill set the filling value depending on the filling type
-