Direct Known Subclasses:
AbstractFillableBlockShape, DefaultBlockShapeGen, LineGen, SpiralGen

public abstract class AbstractBlockShape extends AbstractBlockShapeRotation
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 allows easy multithreading for the Block assignment done in the AbstractBlockShape which result in better performance;

  • Constructor Details

    • AbstractBlockShape

      public AbstractBlockShape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull AbstractBlockShapeBase.PlaceMoment placeMoment, AbstractBlockShapePlaceType.LayerPlace layerPlace, AbstractBlockShapeLayer.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
    • AbstractBlockShape

      public AbstractBlockShape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull AbstractBlockShapeBase.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

    • getAnimator

      public StructurePlaceAnimator getAnimator()
    • setAnimator

      public void setAnimator(StructurePlaceAnimator animator)
      Method to set the animator. It is required when PlaceMoment is defined on ANIMATED_OTHER
      Parameters:
      animator - the animator that will be played
    • getFeatureName

      public String getFeatureName()
    • setFeatureName

      public void setFeatureName(String featureName)

      Method to set a custom name for the structure.

      It is optional.

      If no name is provided, one random name will be generated.

      It allows better readibility in the generated files

      Parameters:
      featureName - the name of the structure
    • getOffset

      public net.minecraft.util.math.BlockPos getOffset()
    • setOffset

      public void setOffset(net.minecraft.util.math.BlockPos offset)
      method to set an offset
      Parameters:
      offset - the offset of the entire structure
    • place

      public void place()
      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
    • place

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

      public void placeWBlockList(List<Set<DefaultBlockList>> 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
    • getBlockListWithVerification

      public List<Set<DefaultBlockList>> getBlockListWithVerification(List<Set<net.minecraft.util.math.BlockPos>> posList)
    • 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