DISCLAIMER! THIS LIBRARY DOES NOT LET YOU CREATE MODS IN PYTHON!
A library providing Jython for use within minecraft mods.
There's two methods to initialize the python system:
- Add
"jythonmc:use" : truetocustomin yourfabric.mod.json
this will automatically start the python system when JythonMC is loaded - Call
com.enderzombi102.jythonmc.Jython.initSystem()
this will initialize the python system, but if its already initialized it'll do nothing
After the system is initialized, you can use the python interpreter liek this:
try ( PythonInterpreter python = new PythonInterpreter() ) {
python.setErr(System.err); // to set python's stderr
python.setOut(System.out); // to set python's stdout
python.exec(CODE); // executes the code in the string CODE
} catch (Exception e) {
e.printStackTrace(); // python exceptions are translated to java ones if nothing catch them
}build.gradle
repositories {
mavenCentral()
maven {
url 'https://repo.repsy.io/mvn/enderzombi102/mc/'
}
}
dependencies {
modImplementation "com.enderzombi102:JythonMC:$jythonmc_version"
}gradle.properties
jythonmc_version=1.0.2