mindstorm38 / portablemc

A fast, reliable and cross-platform command-line Minecraft launcher and API for developers. Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
https://pypi.org/project/portablemc/
GNU General Public License v3.0
372 stars 20 forks source link

Start a custom jar #212

Open xandaaah opened 7 months ago

xandaaah commented 7 months ago

I have a custom jar to launch, and the API docs have nothing on like specifying a path to the jar, or anything like that.

mindstorm38 commented 7 months ago

Hi! To launch a custom JAR you have to conform to how .minecraft directories work (so-called "main dir"). In fact, you need to create a directory for your version under <main dir>/versions, and inside it, you also need to add a version metadata file <your version>.json, this metadata is really important as it tells the launcher how to build the command line to start your jar, which libraries to use, etc. You can check how mojang's versions are crafted and base your one on this.

Here is a sample directory structure, if your main dir is .minecraft and your custom version is named hello: