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

public abstract class AbstractFillableBlockShape extends AbstractBlockShape
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 Map<ChunkPos, LongOpenHashSet>.

It emply some things:

  • The coordinates are divided in chunk
  • It uses LongOpenHashSet for 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 BlockPos are saved under long using LongPosHelper. It saves some memory since that we save four bytes of data for each BlockPos, 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 into LongOpenHashSetis extremely faster compared to only adding a BlockPos. ~60- 70% facter.

Dividing Coordinates into Chunk has some advantages :

  • Field Details

  • 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

      public void setFillingType(AbstractFillableBlockShape.Type fillingType)
      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