Fluxyn / PyModMC

A Minecraft modding library made for Python.
MIT License
42 stars 3 forks source link

PyModMC

PyModMC is a Minecraft modding library made for Python. It is built on top of the Fabric API. The project is still in its early stages. In future updates I am planning to add:

from PyModMC import *

test_mod = Mod('Test Mod', '0.0.1', 'A test mod.', '1.20.1', ['Fluxyn'])
FoodItem(test_mod, 'Donut', 1, 1)
test_mod.run()

In order to make Minecraft mods, you need a Java Development Kit. Run the javac command to see if you already have one. If not, you can get one here. Make sure to enable 'Set JAVA_HOME variable' and restart your computer after installation.

If build fails, be sure to have an appropriate Java version according to your Minecraft version, for > 1.17 you will need Java 17, for older versions use Java 11. You can get the installed Java version with this command.

$ java -version

Installation

Install PyModMC with pip:

$ pip install PyModMC

On your first run, PyModMC will scrape the Modrinth API to get every single Fabric version and the corresponding Minecraft version. This can take a couple of minutes, but the data is cached and won't be updated until another version of Fabric is released.

Documentation

Mod class

Mod(mod_name, mod_version, description, minecraft_version, authors, website='', directory=os.getcwd())

The Mod class represents a Minecraft mod. Upon initializing, it will copy the file structure from the Fabric example mod and configure it using the values above.

Other functions