Class CircleGen


public class CircleGen extends FillableShape
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 Shape 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, ShapeBase.PlaceMoment placeMoment, ShapePlaceType.LayerPlace layerPlace, ShapeLayer.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, ShapeBase.PlaceMoment placeMoment, int radius)
      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()
    • setRadiusX

      public void setRadiusX(int radiusX)
    • getRadiusZ

      public int getRadiusZ()
    • setRadiusZ

      public void setRadiusZ(int radiusZ)
    • addRadiusX

      public void addRadiusX(int radiusX)
    • addRadiusY

      public void addRadiusY(int radiusY)
    • getBlockPos

      public List<Set<net.minecraft.util.math.BlockPos>> getBlockPos()
      Description copied from class: Shape
      method to get the coordinates that will be placed later
      Specified by:
      getBlockPos in class Shape
      Returns:
      a list of blockPos for every shape
    • getVec3d

      public List<net.minecraft.util.math.Vec3d> getVec3d()
      Description copied from class: Shape
      method to get the Vec3d that will be placed later
      Specified by:
      getVec3d in class Shape
      Returns:
      a list of Vec3d for every shape
    • 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