EventJS

EventJS

Sided reloadable native event for KubeJS

by
34.1K Downloads
forgeutility
Rent Server with this Mod

About this Mod

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.

Available Versions

EventJS 1.4.0release
MC 1.20.1forge
May 27, 2025
EventJS 1.4.0release
MC 1.16.5forge
May 27, 2025

How to Install EventJS on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set forge Loader

In the panel under "Egg", select the forge loader and matching Minecraft version (1.20.1).

3

Install Mod

Open the mod browser in the dashboard and search for "EventJS". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

forge

Minecraft Versions

1.20.1, 1.16.5

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

EventJS server crashes on startup – what to do?

Most common cause: wrong forge version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.20.1). You can switch loaders with one click in the panel.

Is EventJS compatible with forge?

EventJS officially supports forge for Minecraft 1.20.1, 1.16.5. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with EventJS – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if EventJS consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install EventJS with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
GNU General Public License v3.0 or later
Server-side
Required

Supported Versions

1.20.11.16.5