ClassJS

⭐ — (1 endorsements) 📥 1,200 downloads 📌 v0.1-alpha.6 📅 10/16/2025
🟡 Updated this year

By Pelemenguin · forge

⬇ Download Mod Source: Modrinth ↗ 📅 Updated: 12/27/2025 📅 Created: 10/16/2025
⚠️ Install Order · 2 steps
1🛠️ Forge — Minecraft Forge (mod loader) Download ↗
2🛠️ Fabric — Fabric Loader Download ↗

Install in this order, then this mod last — most mods fail to load without their framework and dependencies in place.

🔍 Analysis

  • 👍 0.1% endorsement rate
  • 🏆 #25 of 391 forge mods in this game by downloads

📋 About This Mod

ClassJS is a mod to create Java classes in KubeJS. ## Basic Example You may operate Java byte code to build your own methods. **Note:** Some instructions that interacts with classes (`getstatic`, `invokestatic`, `new`, etc.) is protected under KubeJS's class filters. You may not use them to access classes that is not allowed by KubeJS or its other addons. Neither can you extend or implement them. ```javascript let ExampleClass = ClassCreator.create("ExampleClass") .toPublic() // Set the class to public .defaultConstructor() // Add a default constructor .createMethod("exampleMethod", , "java.lang.String") // Method name, parameter types, and return type .toPublic() .code(builder => { builder.pushString("Hello, ClassJS!") // Push a string reference to the operand stack .returnObject(); // Returns the string }) .defineClass(); // Define the class console.info((new ExampleClass()).exampleMethod()); ``` Equivalent Java code: ```java public class ExampleClass { public ExampleClass() { super(); } public String exampleMethod() { return "Hello, ClassJS!"; } } ``` ## Code in JavaScript If you do not want to learn Java byte code, you can create methods using JavaScript functions. ```javascript let ExampleClass = ClassCreator.create("ExampleClass") .toPublic() .createMethod("exampleMethod", , "int") .toPublic().toStatic() .codeJS((num1, num2) => { return num1 + num2; }) .defineClass(); console.info(ExampleClass.exampleMethod(1, 2)); // Output in startup.log // 3.0 ``` Equivalent Java code: ```java public ExampleClass { // Note: This class do not even have a constructor, // as the JavaScript above did not call `defaultConstructor`, // neither did it created any other constructors. public static int exampleMethod(int i1, int i2) { return i1 + i2; } } ``` ## Load a Created Class Classes can be only defined in *startup* scripts. If you want to use them in other scripts, you can use `ClassJSUtils.loadClass` method. ```javascript ClassCreator.create("SomeClass") /** Do some operations to add content to this class */ .defineClass(); // In other scripts: let SomeClass = ClassJSUtils.loadClass("SomeClass"); // Then you can use `SomeClass` ```

ClassJS is a mod to create Java classes in KubeJS.

## Basic Example

You may operate Java byte code to build your own methods.

Note: Some instructions that interacts with classes (`getstatic`, `invokestatic`, `new`, etc.) is protected under KubeJS's class filters. You may not use them to access classes that is not allowed by KubeJS or its other addons. Neither can you extend or implement them.

```javascript let ExampleClass = ClassCreator.create("ExampleClass") .toPublic() // Set the class to public .defaultConstructor() // Add a default constructor .createMethod("exampleMethod", [], "java.lang. String") // Method name, parameter types, and return type .toPublic() .code(builder => { builder.pushString("Hello, ClassJS!") // Push a string reference to the operand stack .returnObject(); // Returns the string }) .defineClass(); // Define the class

console.info((new ExampleClass()).exampleMethod()); ```

Equivalent Java code:

```java public class ExampleClass {

public ExampleClass() { super(); }

public String exampleMethod() { return "Hello, ClassJS!"; }

## Code in JavaScript

If you do not want to learn Java byte code, you can create methods using JavaScript functions.

```javascript let ExampleClass = ClassCreator.create("ExampleClass") .toPublic() .createMethod("exampleMethod", ["int", "int"], "int") .toPublic().toStatic() .codeJS((num1, num2) => { return num1 + num2; }) .defineClass();

console.info(ExampleClass.exampleMethod(1, 2)); // Output in startup.log // 3. 0 ```

Equivalent Java code:

```java public ExampleClass { // Note: This class do not even have a constructor, // as the JavaScript above did not call `defaultConstructor`, // neither did it created any other constructors.

public static int exampleMethod(int i1, int i2) { return i1 + i2; }

## Load a Created Class

Classes can be only defined in startup scripts. If you want to use them in other scripts, you can use `ClassJSUtils.loadClass` method.

```javascript ClassCreator.create("SomeClass") /* Do some operations to add content to this class / .defineClass();

// In other scripts:

let SomeClass = ClassJSUtils.loadClass("SomeClass"); // Then you can use `SomeClass` ```

🤖 AI-enhanced — based on mod data

📊 Mod Details

Game
Minecraft Mods
Author
Pelemenguin
Version
0.1-alpha.6
Downloads
1,200
Endorsements
1
Category
forge
Created
10/16/2025
Updated
12/27/2025
Game Versions
1.20.1

🔧 How to Install Minecraft Mods Mods

Download from Modrinth. Use Prism Launcher or drop into your mods folder.

📖 Full step-by-step install guide for Minecraft Mods →

Visit the official mod page for specific installation instructions for this mod.

🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Mods commands, item IDs, and more.

❓ Frequently Asked Questions

Which Minecraft Mods versions does ClassJS support?

The author lists 1.20.1. Other versions may work but are untested by the author.

What is the latest version of ClassJS?

Version 0.1-alpha.6, published 2025-12-27 with 1,200 downloads recorded at the source.

Keep browsing — more Minecraft Mods mods await

📋 All Minecraft Mods Mods 🏆 Top 25 📂 More forge 👤 More by Pelemenguin 🔎 Similar Mods 🌐 Best forge (All Games) 🔀 Check Compatibility ⚖️ Compare Mods 🆕 New Mods