Class FileUtil

java.lang.Object
fr.rodofire.ewc.util.file.FileUtil

public class FileUtil extends Object
class that provide useful methods for files related.
  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • renameFile

      public static void renameFile(Path oldPath, Path newPath)

      Method to move a file from one place to another.

      If the old path and the new path are under the same folder, this will just rename the file

      Parameters:
      oldPath - the path of the file that will be moved
      newPath - the path of the new file
    • removeFile

      public static void removeFile(Path path)
      method to remove a file without the risk of getting FileNotFoundException
      Parameters:
      path - the path of the file
    • getLegacyGeneratedChunkDir

      public static Path getLegacyGeneratedChunkDir(net.minecraft.world.level.chunk.ChunkAccess chunk, net.minecraft.world.level.WorldGenLevel world)
      method to get the path of the chunk under the generated folder
      Parameters:
      chunk - the chunk of the folder
      world - the world used to get the generated folder
      Returns:
      the path
    • removeGeneratedChunkDirectory

      public static void removeGeneratedChunkDirectory(net.minecraft.world.level.chunk.ChunkAccess chunk, net.minecraft.world.level.WorldGenLevel world)
      method to remove the chunk folder under the generated folder
      Parameters:
      chunk - the chunk of the folder that will be removed
      world - the world used to get the generated folder
    • getWorldSavePathDirectory

      public static Path getWorldSavePathDirectory(net.minecraft.world.level.WorldGenLevel world, net.minecraft.world.level.storage.LevelResource savePath)
    • loadJson

      public static String loadJson(Path path)