Skip to content
@FabricCore

Fabric Core

FabricMC + JavaScript = JSCore

JSCore is a thin wrapper around FabricMC.

What does this mod do?

This mod provides full JavaScript support for Minecraft modding, you can create or use community modules to customise your game.

In short, JSCore can do

  • Everything a typical JS runtime, such as KubeJS, can do.
  • Everything in FabricMC that does not use Mixins*
  • Interact with other mods.

*Mixins support depends on whether one guy on Discord can get it to work or not.

How to use it?

Just download the mod and run the game!

Read the Quickstart Guide.

How is it different from KubeJS/JSMacros?

Access to Minecraft Internals

JSCore allows access to classes in the net.minecraft package - anything that FabricMC can do (except Mixins), JSCore can also do it.

// client: net.minecraft.client.MinecraftClient
let client = net.minecraft.client.MinecraftClient.getInstance();
// player: net.minecraft.client.network.ClientPlayerEntity
let player = client.player;
// position: net.minecraft.util.math.BlockPos
let position = player.getBlockPos();

Module System Similar to Node.js

The module system from Node.js allows complex game mechanics to be built from small and managable chunks, so we brought it to JSCore.

// init.js
let savePlayers = require("./savePlayers");
savePlayers();
// savePlayers.js
let fs = require("fs");
let { getPlayers } = require("./getPlayers");

function savePlayers() {
    let players = getPlayers();
    let content = JSON.stringify(players);
    fs.writeFileSync("./playerList.json", content);
}

module.exports = savePlayers;

What features does this mod have?

This mod runs init.js on start.

Additional features are provided by third-party modules, such as

  • Rinode: provide Node.js features such as console.log and fs.
  • Command: Declarative Minecraft command registration.
  • Pully: package manager for JSCore.

A list of package can be found in the package repository, anyone can publish packages to this repository.

How does this mod work?

The Minecraft code is obfuscated and cannot be referred to by their real name. This mod uses Yarnwrap, which wraps all net.minecraft classes so their real name can be used instead of their obfuscated name.

sequenceDiagram
    JSCore-->>Yarnwrap: Give me MinecraftClient
    Yarnwrap-->>Minecraft: Give me class_310
    Minecraft->>Yarnwrap: Here's class_310
    Yarnwrap->>JSCore: Here's MinecraftClient
Loading

Popular repositories Loading

  1. JSCore_old JSCore_old Public archive

    Minecraft-aware JavaScript runtime.

    Java 4 2

  2. yarn-wrapper-gen yarn-wrapper-gen Public

    Generate wrapper classes from yarn mappings.

    Rust 2

  3. jscore jscore Public

    JavaScript support for FabricMC.

    Java 2

  4. pully-js pully-js Public

    Package manager.

    JavaScript 1

  5. gradlew-commentator gradlew-commentator Public

    Automatically comment out errorous code from a Gradle project until it compiles.

    Rust 1

  6. FabricCore.github.io FabricCore.github.io Public

    Mirror for docs sites.

    HTML

Repositories

Showing 10 of 48 repositories

Top languages

Loading…

Most used topics

Loading…