Class SaveChunkShapeInfo

java.lang.Object
net.rodofire.easierworldcreator.nbtutil.SaveChunkShapeInfo

public class SaveChunkShapeInfo extends Object

That is a way to generate a really large structure. Since that the nbt is saved during world gen, no block entity should be present.

This class is used to create JSON files.

It is used by this mod to divide a structure into chunks.

If the structure is larger than a chunk, it will save the structure into chunks that will be saved into JSON files.

The JSON files will then be saved into the following path : [save_name]/generated/easierworldcreator/[chunk.x-chunk.z]/custom_feature_[Random long].

It will then be read by the following class LoadChunkShapeInfo

Since that to generate large structures, it requires to write and read the json file, be careful to don't have a too big structure. It may use a lot of performance during the write of every files

  • Constructor Details

    • SaveChunkShapeInfo

      public SaveChunkShapeInfo()
  • Method Details

    • saveDuringWorldGen

      public static void saveDuringWorldGen(Set<BlockList> blockLists, net.minecraft.world.StructureWorldAccess worldAccess, String name) throws IOException
      This is the main method on saving the structure into JSON files

      I multithreaded this class for optimal performance. Since that the structure is divided into chunks, we can multithread the generation of files

      Parameters:
      blockLists - the list to divide into chunks and then saving it into JSON files
      worldAccess - the world the structure will spawn in
      Throws:
      IOException - avoid errors
    • saveChunkWorldGen

      public static void saveChunkWorldGen(Set<BlockList> blockLists, net.minecraft.world.StructureWorldAccess worldAccess, String name) throws IOException
      This is the main method on saving the structure into JSON files

      I multithreaded this class for optimal performance. Since that the structure is divided into chunks, we can multithread the generation of files

      Parameters:
      blockLists - the list to divide into chunks and then saving it into JSON files
      worldAccess - the world the structure will spawn in
      Throws:
      IOException - avoid errors
    • sortBlockPos

      public static Set<BlockList> sortBlockPos(Set<BlockList> blockLists)
      this method is used to sort the BlocKPos of a BlockList
      Parameters:
      blockLists - the list to sort
      Returns:
      the sorted list
    • divideBlocks

      public static List<Set<BlockList>> divideBlocks(Set<BlockList> blockLists)
      divides the a list of blockList into a list of list of blockList that represents every Chunk of the BlockList
      Parameters:
      blockLists - the list to divide into a list of chunks
      Returns:
      the blockLists divided into chunks
    • createFolders

      public static Path createFolders(Path path) throws IOException
      Throws:
      IOException