ClassJS
by Pelemenguin
ClassJS is a Forge addon for KubeJS that lets scripts create Java classes and build their own methods from JavaScript functions, while protecting certain bytecode instructions.
What it does
Scripts that use KubeJS can define new Java classes through ClassJS, and each method of those classes can be assembled from JavaScript functions. The addon works at the Java bytecode level, so a script author who wants to learn how bytecode is structured can see the instructions their functions turn into. Some instructions that touch other classes, such as static field reads, static method calls and object creation, are covered by KubeJS class filters.
Classes are only defined during startup scripts, and a class created this way cannot extend or implement other types. Scripts that run later can reach a class through the ClassJSUtils.loadClass method. Access to classes is limited to the ones KubeJS and other addons allow, which keeps the feature inside the boundaries KubeJS already sets.
The mod is published for Forge only, in the 1.20.1 game version, with 0.1-alpha.6 as the latest file, dated 2025-12-27 on the alpha channel. A server running it needs every connecting player to have it too. ClassJS is released under the MIT License and is open source; its source code is public.
Key features
Java classes from scripts
KubeJS scripts can create Java classes, so a modpack author can add logic that KubeJS alone does not expose.
Methods built from functions
Each method of a created class is assembled from JavaScript functions, which turns script code into bytecode.
Filtered bytecode instructions
Instructions that read static fields, call static methods or create objects are checked by KubeJS class filters before they run.
Startup-only class definitions
Classes are defined only in startup scripts, and they cannot extend or implement other classes or interfaces.
Compatibility
Latest build for each game version and loader.
Only full game releases are shown. This mod publishes no snapshot builds.
How it compares
Soul Classes is a Forge mod for 1.20.1 that runs on client and server, but it is not open source and is released under All rights reserved, so its source is not available for reuse. MoreJS: KubeJS Addon covers Fabric, Forge and NeoForge for 1.18.2 – 1.21.1 under the GNU Lesser General Public License v3.0 only, so it is a different loader and version range. KubeJS itself is open source under the same license family and runs on Fabric, Forge, NeoForge and Quilt; either side can run it, and neither needs it.
| Mod | Loaders | Game versions | Environment | Updated |
|---|---|---|---|---|
| ClassJS | Forge | 1.20.1 | Client and server | 2025-12-27 |
| Soul Classes | Forge | 1.20.1 | Client and server | 2024-10-09 |
| MoreJS: KubeJS Addon | Fabric, Forge and NeoForge | 1.18.2 – 1.21.1 | Client and server | 2025-10-13 |
| KubeJS | Fabric, Forge, NeoForge and Quilt | 1.18.2 – 26.1.2 | Client or server, optional | 2026-10-15 |
Questions
Does ClassJS need KubeJS?
Can scripts load a class after startup?
Does the server need ClassJS for players to join?
More from Pelemenguin
What the author says
ClassJS is a mod to create Java classes in KubeJS. You may operate Java byte code to build your own methods.
Official listing
- Modrinth page
- modrinth.com/mod/classjs
- Owner
- Pelemenguin
- Published
- 2025-10-14
- Updated on Modrinth
- 2025-12-27
- Facts verified
- 2026-10-15
