public class TorusGen extends AbstractFillableBlockShape
Class to generate Torus related shapes

Since 2.1.0, the shape doesn't return a List<net.minecraft.util.math.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

    • TorusGen

      public TorusGen(@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, int innerRadiusX, int outerRadiusX, int innerRadiusZ, int outerRadiusZ)
      init the Torus 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
      innerRadiusX - the radius of the inner circle on the x-axis
      outerRadiusX - the radius of the outer circle on the x-axis
      innerRadiusZ - the radius of the inner circle on the z-axis
      outerRadiusZ - the radius of the outer circle on the z-axis
    • TorusGen

      public TorusGen(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, AbstractBlockShapeBase.PlaceMoment placeMoment, int innerRadius, int outerRadius)
      init the Torus 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
      innerRadius - the radius of the inner circle
      outerRadius - 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

      public TorusGen.TorusType 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.TorusType of the torus.
    • setTorusType

      public void setTorusType(TorusGen.TorusType torusType)
      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 - the TorusGen.TorusType to 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.
    • getBlockPos

      public Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> getBlockPos()
      Method to get all the BlockPos needed to place the shape
      Specified by:
      getBlockPos in class AbstractBlockShape
      Returns:
      a list that contain divided BlockPos depending in the chunkPos
    • generateFullTore

      public void generateFullTore(Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      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(Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      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 net.minecraft.util.math.Vec3d getEllipsoidalToreCoordinates(int u, int v)
    • getInnerRadius

      public double getInnerRadius(int angle)
    • getOuterRadius

      public double getOuterRadius(int angle)