Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enderzombi102/jythonmc
A library containing Jython for use within minecraft mods
https://github.com/enderzombi102/jythonmc
fabricmc jython library python
Last synced: 2 months ago
JSON representation
A library containing Jython for use within minecraft mods
- Host: GitHub
- URL: https://github.com/enderzombi102/jythonmc
- Owner: ENDERZOMBI102
- License: mit
- Created: 2021-06-14T20:30:04.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T08:34:35.000Z (almost 2 years ago)
- Last Synced: 2024-01-26T11:36:09.385Z (11 months ago)
- Topics: fabricmc, jython, library, python
- Language: Java
- Homepage:
- Size: 4.18 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![downloads](https://img.shields.io/modrinth/dt/jythonmc?color=00AF5C&label=modrinth%20downloads&style=flat-square&logo=modrinth)](https://modrinth.com/mod/jythonmc/versions)
[![followers](https://img.shields.io/modrinth/followers/jythonmc?color=00AF5C&label=modrinth%20followers&style=flat-square&logo=modrinth)](https://modrinth.com/mod/jythonmc)_DISCLAIMER! THIS LIBRARY DOES NOT LET YOU CREATE MODS IN PYTHON!_
# JythonMC
A library providing Jython for use within minecraft mods.# Use
There's two methods to initialize the python system:1) Add `"jythonmc:use" : true` to `custom` in your `fabric.mod.json`
this will automatically start the python system when JythonMC is loaded
3) Call `com.enderzombi102.jythonmc.Jython.initSystem()`
this will initialize the python system, but if its already initialized it'll do nothingAfter the system is initialized, you can use the python interpreter liek this:
```java
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
}
```# Install
build.gradle
```gradle
repositories {
mavenCentral()
maven {
url 'https://repo.repsy.io/mvn/enderzombi102/mc/'
}
}dependencies {
modImplementation "com.enderzombi102:JythonMC:$jythonmc_version"
}
```
gradle.properties
```properties
jythonmc_version=1.0.2
```