Origins JS (Legacy)

KubeJS integration for Origins. Backport from Origins JS

Origins JS (Legacy)

This is an official 1.20.1 backport of Origins JS (CurseForge | Modrinth) — a KubeJS integration for Origins (NeoForge), allowing you to manage origins and powers via JavaScript.

Features

  • Origin & Power Management — Grant, revoke, and check origins/powers from JS scripts.
  • Custom Actions — Define EntityAction, BlockAction, ItemAction, BiEntityAction in JavaScript.
  • Custom Conditions — Define EntityCondition, BlockCondition, ItemCondition, BiEntityCondition, BiomeCondition, DamageCondition, FluidCondition in JavaScript.
  • Custom Powers — Create fully scripted Power types with JS callbacks (grant, revoke, tick, active, inactive).
  • Data-Driven — All custom types can be referenced in JSON datapacks using the origins_js: namespace.
  • Parameter Support — Pass custom parameters from JSON to your JS callbacks for dynamic behavior.

Dependencies

Quick Start

1. Install all dependencies, then place your .js scripts in kubejs/server_scripts/.

2. Basic Usage

// Register a custom entity action
OriginsJS.registerEntityAction("heal_half", (entity, params) => {
    if (entity.isLiving()) {
        entity.heal(entity.getMaxHealth() / 2);
    }
});

// Create a custom power
OriginsJS.powerBuilder("regeneration_power")
    .tick((entity, params) => {
        if (entity.getHealth() < entity.getMaxHealth()) {
            entity.heal(0.5);
        }
    })
    .register();

Create kubejs/server_scripts/origins.js:

// Assign a random origin on first join
PlayerEvents.loggedIn(event => {
    let holder = OriginsJS.getHolder(event.player);
    if (holder && !holder.hasAllOrigins()) {
        holder.setOrigin("origins:origin", "origins:avian");
    }
});

3. Reference in JSON Datapacks

{
  "type": "origins_js:js_entity_action",
  "id": "heal_half"
}

See examples for more examples including custom actions, conditions, and powers.

Documentation

  • API Reference — full type table and static shortcut methods
  • Examples — code examples for origins/powers, custom actions, conditions, and powers

The Origins JS (Legacy) Team

GrandArtisan tier frameprofile avatar
  • 100
    Followers
  • 71
    Projects
  • 34.1M
    Downloads
Donate

More from IAFEnvoyView all