PyCraft (Python)
Most Minecraft mods ask you to learn Java, set up a build environment, and restart the game every time you tweak a line of code. PyCraft (Python) takes a different route. It is a lightweight utility mod that embeds a Python interpreter directly into the Minecraft client, letting you automate chat, bind keys, and run expressions on the fly. It is not built to replace Java modding or to create sprawling content mods. Think of it as a scripting sidekick: fast, flexible, and always ready.
What PyCraft (Python) Actually Does
The mod watches a single file, main.py, inside your mods folder. Save a change and the mod reloads it automatically within about one second, so you never have to relaunch the game to test an idea. Press Y at any time to open an in-game Python REPL console where you can run one-off expressions, check math, or call API functions without leaving your world.
Beyond the console, PyCraft (Python) for Minecraft hooks into several parts of the client:
- Chat interception: read incoming messages to filter spam or trigger automatic replies.
- Input handling: bind Python logic to key presses, releases, and holds.
- GUI automation: open the chat window with text already typed, which is perfect for command prefixes.
- Hot reloading: edit and save, and your script refreshes instantly.
Supported Versions and Loader
PyCraft (Python) is a Fabric mod, so Fabric API is a hard requirement. It targets the Fabric loader on Minecraft 1.20.x and 1.21.x, and you should confirm the exact build for your game version before you download PyCraft (Python). Because it relies on Jython, the bundled interpreter runs Python 2.7. Standard Python syntax and libraries work fine, but Python 3 features such as f-strings and async/await are not supported, so keep that in mind when porting snippets from tutorials.
If you would rather skip manual file juggling, the foxygame.net launcher bundles PyCraft (Python) in its add-on catalog and handles version matching for you, so the right build lands in the right profile automatically.
How to Install PyCraft (Python)
Step by Step
- Install the Fabric loader for your Minecraft version and drop Fabric API into your mods folder.
- Place the PyCraft (Python) jar in the same mods folder.
- Launch Minecraft once. The mod generates a fresh main.py file in .minecraft/mods/.
- Open main.py in any text editor, such as VS Code or Notepad++, write your code, and save.
- Watch the console log for the load confirmation and start testing in-game.
A Quick Example
The scripting API is small but practical. Two global functions cover most needs: sendMessage(text) sends chat or runs a command if the text starts with a slash, and openChat(text) opens the chat box pre-filled. Event hooks handle the rest. Define onChat(message) to react to incoming messages, and onKey(state, key, modifiers) to respond to keyboard input, where state 0 is release, 1 is press, and 2 is hold.
A classic starter script binds the U key to open chat with a global prefix and auto-replies whenever someone says "Hello." The key code for U is 85, so a single conditional inside onKey is enough to trigger openChat('!'), while onChat uses a simple regex search to fire back a greeting. Save the file and the mod reloads it instantly, no restart required.
Who Should Use It
PyCraft (Python) shines for players who want quick automation without a full development stack: streamers building chat filters, server regulars creating command shortcuts, or anyone curious about scripting who prefers Python over Java. It will not build you new blocks or dimensions, and that is the point. It is a flexible scripting tool, and a genuinely fun one to experiment with. Grab Fabric API, write a few lines of main.py, and let the hot reload do the rest.
===ARTICLE===