Skip to content

shotah/forgecli

Repository files navigation

Coverage CI Update release version.

Windows Ubuntu Mac OS

ForgeCLI

Package was created with the express intent to remove the guess work out of Mod acquiring and updating.

Parameters

NOTE: Due to the lack of Version pinning this can lead to unexpected behavior if the publisher updates mod unexpectedly.

To get started make sure you have a CursedForge API Key.

Default Folder Locations

  • Windows: "%AppData%/Roaming/.minecraft/mods"
  • Mac: "~/Library/Application Support/minecraft/mods"
  • Linux: "~/Library/Application Support/minecraft/mods"

Mod Basics

  • Mod Release types: Release, Beta, and Alpha.
  • Mod dependencies: Required and Optional
  • Mod family: Fabric, Forge, and Bukkit.
  • Mod MC Version: 1.12.2, 1.18.2, etc.

CLI Parameters:

  • forgekey: Required as a parameter, or as an ENV var of FORGEKEY and MODS_FORGEAPI_KEY
  • file: Specially formatted json to manager larger sets of mods.
  • projects: Project ids that can be easily obtained from the Forge itself.
  • destination: Default is OS Client Mod folder, Target folder for the downloaded mods.
  • family: Used to filter mods based on server type. Options are Forge, Fabric, and Bukkit
  • release: Default is Release, Used to allow for Beta and Alpha mod downloads.
  • version: Default is LATEST, but this is Minecraft VERSION. e.g. 1.18.2,
    • PARTIAL matching is enabled, e.g. use 1.18 to pull back 1.18.2, 1.18.1, 1.18 mods
  • clear: Default is false, allows CLI to remove all mods before downloading new Mods.
  • client: Default is false, if family is defined and client is defined, it will attempt to install the latest client.
  • dependencies: Default is True, this uses the mods required dependencies to download missing mods.
  • debug: Enable extra logging.

Installation

Windows

Chocolatey

Chocolatey based install How do I install these tools?

Install chocolatey url

Note: Currently waiting on approval by Chocolatey Admins

choco install forgecli --version=0.0.3 -Y

Scoop

Scoop Manifests How do I install these tools?

Install scoop url

Add this bucket to scoop:

scoop bucket add shotah https://github.com/shotah/scoop-bucket.git

Install tools via scoop install:

scoop install forgecli

Mac

Homebrew

Homebrew Manifests How do I install these tools?

Install Homebrew

Add this tap to brew:

brew tap shotah/tap

Install tools via brew install:

brew install forgecli

Forge API Key

This is more complicated because you will be pulling/using the latest mod for the release of your game. To get started make sure you have a CursedForge API Key. Then use it as a parameter for your build

Basic Usage

Simple command to download latest fabric modules:

forgecli -forgekey '$2a$10...' -projects "416089,391366" -family "fabric" -debug

Example Outputs

Example Success

time="2022-02-28T09:37:51-08:00" level=info msg="Starting Forge Mod lookup"
time="2022-02-28T09:37:51-08:00" level=info msg="Found Lastest FileID: 3667363 for Mod: 416089"
time="2022-02-28T09:37:51-08:00" level=info msg="Downloading: https://edge.forgecdn.net/files/3667/363/voicechat-fabric-1.18.2-2.2.24.jar"
time="2022-02-28T09:37:52-08:00" level=info msg="Files in Destination Folder:"
time="2022-02-28T09:37:52-08:00" level=info msg="  voicechat-fabric-1.18.2-2.2.24.jar  "
time="2022-02-28T09:37:52-08:00" level=info msg="Download Complete."

Example Fail

time="2022-02-28T09:52:14-08:00" level=info msg="Starting Forge Mod Lookup"
time="2022-02-28T09:52:14-08:00" level=error msg="could not find 391366 for minecraft version: 1.18.2 or family: fabric"
time="2022-02-28T09:52:14-08:00" level=error msg=Exiting...

Run with Client Install

Includes -client, this tells the CLI to look at the -family parameter and find the version that corresponds to -version and download and install it for you.

Note: Currently only works with Fabric. I am not aware of Forge's version XML to query. If someone has more information I'd be happy for the help.

forgecli -forgekey '$2a$10...' -projects "416089,391366" -family "fabric" -client -debug

Json File

Usage

forgecli -forgekey '$2a$10...' -file "forgeMods.json" -family "fabric" -client -dependencies

Field Descriptions

  • name: is currently unused, but can be used to document each entry.
  • projectID: is the id found on the CurseForge website for a particular mod
  • releaseType: Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha).
  • fileName: is used for version pinning if latest file will not work for you.
  • version: used to override when Mojang releases minor updates and mods have not updated.
    • Does not currently apply to dependencies of Mod. e.g. Error if dependency does not support the main MC version.

Json Example

[
  {
    "name": "fabric api",
    "projectID": "306612",
    "releaseType": "release"
  },
  {
    "name": "fabric voice mod",
    "projectID": "416089",
    "releaseType": "beta",
    "version": "1.18.1"
  }
]

Building and Testing

Make a ./.env file in the root folder and add your forge key.

FORGEKEY='$2a$10...'

Most common used commands can all be found in the makefile.

Test command:

make test

Build command:

make build
# . ./forgecli should now be available to be used.