Skip to content
wagyourtail edited this page Oct 6, 2020 · 40 revisions

This wiki is outdated, visit the new website at

https://jsmacros.wagyourtail.xyz/

Welcome to JSMacros!

This is a guide for how to use this mod and some things you can do with it.

Releases:

Build Release

1.16.2: Build Beta 1.16.1: Build Beta 1.15.2: Build Beta 1.14.4: Build Beta

Javascript

Some restrictions of ScriptEngine/Graal or JavaScript: I set it to be multi-threaded so that multiple scripts could run at once. This also prevents the game from crashing if you accidentally make a forever loop. Functions can't be passed between scripts, some variables can but only if they're converted to java variables first... look at the Graal JavaScript Compatibility Docs for some raw java stuff you can do.

In the JS Compatibility docs, you may have noticed Java.type to directly grab java classes... to easier facilitate this I have created a Yarn Mapping Viewer so you will be able to figure out the obfuscated (in this case Yarn Intermediary) names of the Minecraft classes/methods/functions you wish to use.

Extensions 1.2.3+

  • Jython: Python 2.7 support.
  • JEP: Python 3.8 support.
  • lua: luaj (lua 5.2) support.

To install an extension, simply download it and add it to your mods folder.

Python moved out of the main build for 1.2.3+

pre 1.2.3

Jython

1.0.9+

added jython support. end a file with .py for it to be interpreted with python, jython allows for extending java classes so you can do some more in-depth stuff with it. also consumers aren't automatically created from py functions so use:

from java.util.function import Consumer

class jc(Consumer):
    def __init__(self, fn):
        self.accept=fn

JEP

1.1.4+

this is for python 3 support, It is annoying to setup but if you go through the effort It will give you full cython compatibility with the newest version of python. In order to use JEP you will need to install it using the guide for your OS on their wiki.

for windows:

  1. make sure you put python and pip in your path when installing.
  2. install the newest version of Visual C++ Build Tools
  3. launch the developer command prompt, and run pip install -U jep.
  4. copy the DLL from Python38\Lib\site-packages\jep\jep.dll to your minecraft directory
  5. set the path for the dll and enable JEP support in .minecraft/config/jsMacros/options.json
  6. profit

if you go through the effort to set this up on linux/mac please Pull-Request the steps or message @wagyourtail on the JsMacros discord

Clone this wiki locally