介绍
中文介绍正在准备中,下面暂时显示原文。
Origins JS
This is a KubeJS integration for Origins (NeoForge), allowing you to manage origins and powers via KubeJS.
Note: This is my first time to make a KubeJS addon, most code written by DeepSeek and reviewed by my self. So if you
think some APIs are weird or not well-designed, please let me know.
Features
- Origin & Power Management: Grant, revoke, and check origins/powers from JS scripts.
- Custom Actions: Define
EntityAction,BlockAction,ItemAction,BiEntityActionin JavaScript. - Custom Conditions: Define
EntityCondition,BlockCondition,ItemCondition,BiEntityCondition,
BiomeCondition,DamageCondition,FluidConditionin 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. - Parameters Support: Pass custom parameters from JSON to your JS callbacks for dynamic behavior and high
reusability. - PowerHelper Integration: Exposes the new
PowerHelperAPI for power querying (hasActive,toggle) and advanced power data (Resource, Cooldown, EntitySet).
Dependencies
Quick Start
1. Install all dependencies, then place your .js scripts in kubejs/server_scripts/.
2. Basic Usage
// Recommended: use HelperWrapper (backed by new PowerHelper API)
let helper = OriginsJS.getHelper(event.player);
// Grant / revoke power & manage origin (HolderWrapper still works too)
let holder = OriginsJS.getHolder(event.player);
holder.grantPower("origins:origin", "origins:fire_immunity");
holder.setOrigin("origins:origin", "origins:human");
// Active state
helper.anyActive(); // any power active?
helper.hasActive("origins:climbing"); // specific power active?
helper.toggle("primary"); // toggle by key
// Execute callback on active powers
helper.execute("origins:climbing", (holderRef, power) => {
holderRef.getEntity().tell("Climbing!");
});
// Modify base value (for modifier powers)
let modified = helper.modifyDouble("origins:modify_attribute", 10.0);
// Resource / Cooldown / Entity Set (also on helper)
helper.setResource("origins:climbing", 20);
helper.startCooldown("origins:fireball");
helper.addToEntitySet("mypack:friends", event.player.getStringUuid());
See examples for more examples including custom actions, conditions, and powers.
Documentation
- API Reference — full type table, HolderWrapper API, and static shortcut methods
- Examples — code examples for origins/powers, custom actions, conditions, and powers
常见问题
Origins JS 支持哪些 Minecraft 版本?
Origins JS 支持 Minecraft Java 版 1.21.1,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。
Origins JS 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
IAFEnvoy 的其他作品
查看全部 →Jupiter
by IAFEnvoy
一个强大的自动同步配置前置库。
1371万
18 天前
CurseForge
Uranus
by IAFEnvoy
一个前置库,包含动画引擎、对象辅助工具等功能。部分基于 LLibrary 和 Citadel。
1132万
2 个月前
CurseForge
IceAndFire Community Edition
by IAFEnvoy
Ice and Fire 的社区版
1066万
24 天前
CurseForge
Ice And Fire Patcher
by IAFEnvoy
一个简单的 Ice And Fire 补丁
744.4万
6 个月前
CurseForge
评论
登录后评论和评分