public class CircleGen extends AbstractFillableBlockShape
Class to generate Circle 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 returns 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

    • CircleGen

      public CircleGen(@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 radiusX, int radiusZ)
      init the Circle 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 of the x-axis
      radiusZ - the radius of the z-axis
    • CircleGen

      public CircleGen(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, AbstractBlockShapeBase.PlaceMoment placeMoment, int radius)
      init a circle generator
      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 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
    • getBlockPos

      public List<Set<net.minecraft.util.math.BlockPos>> getBlockPos()
      method to get all the pos of the circle
      Specified by:
      getBlockPos in class AbstractBlockShape
      Returns:
      the blockPos of the circle. The List is divided into chunkPos, allowing for parallel modification
    • generateFullOval

      public List<Set<net.minecraft.util.math.BlockPos>> generateFullOval()
      method to create a full oval/ with custom filling
      Returns:
      List<Set<BlockPos>> : set of BlockPos divided into a list of chunks
    • generateEmptyOval

      public List<Set<net.minecraft.util.math.BlockPos>> generateEmptyOval()
      method to create an empty oval with rotations
      Returns:
      List<Set<BlockPos>> : set of BlockPos divided into a list of chunks
    • generateEmptyOval

      public List<Set<net.minecraft.util.math.BlockPos>> generateEmptyOval(int centerX, int centerZ, int y)
      This class is used when no rotation is present. This allows fast coordinates generation but doesn't work with rotations
      Parameters:
      centerX - the x coordinate of the center of the circle
      centerZ - the z coordinate of the center of the circle
      y - the height of the circle
      Returns:
      a list of chunk represented by a set of BlockPos
    • addOvalBlocks

      public void addOvalBlocks(int centerX, int centerZ, int x, int y, int z, Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      Adds block positions to the chunkMap based on the given coordinates.
      Parameters:
      centerX - The x-coordinate of the center of the oval
      centerZ - The z-coordinate of the center of the oval
      x - The x-coordinate in the context of the Bresenham algorithm
      y - The height of the oval
      z - The z-coordinate in the context of the Bresenham algorithm
      chunkMap - The map of chunks with the block positions
    • placeFullOval

      public void placeFullOval(int centerX, int centerZ, int x, int y, int z, Map<net.minecraft.util.math.ChunkPos,Set<net.minecraft.util.math.BlockPos>> chunkMap)
      Fills in the lines between the blocks for a complete oval.
      Parameters:
      centerX - The x-coordinate of the center of the oval
      centerZ - The z-coordinate of the center of the oval
      x - The x-coordinate in the context of the Bresenham algorithm
      y - The height of the oval
      z - The z-coordinate in the context of the Bresenham algorithm
      chunkMap - The map of chunks with the block positions