Class ModMetadataFiles

java.lang.Object
dev.architectury.loom.metadata.ModMetadataFiles

public final class ModMetadataFiles extends Object
Utilities for reading mod metadata files.
  • Constructor Details

    • ModMetadataFiles

      public ModMetadataFiles()
  • Method Details

    • fromBytes

      public static @Nullable ModMetadataFile fromBytes(String fileName, byte[] bytes)
      用内存中的原文重建模组元数据文件,供跨项目数据(LoomProjectData)在依赖方复原非 FMJ 形态.
      Parameters:
      fileName - ModMetadataFile.getFileName() 返回的文件名
      bytes - 元数据文件的原始内容
      Returns:
      重建的元数据文件;文件名不在已知范围内(例如带 [erroring] 后缀)时返回 null
    • fromJar

      public static @Nullable ModMetadataFile fromJar(Path jar) throws IOException
      Reads the mod metadata file from a jar.
      Parameters:
      jar - the path to the jar file
      Returns:
      the mod metadata file, or null if not found
      Throws:
      IOException
    • fromDirectory

      public static @Nullable ModMetadataFile fromDirectory(Path directory) throws IOException
      Reads the mod metadata file from a directory.
      Parameters:
      directory - the path to the directory
      Returns:
      the mod metadata file, or null if not found
      Throws:
      IOException
    • fromSourceSets

      public static @Nullable ModMetadataFile fromSourceSets(org.gradle.api.Project project, org.gradle.api.tasks.SourceSet... sourceSets) throws IOException
      Reads the first mod metadata file from source sets.
      Parameters:
      project - the project owning the source sets
      sourceSets - the source sets to read from
      Returns:
      the mod metadata file, or null if not found
      Throws:
      IOException