Python Code

Mods
460 Downloads Last Updated: Jan 13, 2017

Warning: This project is experimental. Its files will not synchronize across the CurseForge network.

Python in Minecraft

I wanted to code Python stuff in Minecraft, so added a Python Block and movable Python Hand which can be programmed with Python. The code may be edited in-game using standard writeable books, which suck, so I also created an extended book which provides more space, cursor and mouse control, syntax checking and some other features.

screenshot/editor.png

Install using the download from https://minecraft.curseforge.com/projects/python-code

What you can do

Once you've created a Python Block or Hand you can write some Python code in a Writeable Book (or the superior Python Code Book), right click it on a the Python Hand or Block and have that code be run.

If you want to delay the running of your code you can put all the code in a run() function. That function will then be run only when you right click the hand or block. Wands execute code in a book held in your off hand.

 

Also, Python Blocks may have other events that they handle:

Redstone Power
If you define a powerOn() or powerOff() function these will be called when the block receives, or loses redstone power (eg from redstone wiring, or just a button placed on the block.)
Time Passsing
If you define a tick() function this will be called about 20 times per second. 

Recipes

Python Wands are used to create Python Code Books and interact with Python Blocks and Python Hands:

screenshot/wand-recipe.png

Python Blocks sit in the world and can do stuff:

screenshot/block-recipe.png

Python Hands can move around in the world and can do stuff.

screenshot/hand-recipe.png

Python Code Book is a superior editable book that will also check your Python code for syntax errors:

screenshot/book-recipe.png

Documentation

Full documentation, including a full change log, is on the project site.

Contributing

This mod is open source and contributors are welcomed! The project is hosted on github. If you need help with git, please let me know!