JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 195
  • Score
    100M100P100Q93444F
  • License MIT

Minecraft Mod parser. Provides the utilities to parse forge/liteloader/fabric mod metadata.

Package Exports

  • @xmcl/mod-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xmcl/mod-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Mod Parser

npm version Downloads Install size npm Build Status

Usage

Parse Fabric Mod Metadata

    import { Fabric } from "@xmcl/mods";
    const modJarBinary = fs.readFileSync("your-fabric.jar");
    const metadata: Fabric.ModMetadata = await Fabric.readModMetaData(modJarBinary);

    // or directly read from path
    const sameMetadata: Fabric.ModMetadata = await Fabric.readModMetaData("your-fabric.jar");

Parse Forge Mod/Config

Read the forge mod metadata, including @Mod annotation, mcmods.info, and toml metadata.

    import { Forge } from "@xmcl/mods";
    const forgeModJarBuff: Buffer;
    const metadata: Forge.MetaData[] = Forge.readModMetaData(forgeModJarBuff);

    const modid = metadata[0].modid; // get modid of first mods

Read the forge mod config file (.cfg)

    const modConfigString: string;
    const config: Forge.Config = Forge.Config.parse(modConfigString);
    const serializedBack: string = Forge.Config.stringify(config);

Parse Liteloader Mod

Read .litemod metadata:

    import { LiteLoader } from "@xmcl/mods";
    const metadata: LiteLoader.MetaData = await LiteLoader.readModMetaData(`${mock}/mods/sample-mod.litemod`);