HexJSNeo
通过 KubeJS 提供为 Hex Casting(六边形施法)创建自定义内容的方法。
特性
核心概念
- 最小化投入:自动注册的大型图案标签,省略所有可选参数,管道化一切……
- 弱类型:
ActionJS返回值、ActionRegistryJS.of等 - 可变性至上:无注册事件和阶段限制,在启动脚本中随处编写和重载,我们正在编写 JS \yay/
- 干净的全局作用域:所有内容都在单一的
HexJS全局对象下,无泄漏
游戏内容注册表
ActionJS:所有可执行文件的基础- 可定制的
operate和operateInParens,具有高度自由的返回值处理 - 用于创建
operate变体的额外辅助方法 - 分配
mediaCost以在操作时自动附加介质消耗副作用,配合preCheckMedia方法帮助在逻辑之前进行检查和处理意外情况
- 可定制的
ActionRegistryJS:将特定图案与动作关联- = 注册表 ID + 图案原型 + 内部
ActionJS+ 大型图案标记(默认为 false) - 弱类型构造函数
ActionRegistryJS.of(...):其构造函数的参数顺序任意,缺失的参数会自动填充(id 来自图案签名,新鲜的ActionJS,false);仅图案是必需的 - 内部
ActionJS的透明代理:操作设置器(setOperate及其变体)、mediaCost和preCheckMedia可直接在注册表对象上调用 - 大型法术会自动打上按世界/启蒙状态的标签
- = 注册表 ID + 图案原型 + 内部
SpecialHandlerJS:接受任意图案并检索其含义- 注册一个 JS
tryMatch(pattern, env)工厂,用于检查每个绘制的图案 SpecialHandlerJS.create(action, name)用于构建SpecialHandler,其中action可以是另一个特别创建的ActionJS- 链式设置器
setTryMatch用于类 KJS 的使用方式
- 注册一个 JS
IotaJS:高度可定制的 iota 类型- 基于 NBT 的自定义 iota:
IotaJS.type(id)创建类型,包含CompoundTagiota 数据 - 使用回调或常量覆盖常见的 iota 接口(显示、颜色、大小等)
- 通过
setOperate实现可选的可执行性,控制其在括号内外部的执行行为
- 基于 NBT 的自定义 iota:
ArgsJS:基本上是对各种内置 Kotlin 扩展函数的转发器- 手动用于可变 iota 列表,或从
ActionJS.setOperateArgsSplit调用 - 带自动意外处理的类型获取器(
double、vec3、entity等),在缺少参数或类型错误时触发
- 手动用于可变 iota 列表,或从
CastingEnvironmentComponentJS:原版但在 JS 中,具有更便捷的 Key 创建- 每个组件以一个字符串键作为第一个构造函数参数,从中自动创建并缓存
Key(稍后使用setKey更改) - 用法和类型与原版的相同
- 每个组件以一个字符串键作为第一个构造函数参数,从中自动创建并缓存
MishapJS:高度可定制的意外类型- 首先使用
MishapJS.type()声明类型,与IotaJS非常相似 - 调用
type.create()或type.create(data)以创建此类型的意外 - 类 KJS 的管道方法来覆盖所创建意外的所有行为
- 首先使用
ArithmeticJS和OperatorJS:自定义算术持有者及其图案运算符- 带有 iota 类型谓词(
Accepts)和管道操作设置器的声明式运算符,支持原始形式或参数拆分形式 - 将运算符绑定到内置或自定义图案,脚本重载时引擎会自动使这些绑定失效
- 带有 iota 类型谓词(
生活质量 (QoL) 特性
- 热替换一切
- 一切皆简单,如同
/kjs reload startup-scripts - 涵盖:动作(入口动作及原型就地替换)、特殊处理器、iota 类型、算术运算(包括其运算符)
- 不适用于那些未在启动时创建的,但可以通过 使用特殊处理器 匹配稍后创建的图案动作 :3
CastingEnvironmentComponentJS和MishapJS生来就是临时的,不在此范围内
- 一切皆简单,如同
- API 及包导入器:
HexJS.API与HexJS.APIFlat- 暴露从模组 jar 扫描到的所有 Hex Casting 类,既可以按包嵌套(
HexJS.API.<...package>.<Class>)也可以扁平化(HexJS.APIFlat)
- 暴露从模组 jar 扫描到的所有 Hex Casting 类,既可以按包嵌套(
ProbeJS 类型支持
- 为面向 JS 的 API 生成类型定义,包括嵌套的
HexJS.API层级、展平为静态字段的伪单例类,以及分配到其父类的子类成员
HexJSNeo
Provides a way to create custom contents for Hex Casting via KubeJS.
Features
Core Concepts
- Minimal efforts: auto registered great pattern tags, omit all optional args, pipe everything, ...
- Weak typed:
ActionJSreturns,ActionRegistryJS.of, etc. - Mutable is best: no registration event and phase limit, writing and reloading everywhere in startup scripts, we're writing JS \yay/
- Clean global scope: everything under a single
HexJSglobal object, no leaks
Game Content Registry
ActionJS: basis for all executables- customizable
operate&operateInParens, with high degree-of-freedom return value handling - additional helper methods for creating
operatevarieties - assigning
mediaCostto auto-attach media-cost side effect on operate, withpreCheckMediamethods to help check & mishap before logics
- customizable
ActionRegistryJS: registering certain patterns with actions- = Registry ID + Pattern prototype + inner
ActionJS+ Great-pattern marker (default false) - weak-typed constructor
ActionRegistryJS.of(...): args in any order among its constructor, missing ones auto-filled (id from pattern signature, freshActionJS,false); only the pattern is required - transparent proxy of inner
ActionJS: operate setters (setOperate& variants),mediaCostandpreCheckMediaare callable directly on the registry object - great spells are auto-tagged with per-world / enlightenment tags
- = Registry ID + Pattern prototype + inner
SpecialHandlerJS: taking an arbitrary pattern and retrieving its meanings- registers a JS
tryMatch(pattern, env)factory consulted for every drawn pattern SpecialHandlerJS.create(action, name)to help build aSpecialHandler, in whichactioncould be another specially createdActionJS- chain setter
setTryMatchfor KJS-ish usage
- registers a JS
IotaJS: highly customizable iota types- NBT-backed custom iotas:
IotaJS.type(id)creates the type, containingCompoundTagiota data - overriding common iota interfaces (display, color, size, etc.) with either callbacks or constants
- optional executability via
setOperate, controlling its execution behaviors outside and inside parens
- NBT-backed custom iotas:
ArgsJS: basically a forwarder for various built-in Kotlin extension functions- used on a mutable iota list manually, or called from
ActionJS.setOperateArgsSplit - typed getters (
double,vec3,entity, ...) with auto mishaps on missing args or wrong types
- used on a mutable iota list manually, or called from
CastingEnvironmentComponentJS: vanilla but in JS, with more convenient Key creation- each component takes a key string as the first constructor arg, from which the
Keyis auto-created & cached (setKeyto change it later) - usages and types same as vanilla
- each component takes a key string as the first constructor arg, from which the
MishapJS: highly customizable mishap types- declaring the type using
MishapJS.type()first, quite similar toIotaJS - calling
type.create()ortype.create(data)for a mishap of this type - KJS-ish piped methods to override all behaviors of created mishaps
- declaring the type using
ArithmeticJSandOperatorJS: custom arithmetic holders and their pattern operators- declarative operators with iota-type predicates (
Accepts) and piped operate setters, either raw or args-split - bind operators to builtin or custom patterns, with the engine auto-invalidated on script reload
- declarative operators with iota-type predicates (
QoL Features
- Hot-swap everything
- everything, simple as
/kjs reload startup-scripts - covers: actions (entry action & prototype replaced in-place), special handlers, iota types, arithmetics (including their operators)
- not for those haven't created on startup, but it's possible to match later-created pattern actions using a SPECIAL handler :3
CastingEnvironmentComponentJSandMishapJSare born temporary and not covered here
- everything, simple as
- API & packages importer:
HexJS.API&HexJS.APIFlat- exposes all Hex Casting classes scanned from the mod jar, either nested by package (
HexJS.API.<...package>.<Class>) or flat (HexJS.APIFlat)
- exposes all Hex Casting classes scanned from the mod jar, either nested by package (
ProbeJS Typing Support
- generates typings for the JS-facing API, including nested
HexJS.APIlevels, fake-singleton classes flattened to static fields, and subclass members assigned onto their parents
版本游戏版本平台发布时间本站下载
开发版
1.21.1-0.1.3.pre68
HexJSNeo-neoforge-1.21.1-0.1.3.pre68
1.21.1 NeoForge 1 天前 ·
0
1.21.1
NeoForge
1 天前
0
下载 HexJSNeo
版本:1.21.1-0.1.3.pre68
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.2.1.pre64
HexJSNeo-neoforge-1.21.1-0.1.2.1.pre64
1.21.1 NeoForge 3 周前 ·
0
1.21.1
NeoForge
3 周前
0
下载 HexJSNeo
版本:1.21.1-0.1.2.1.pre64
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.2.pre64
HexJSNeo-neoforge-1.21.1-0.1.2.pre64
1.21.1 NeoForge 3 周前 ·
0
1.21.1
NeoForge
3 周前
0
下载 HexJSNeo
版本:1.21.1-0.1.2.pre64
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.2.pre64
HexJSNeo-neoforge-1.21.1-0.1.2.pre64
1.21.1 NeoForge 3 周前 ·
0
1.21.1
NeoForge
3 周前
0
下载 HexJSNeo
版本:1.21.1-0.1.2.pre64
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.1.pre64
HexJSNeo-neoforge-1.21.1-0.1.1.pre64
1.21.1 NeoForge 1 个月前 ·
0
1.21.1
NeoForge
1 个月前
0
下载 HexJSNeo
版本:1.21.1-0.1.1.pre64
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.1.pre53
HexJSNeo-neoforge-1.21.1-0.1.1.pre53
1.21.1 NeoForge 2 个月前 ·
0
1.21.1
NeoForge
2 个月前
0
下载 HexJSNeo
版本:1.21.1-0.1.1.pre53
游戏版本:1.21.1
平台:NeoForge
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
开发版
1.21.1-0.1.1
HexJSNeo-neoforge-1.21.1-0.1.1
1.21.1 NeoForge 2 个月前 ·
0
1.21.1
NeoForge
2 个月前
0
下载 HexJSNeo
开发版
1.21.1-0.1.0
HexJSNeo-neoforge-1.21.1-0.1.0
1.21.1 NeoForge 2 个月前 ·
0
1.21.1
NeoForge
2 个月前
0
下载 HexJSNeo
1.21.1-0.1.3.pre68
开发版
2026-11-26
- bugfix:
mediaCostsetter 现在能正确地从 action 传递到 registry 对象 - 升级了 TreeList 转换器,现已支持普通数组和列表
- 移除了
SpellContinuation->ContinuationIota的自动包裹机制,以防止冲突 :(
已更新至 Pre 68 最新的官方 1.21 alpha;更多信息请参阅 此 Discord 公告
1.21.1-0.1.2.1.pre64
开发版
2026-11-01
- 为
ArithmeticJS提供更完整的 ProbeJS 支持 IotaJS着色全面重构- 自动转换溢出的 JS 输入
- 修复:默认 IotaJS 类型颜色不再透明
已更新以支持 Pre 64 最新的官方 1.21 alpha 版本;更多信息请参阅 此 Discord 公告
1.21.1-0.1.2.pre64
开发版
2026-10-31
1.21.1-0.1.1.pre64
开发版
2026-10-16
遵循了又一项重大变更
已使用 Pre 64 最新官方 1.21 alpha 进行更新;有关更多信息,请参阅 此 Discord 公告
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
Woot Revived
pharuxtan
一个用于收集生物掉落物的多区块模组。
生物科技
349
模组
玉Jade ?
Snownee
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
实用前置
341
模组
物品管理器Just Enough Items (JEI)
mezz
查看物品与配方
前置实用
240
模组
KubeJS
Lat
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
前置实用
239
模组
AAA Particles
ChloePrime
适用于 MC 1.18+ 的 Effekseer 加载器
前置装饰
186
模组
WTHIT
deirn
那是什么?一个 Waila/Hwyla 的分支。
前置实用
165
评论 0
登录后参与评分
还没有评论,来抢沙发吧