There is initial script in folder 'mods/jython/' which named 'init.py'. In initial file you can import your modules or write code to execute your files (execfile).
The mod have three console commands:
1. '/jython reinit' to reload initial file init.py
2. '/jython load yourscript.py' to load your script from 'yourscript.py' (like execfile('yourscript.py'))
3. "/ print('HelloWorld')" (slash with one space) where "print('HelloWorld')" is your code
When player receives chat notification, the mod calls 'onChatReceive(message)' with message from chat.
onWorldLoad() no comments
When you write '/ print 1+3' where 'print 1+3' is your code, mod calls 'parseConsole' with one argument(your 'print 1+3'), and there you can change processing behavior if you redefine 'parseConsole'
You can call methods from mod with 'jyt' or 'jyt.jh' (jython helper).
Methods in 'jh':
sendChat("message") to send any text to chat. Example "/ jyt.jh.sendChat("/setblock 1 1 1 stonebrick")"
getXreal() returns real X coordiante of player
getYreal() -//-
getZreal() -//-
getX() returns rounded X coordiante of player
getY() -//-
getZ() -//-
Forge 1.11.2
Allows to execute python code in game console.
There is initial script in folder 'mods/jython/' which named 'init.py'. In initial file you can import your modules or write code to execute your files (execfile).
The mod have three console commands:
1. '/jython reinit' to reload initial file init.py
2. '/jython load yourscript.py' to load your script from 'yourscript.py' (like execfile('yourscript.py'))
3. "/ print('HelloWorld')" (slash with one space) where "print('HelloWorld')" is your code
When player receives chat notification, the mod calls 'onChatReceive(message)' with message from chat.
onWorldLoad() no comments
When you write '/ print 1+3' where 'print 1+3' is your code, mod calls 'parseConsole' with one argument(your 'print 1+3'), and there you can change processing behavior if you redefine 'parseConsole'
You can call methods from mod with 'jyt' or 'jyt.jh' (jython helper).
Methods in 'jh':
sendChat("message") to send any text to chat. Example "/ jyt.jh.sendChat("/setblock 1 1 1 stonebrick")"
getXreal() returns real X coordiante of player
getYreal() -//-
getZreal() -//-
getX() returns rounded X coordiante of player
getY() -//-
getZ() -//-
getViewX() returns player's view endpoint X coordiante
getViewY() -//-
getViewZ() -//-
watchTo(x, z) sets player's view to point
watchTo(x, y, z) sets player's view to point
getPitch() returns player's view pitch
getYaw() returns player's view yaw
pressKey(int code, boolean pressed) sets key state. Example: jump key "/ jyt.jh.pressKey(57,True)"
getBlockName(double x, double y, double z)
getBlockId(double x, double y, double z)
getBlockIdFromName(String name)
You can write your own mods with python!
Key codes
DOWNLOAD from https://minecraft.curseforge.com/projects/pycraft-python