Coder Social home page Coder Social logo

jythonmc's Introduction

downloads followers

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
  2. 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
}

Install

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

jythonmc's People

Contributors

ecorous avatar enderzombi102 avatar triphora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jythonmc's Issues

what is this?

hello, sorry for the disturbance but i have some questions in my mind and didn't know where else to ask these questions.
i was just about to start learning java (as my first programming language) to develop minecraft mods but i also want to learn python, then when i opened modrinth, i saw this mod.
what is jythonmc? does it allow you to write code in python and convert it to java code that minecraft understands?
how good is it's performance?
is it complete?
can i do anything with it?
again, sorry for taking your time.

Many issues

There are a lot of inconsistencies in naming (jython or jythonmc)

  1. this line should say jythonmc, because is crashes otherwise

Following the guide in README also causes crashes

  1. NoClassDefFoundError is thrown because the package's name is com.enderzombi102.jython not com.enderzombi102.jythonmc
  2. the guide should contain mention about adding include implementation("org.python:jython:$jython_version") to dependencies, as without that a NoClassDefFoundError will be thrown

Even after jumping through those hoops, I wasn't able to run jython interperter, as another error occured while trying to run exec from PythonInterpreter:

Cannot read field "modules" because the return value of "org.python.core.Py.getSystemState()" is null

If you want to see the code I tried, its here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.