Back to mods
EventJS project artwork

CurseForge · Minecraft mod

EventJS

Reloadable sided native event for KubeJS

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which EventJS release should I use?

Updated 9 months ago
Latest stable file EventJS-1.20.1-1.4.3.jar
Game version 1.20.1
Loader Forge

EventJS-1.20.1-1.4.3.jar targets 1.20.1 with Forge. The project page does not say whether this file belongs on the client, dedicated server, or both. 1 required mod needs a matching file.

Where it goes

Is EventJS required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Forge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does EventJS-1.20.1-1.4.3.jar need?

EventJS-1.20.1-1.4.3.jar. Change the file and its required mods may change too.

1 required mod needs a matching file

Install KubeJS, Rhino, Architectury API first, but 1 required mod has no matching file for this setup. Do not mix loader builds to force a match. 2 come through another mod in the chain.

1 listed on this file 2 pulled in by those mods
KubeJS Needed by EventJS-1.20.1-1.4.3.jar
required
Matching file found Matched file: KubeJS Forge 2001.6.5-build.26
Rhino Needed by KubeJS
pulled in
Matching file found Matched file: Rhino Forge 2001.2.3-build.10

2 extra mods were pulled in by other dependencies. Indented rows show who needs each one. We only count dependency files that match this setup. A file for another loader does not fill the gap.

Before you install it

Add EventJS without breaking your instance.

Built for EventJS-1.20.1-1.4.3.jar. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use EventJS-1.20.1-1.4.3.jar. It targets 1.20.1 with Forge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    Install KubeJS, Rhino, Architectury API first, but 1 required mod has no matching file for this setup. Do not mix loader builds to force a match. 2 come through another mod in the chain.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside EventJS-1.20.1-1.4.3.jar. It opens that exact file at the source.

About this project

What does EventJS add?

EventJS

is a KubeJS addon that adds reloadable native events for KubeJS.

With EventJS, you can

  • refresh your native event listeners without restarting the whole game or store the handler within a global['someId'], which is both simpler and more performant.
  • add/remove native event listeners as you like without relaunching, which was impossible in KubeJS for 1.16-1.20
  • prevent your game from crashing if something goes wrong in your native event listener
  • add event listener only in server/client side

Usage

By default, EventJS will replace the original native event listening method to make it reloadable. So you actually don't need to learn anything new in order to use EventJS, just install it and you Forge event listening is reloadable now.

But, if you're looking for some more dynamic and well-defined event listending, you can use NativeEvents.onEvent(...), and NativeEvents.onGenericEvent(...) for generic event listening.

NativeEvents will be avaliable for all 3 script types (client/server/startup), so you can perform sided event listening, that is, for example, listen to client-only event in client_scripts, then this event listening will not happen on server side.

Syntax (v1.0.0~1.3.0)

NativeEvents.onEvent(eventType, handler)
NativeEvents.onEvent(priority, receiveCancelled, eventType, handler)
NativeEvents.onGenericEvent(genericClassFilter, eventType, handler)
NativeEvents.onGenericEvent(genericClassFilter, priority, receiveCancelled, eventType, handler)

The handler in JS side, is a callback that receives the event, for example: (event) => {...}

The eventType and genericClassType is something that can represent a class, like a string that holds the event class name, or the event class itself loaded by java(...) or Java.loadClass(...).

let handler           : (event: AnyForgeEvent) => void
let eventType         : string | Class
let genericClassFilter: string | Class
let priority          : $EventPriority | "highest" | "high" | "normal" | "low" | "lowest"
let receiveCancelled  : boolean

Changes in 1.4.0

In EventJS 1.4.0, in order to support ProbeJS Legacy out of the box, the eventType and genericClassFilter will only actively support Class loaded via java(...) (1.16.5) or Java.loadClass(...) (1.20.1).

let eventType         : Class
let genericClassFilter: Class

Supported Version

1.0.0: 1.16.5

1.1.0: 1.16.5, 1.20.1

1.2.0: all major version between 1.16 and 1.20

Do You Know That

The reason why I make this mod is that KubeJS is absurdly slow in implementing similar features. They added native event listener reloading only after KubeJS updated to 1.21, leaving all versions between 1.16~1.20 behind.

KubeJS for 1.21+ also contains support for native event listener reloading, using the same name NativeEvents, but its implementation is not the same as EventJS, so please dont make assumptions when interacting EventJS internals via Java.

Project description from CurseForge.

Pick your setup

EventJS by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

5 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

EventJS versions and loaders

22 of 22 releases match

Looking for an older file? The official CurseForge project page is in Resources.