Direct Known Subclasses:
DefaultShapeGen, FillableShape, LineGen, SpiralGen

public abstract class Shape extends ShapeRotation
Class to create custom 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 Shape which result in better performance;

  • Constructor Details

    • Shape

      public Shape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull ShapeBase.PlaceMoment placeMoment, ShapePlaceType.LayerPlace layerPlace, ShapeLayer.LayersType layersType, int yRotation, int zRotation, int secondYRotation, String featureName)
      init the 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
    • Shape

      public Shape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull ShapeBase.PlaceMoment placeMoment)
      init the Shape
      Parameters:
      world - the world of the shape
      pos - the pos of the shape (usually the center of the structure)
      placeMoment - define the moment where the shape will be placed
  • Method Details

    • place

      public void place() throws IOException
      This method allows you to place the structure in the world. Any changes done after this moment will not be taken in count except if you place another shape later
      Throws:
      IOException
    • place

      public void place(List<Set<net.minecraft.util.math.BlockPos>> posList) throws IOException
      This method is the method to place the related Blocks
      Parameters:
      posList - the List of Set of BlockPos calculated before, that will be placed
      Throws:
      IOException
    • placeWBlockList

      public void placeWBlockList(List<Set<BlockList>> posList) throws IOException
      Throws:
      IOException
    • getBlockPos

      public abstract List<Set<net.minecraft.util.math.BlockPos>> getBlockPos()
      method to get the coordinates that will be placed later
      Returns:
      a list of blockPos for every shape
    • getVec3d

      public abstract List<net.minecraft.util.math.Vec3d> getVec3d()
      method to get the Vec3d that will be placed later
      Returns:
      a list of Vec3d for every shape
    • getChunkCovered

      protected Set<net.minecraft.util.math.ChunkPos> getChunkCovered(net.minecraft.util.math.BlockPos pos, List<net.minecraft.util.math.ChunkPos> chunks)
      Method to get a chunk list to know if the structure can be placed during worldGen;
      Parameters:
      pos - the center pos