public class SpiralGen extends AbstractBlockShape
Class to generate Spiral related shapes

Since 2.1.0, the shape doesn't return a List<BlockPos> but it returns instead a List<Set<BlockPos>>

Before 2.1.0, the BlockPos list was a simple list.

Starting from 2.1.0, the shapes return a list of ChunkPos that has a set of BlockPos

The change from List to Set was done to avoid duplicates BlockPos which resulted in unnecessary calculations.

this allow easy multithreading for the Block assignment done in the AbstractBlockShape which result in better performance;

  • Constructor Details

    • SpiralGen

      public SpiralGen(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, AbstractBlockShapeBase.PlaceMoment placeMoment, AbstractBlockShapePlaceType.LayerPlace layerPlace, AbstractBlockShapeLayer.LayersType layersType, int yRotation, int zRotation, int secondYRotation, String featureName, net.minecraft.util.Pair<Integer,Integer> radiusX, net.minecraft.util.Pair<Integer,Integer> radiusZ, int height, float turnNumber)
      init the Spiral Shape
      Parameters:
      world - the world the spiral will spawn in
      pos - the center of the spiral
      placeMoment - define the moment where the shape will be placed
      layerPlace - how the @BlockStates inside of a BlockLayer will be placed
      layersType - how the Layers will be placed
      yRotation - first rotation around the y-axis
      zRotation - second rotation around the z-axis
      secondYRotation - last rotation around the y-axis
      featureName - the name of the feature
      radiusX - the radius on the x-axis. The first value corresponding to the radius at the base of the spiral, the second, corresponding to the radius at the top of the spiral
      radiusZ - the radius on the z-axis. The first value corresponding to the radius at the base of the spiral, the second, corresponding to the radius at the top of the spiral
      height - the height of the spiral
      turnNumber - the number of turn that the spiral will do (ex: 1 -> 1 turn, 3.5 -> 3.5 turn)
    • SpiralGen

      public SpiralGen(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, AbstractBlockShapeBase.PlaceMoment placeMoment, int radius, int height)
      Parameters:
      world - the world the spiral will spawn in
      pos - the center of the spiral
      placeMoment - define the moment where the shape will be placed
      radius - the radius of the spiral
      height - the height of the spiral
  • Method Details

    • getOutlineRadiusZ

      public int getOutlineRadiusZ()
    • setOutlineRadiusZ

      public void setOutlineRadiusZ(int outlineRadiusZ)
    • getOutlineRadiusX

      public int getOutlineRadiusX()
    • setOutlineRadiusX

      public void setOutlineRadiusX(int outlineRadiusX)
    • getSpiralFilling

      public float getSpiralFilling()
    • setSpiralFilling

      public void setSpiralFilling(float spiralFilling)
    • getSpiralType

      public SpiralGen.SpiralType getSpiralType()
    • setSpiralType

      public void setSpiralType(SpiralGen.SpiralType spiralType)
    • getHeight

      public int getHeight()
    • setHeight

      public void setHeight(int height)
    • getRadiusZ

      public net.minecraft.util.Pair<Integer,Integer> getRadiusZ()
    • getStartRadiusZ

      public int getStartRadiusZ()
    • getStartRadiusX

      public int getStartRadiusX()
    • getEndRadiusZ

      public int getEndRadiusZ()
    • getEndRadiusX

      public int getEndRadiusX()
    • setRadiusZ

      public void setRadiusZ(net.minecraft.util.Pair<Integer,Integer> radiusZ)
    • getRadiusX

      public net.minecraft.util.Pair<Integer,Integer> getRadiusX()
    • setRadiusX

      public void setRadiusX(net.minecraft.util.Pair<Integer,Integer> radiusX)
    • setEndRadiusX

      public void setEndRadiusX(int endRadiusX)
    • setEndRadiusZ

      public void setEndRadiusZ(int endRadiusZ)
    • setStartRadiusX

      public void setStartRadiusX(int startRadiusX)
    • setStartRadiusZ

      public void setStartRadiusZ(int startRadiusZ)
    • getTurnNumber

      public float getTurnNumber()
    • setTurnNumber

      public void setTurnNumber(float turnNumber)
    • getSpiralOffset

      public int getSpiralOffset()
    • setSpiralOffset

      public void setSpiralOffset(int spiralOffset)
      Parameters:
      spiralOffset - the offset of the start of the spiral
    • getHelicoidAngle

      public net.minecraft.util.Pair<Integer,Integer> getHelicoidAngle()
    • setHelicoidAngle

      public void setHelicoidAngle(net.minecraft.util.Pair<Integer,Integer> helicoidAngle)
      Parameters:
      helicoidAngle - the start and the end angle of the blocks on the side
    • getBlockPos

      public Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> getBlockPos()
      Description copied from class: AbstractBlockShape
      method to get the coordinates that will be placed later
      Specified by:
      getBlockPos in class AbstractBlockShape
      Returns:
      a map of ChunkPos of blockPos for every shape
    • generateEllipsoidSpiral

      public void generateEllipsoidSpiral(net.minecraft.util.math.BlockPos pos, Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      generates a simple spiral
      Parameters:
      pos - the center of the spiral. This can be changed to match certain needing like when generating a large outline
    • generateLargeOutlineSpiral

      public void generateLargeOutlineSpiral(Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      this allows the generation of a large outline spiral.
    • generateHelicoid

      public void generateHelicoid(Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      generates a helicoid if the SpiralGen.SpiralType is set to HELICOID or DOUBLE_HELICOID with their variants
    • getXRadius

      public float getXRadius(float percentage)
      this method returns the xRadius depending on the height we are at
      Parameters:
      percentage - the percentage of the height we are at
      Returns:
      the x radius of the spiral
    • getZRadius

      public float getZRadius(float percentage)
      this method returns the zRadius depending on the height we are at
      Parameters:
      percentage - the percentage of the height we are at
      Returns:
      the x radius of the spiral
    • getAngle

      public int getAngle(float percentage)
      this method returns the helicoïdAngle depending on the height we are at
      Parameters:
      percentage - the percentage of the height we are at
      Returns:
      the angle of the spiral