Skip to content

Woutuuur/python-in-minecraft

Repository files navigation

Python from Minecraft

build

Make sure to set GRAAL_PYTHONHOME to a valid Python location if you want to use its standard library. Will work without it, but you won't have access to the standard library, e.g. import os will fail.

Then run:

./gradlew runClient

Then, once in Minecraft, open the chat and type:

/run '<your command>'

For example:

/run '[1, 2, 3].count(2)'

State is stored throughout the entire Minecraft session, so you can do:

/run 'x = 5'
/run 'x * 2'

Same goes for imports, etc:

/run 'import math'
/run 'math.sqrt(16)'

Warning: by default, this runs with full permissions to the host, so you can do things like:

/run 'import os; os.remove("important_file.txt")'

About

Run python from a Minecraft command

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages