Python Command API

Python Command API

21 Downloads

EARLY ALPHA: Report all issues you find!

There are still many features that are not implemented yet.

Join the Discord at discord.gg/ASgHFkX!

NOTE: This project requires Jython 2.7.2 standalone to be installed on the server (or, if in singleplayer, on the same computer running Minecraft). It can be downloaded here.

This mod allows Python scripts to hook into the game, and execute commands inside Minecraft. There are three commands added:

/python <filename> -- Runs the Python program given. The default directory is %APPDATA%\.minecraft\python on Windows for singleplayer.

/py_runline <line of code> -- Runs the given line of Python code. Encapsulating the line in double quotes is recommended. Use the backslash (\) to escape double quotes inside the text.

/py_scandir -- Scans the Python program directory (generated on first startup) for Python programs and prints to chat (or console log) any that it finds.

To hook into Minecraft, place the Python script in the python directory and paste the following lines at the top of the script:

from io.github.craftablescience.pythoncmdapi import MC

minecraft = MC()

You can then use the minecraft variable's methods, described below. (For example: minecraft.say("hello from python")).

As of 0.0.3 there is (1) command available:

say(message : str) -- prints given message to chat.