java.lang.Object
net.rodofire.easierworldcreator.shapeutil.Shape
Direct Known Subclasses:
FillableShape, LineGen, SpiralGen

public abstract class Shape extends Object
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 returns a list of ChunkPos that has a set of BlockPos

The change from List to Set was done to avoid duplicates BlockPos wich resulted in unnecessary calculations.

this allow easy multithreading for the Block assignment done in the Shape which result in better performance;

  • Field Details

    • biggerThanChunk

      protected boolean biggerThanChunk
  • Constructor Details

    • Shape

      public Shape(@NotNull @NotNull net.minecraft.world.StructureWorldAccess world, @NotNull @NotNull net.minecraft.util.math.BlockPos pos, @NotNull @NotNull Shape.PlaceMoment placeMoment, List<BlockLayer> layers, boolean force, List<net.minecraft.block.Block> blocksToForce, int xrotation, int yrotation, int secondxrotation)
      init the shape gen
      Parameters:
      world - the world the shape will be generated
      pos - the pos of the structure center -------------------------------------------------------------------------------------
      layers - a list of layers that will be placed by the structure
      force - force the blockPos if true (be careful if true, your structure will replace every block, you might destruct some constructions if it is bad used)
      blocksToForce - list of blocks that the structure can still replace if @param force = false
    • Shape

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

    • getRotations

      public void getRotations(int xrotation, int yrotation, int secondxrotation)
    • getLayersType

      public Shape.LayersType getLayersType()
    • setLayersType

      public void setLayersType(Shape.LayersType layersType)
    • setLayerDirection

      public void setLayerDirection(net.minecraft.util.math.Vec3d vect)
    • getForce

      public boolean getForce()
    • setForce

      public void setForce(boolean force)
    • setLayerPlace

      public void setLayerPlace(Shape.LayerPlace layerPlace)
    • getLayerPlace

      public Shape.LayerPlace getLayerPlace()
    • getBlocksToForce

      public List<net.minecraft.block.Block> getBlocksToForce()
    • setBlocksToForce

      public void setBlocksToForce(List<net.minecraft.block.Block> blocksToForce)
    • addBlocksToForce

      public void addBlocksToForce(net.minecraft.block.Block block)
    • addBlocksToForce

      public void addBlocksToForce(List<net.minecraft.block.Block> blocks)
    • getXrotation

      public int getXrotation()
    • setXrotation

      public void setXrotation(int xrotation)
    • getYrotation

      public int getYrotation()
    • setYrotation

      public void setYrotation(int yrotation)
    • getSecondXrotation

      public int getSecondXrotation()
    • setSecondxrotation

      public void setSecondxrotation(int secondxrotation)
    • addXrotation

      public void addXrotation(int xrotation)
    • addYrotation

      public void addYrotation(int yrotation)
    • addSecondxrotation

      public void addSecondxrotation(int secondxrotation)
    • getPos

      public net.minecraft.util.math.BlockPos getPos()
    • setPos

      public void setPos(net.minecraft.util.math.BlockPos pos)
    • addPosOffset

      public void addPosOffset(net.minecraft.util.math.BlockPos pos1)
    • getWorld

      public net.minecraft.world.StructureWorldAccess getWorld()
    • addBlockLayers

      public void addBlockLayers(List<BlockLayer> blockLayers)
    • addBlockLayer

      public void addBlockLayer(BlockLayer blockLayer)
    • removeBlockLayer

      public void removeBlockLayer(List<BlockLayer> blockLayers)
    • removeBlockLayer

      public void removeBlockLayer(BlockLayer blockLayer)
    • removeBlockLayer

      public void removeBlockLayer(int index)
    • getBlockLayers

      public List<BlockLayer> getBlockLayers()
    • setBlockLayers

      public void setBlockLayers(List<BlockLayer> blockLayers)
    • setBlockLayers

      public void setBlockLayers(BlockLayer... layers)
    • getBlockLayer

      public BlockLayer getBlockLayer(int index)
    • setNoise

      public void setNoise(FastNoiseLite noise)
    • getNoise

      public FastNoiseLite getNoise()
    • setPlaceType

      public void setPlaceType(Shape.PlaceType placeType)
    • getPlaceType

      public Shape.PlaceType getPlaceType()
    • getPlaceMoment

      public Shape.PlaceMoment getPlaceMoment()
    • setPlaceMoment

      public void setPlaceMoment(Shape.PlaceMoment placeMoment)
    • place

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

      public abstract List<Set<net.minecraft.util.math.BlockPos>> getBlockPos()
    • getVec3d

      public abstract List<net.minecraft.util.math.Vec3d> getVec3d()
    • getLayers

      public Set<BlockList> getLayers(Set<net.minecraft.util.math.BlockPos> firstposlist)
      place the layers of the structure starting from the first layer to the second to the third
      Parameters:
      firstposlist - list of BlockPos of the structure
    • placeLayers

      public void placeLayers(Set<net.minecraft.util.math.BlockPos> firstposlist)
      place the layers of the structure depending on the Shape.LayersType
      Parameters:
      firstposlist - list of BlockPos of the structure
    • placeFirstSurfaceBlockLayers

      public Set<net.minecraft.util.math.BlockPos> placeFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist)
      This method returns a temporary blockPos list of the first layer after verification. The first layer will the be placed in placeSurfaceBlockLayers(Set, int)
      Parameters:
      firstposlist - the list of BlockPos to verify at first
      Returns:
      the list of verified BlockPos
    • placeSurfaceBlockLayers

      public List<Set<net.minecraft.util.math.BlockPos>> placeSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> poslist, int layerIndex)

      This method is used to determine and place the layers of the structure

      It determines for every BlockPos provided if the pos can be replaced by the new Layer.

      To determine it, it gets the depth of the previous layer. It verifies if there is in the List the actual BlockPos with an offset of the depth

      -if there is, it adds the BlockPos in a new List and remove the BlockPos from the existing list.

      -If not, it does nothing.

      Parameters:
      poslist - the list of BlockPos of the precedent Layer
      layerIndex - the index to get the depth
      Returns:
      two List. One corresponding to the final List<BlockPos> of the previous layer. The other one, the rest of the List<BlockPos> of the structure that will be used by the next iteration.
    • placeCylindricalBlocks

      public void placeCylindricalBlocks(Set<net.minecraft.util.math.BlockPos> posList)
    • placeRadialBlocks

      public void placeRadialBlocks(Set<net.minecraft.util.math.BlockPos> posList)
    • getFirstSurfaceBlockLayers

      public Set<net.minecraft.util.math.BlockPos> getFirstSurfaceBlockLayers(Set<net.minecraft.util.math.BlockPos> firstposlist)
      this is basically the same as previous except that it can't verify if it can place the Block.
      Parameters:
      firstposlist - the first List
      Returns:
    • getCylindricalBlocks

      public Set<BlockList> getCylindricalBlocks(Set<net.minecraft.util.math.BlockPos> posList)
    • getRadialBlocks

      public Set<BlockList> getRadialBlocks(Set<net.minecraft.util.math.BlockPos> posList)
    • getCoordinatesRotation

      public net.minecraft.util.math.BlockPos getCoordinatesRotation(net.minecraft.util.math.Vec3d pos, net.minecraft.util.math.BlockPos centerPos)
    • getCoordinatesRotation

      public net.minecraft.util.math.BlockPos getCoordinatesRotation(float x, float y, float z, net.minecraft.util.math.BlockPos pos)
    • getCoordinatesRotationList

      public List<net.minecraft.util.math.BlockPos> getCoordinatesRotationList(List<net.minecraft.util.math.Vec3d> poslist, net.minecraft.util.math.BlockPos centerPos)
    • getGenTime

      public void getGenTime(long startTime, boolean place)
    • placeBlocks

      public void placeBlocks(int index, net.minecraft.util.math.BlockPos pos)
    • placeBlocks

      public void placeBlocks(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos)
    • placeBlocksWithVerification

      public boolean placeBlocksWithVerification(int index, net.minecraft.util.math.BlockPos pos)
      place a block in the world at the pos if it is able to
      Parameters:
      index - the index of the the BlockLayer
      pos - the pos of the block
      Returns:
      boolean if the block was placed
    • placeBlocksWithVerification

      public boolean placeBlocksWithVerification(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos)
      place a block in the world at the pos if it is able to precomputed list for little performance improvement
      Parameters:
      states - the states that will be choosed
      pos - the pos of the block
      Returns:
      boolean if the block was placed
    • getBlockToPlace

      public net.minecraft.block.BlockState getBlockToPlace(int index, net.minecraft.util.math.BlockPos pos)
    • getBlockToPlace

      public net.minecraft.block.BlockState getBlockToPlace(List<net.minecraft.block.BlockState> states, net.minecraft.util.math.BlockPos pos)
    • verifyBlocks

      public boolean verifyBlocks(net.minecraft.util.math.BlockPos pos)