UNPKG

nmdk

Version:

CLI tool for downloading and setting up Minecraft mod development kits (MDK) for Forge, Fabric, and NeoForge

189 lines (142 loc) 4.82 kB
# MDK CLI Tool A command-line tool for downloading and setting up Minecraft mod development kits (MDK) for Forge, Fabric, and NeoForge. ## Installation ### Global Installation ```bash npm install -g nmdk ``` ### Using with npx (recommended) ```bash npx mdk <modname> <mcversion> <loader> <loaderversion> ``` ## Usage ### Basic Syntax ```bash mdk <modname> <mcversion> <loader> <loaderversion> ``` ### Parameters - `modname` - Name of your mod project - `mcversion` - Minecraft version (e.g., 1.20.1, 1.19.2) - `loader` - Mod loader (forge, fabric, neoforge) - `loaderversion` - Loader version or "latest" ### Examples #### Forge Mod ```bash # Create a Forge mod for Minecraft 1.20.1 with latest Forge mdk mymod 1.20.1 forge latest # Create a Forge mod with specific version mdk coolmod 1.19.2 forge 43.2.0 ``` #### Fabric Mod ```bash # Create a Fabric mod for Minecraft 1.20.1 mdk myfabricmod 1.20.1 fabric latest # Create a Fabric mod with specific loader version mdk testmod 1.19.2 fabric 0.14.21 ``` #### NeoForge Mod ```bash # Create a NeoForge mod (Minecraft 1.20.1+ only) mdk myneomod 1.20.1 neoforge latest ``` ## Features ### Automatic Setup - Downloads the latest MDK for your chosen loader - Extracts and organizes the project structure - Cleans up Gradle files (removes comments, formats code) - Updates mod metadata files ### Interactive Configuration The tool will prompt you for: - Group ID (e.g., com.yourname.modname) - Mod ID (lowercase, no spaces) - Mod Name (display name) - Author name - Description - Version ### Additional Setup Options - Run `gradlew setupDecompWorkspace` (recommended for Forge/NeoForge) - Run `gradlew build` to test compilation - Open project in VS Code ## Supported Loaders ### Forge - **Website**: https://files.minecraftforge.net/ - **Supported MC Versions**: 1.18.2, 1.19.2, 1.20.1+ - **Latest Version Detection**: Automatic via Forge API ### Fabric - **Website**: https://fabricmc.net/ - **Supported MC Versions**: 1.18.2, 1.19.2, 1.20.1+ - **Latest Version Detection**: Automatic via Fabric API ### NeoForge - **Website**: https://neoforged.net/ - **Supported MC Versions**: 1.20.1+ only - **Latest Version Detection**: Automatic via Maven metadata ## Project Structure After running the tool, your project will have the standard MDK structure: ``` yourmod/ ├── build.gradle ├── gradle.properties ├── settings.gradle ├── gradlew ├── gradlew.bat ├── src/ │ ├── main/ │ │ ├── java/ │ │ │ └── com/yourname/yourmod/ │ │ │ └── YourMod.java │ │ └── resources/ │ │ ├── META-INF/ │ │ │ └── mods.toml (Forge/NeoForge) │ │ └── fabric.mod.json (Fabric) │ └── test/ └── README.md ``` ## Development Commands Once your project is created, you can use these Gradle commands: ```bash # Build your mod ./gradlew build # Run Minecraft with your mod ./gradlew runClient # Generate IDE run configurations ./gradlew genEclipseRuns # For Eclipse ./gradlew genIntellijRuns # For IntelliJ IDEA # Setup development environment (Forge/NeoForge) ./gradlew setupDecompWorkspace ``` ## Requirements - Node.js 14.0.0 or higher - Java 17 or higher (for mod development) - Internet connection (for downloading MDK) ## Troubleshooting ### Common Issues 1. **"Directory already exists"** - The mod name you chose already exists as a directory - Choose a different name or remove the existing directory 2. **"No MDK found for version"** - The specified Minecraft version might not be supported by the loader - Try a different version or check the loader's website 3. **"NeoForge only supports Minecraft 1.20.1+"** - NeoForge is only available for Minecraft 1.20.1 and above - Use Forge or Fabric for older versions 4. **Gradle commands fail** - Make sure you have Java 17+ installed - Check your internet connection - Try running `./gradlew --version` to verify Gradle setup ### Getting Help If you encounter issues: 1. Check that all parameters are correct 2. Verify your Java version (`java -version`) 3. Ensure you have a stable internet connection 4. Try with a different mod name ## License MIT License - feel free to use this tool for your mod development projects! ## Contributing Contributions are welcome! Please feel free to submit issues and pull requests. ## Changelog ### v1.0.0 - Initial release - Support for Forge, Fabric, and NeoForge - Interactive configuration - Automatic MDK download and setup - Gradle file cleanup and formatting