HexParse 模组


提供了一对模式(patterns)和一组命令,用于将自定义代码转换为(模式或字面量)列表 iota;需要玩家手持焦点物品。

(旧版 KubeJS 版本 在此处)
| 示例代码 |
示例 Iota |
示例 Iota (彩色嵌套) |
 |
 |
 |
高亮 VSCode 扩展 已在市场提供 (源代码)。
支持的 IO 物品类型
- Focuses
- Spell Books
- (1.20) Thought Knots
- 通过物品类识别(通过物品类层级进行匹配),可通过
HexParseAPI 或 IOMethod 添加更多
新增命令
读取与写入
/hexParse <code string> [rename]: 将输入代码解析为支持的手持物品;可选的 rename 参数用于重命名该物品。
/hexParse read: 读取手持物品的 iota,将其解析为代码并在聊天窗口中显示;点击结果时会自动复制。
/hexParse read_signatures: 与 read 相同,但忽略所有已知的模式 ID,并将所有内容输出为角度签名(angle signatures)。
/hexParse clipboard [rename]: 读取客户端剪贴板文本并解析为支持的手持物品;可选的 rename 参数用于重命名该物品。
/hexParse clipboard_angles [rename]: 与 clipboard 相同,但仅接受使用原始角度字符串输入的模式,例如 "wedsaq"。
/hexParse clipboard_hexpattern [rename]: (实验性) 与 clipboard 相同,但接受 .hexpattern 格式;警告:仅支持部分功能。
/hexParse share: (实验性) 与 read 相同,但会将 iota 的原始内容和可点击复制的解析代码广播给服务器上的每位玩家。
/hexParse read_hexbug: 与 read 相同,但将结果转换为 discord HexBug 的 /patterns hex 命令所使用的格式。注意:非模式常量和一些旧的注册表名称仍需手动处理
/hexParse mind_stack ...: 从玩家的思维(staff 施放 VM)中读取/写入 iota
... peek: 读取思维栈中的最后一个 iota;如果栈为空则返回 null
... push <code>: 解析代码并将其推入思维栈
... push_clipboard: 同上,但代码来自剪贴板
/hexParse property ...: (Hexcellular 互操作) 获取/设置 PropertyIota 的数据;出于安全原因,使用的属性名均强制添加前导 _
... read <propName>: 从特定属性读取并解析
... write <propName> <code>: 将代码写入特定属性
... clipboard <propName>: 同上,但代码来自剪贴板
配置
/hexParse (macro/dialect) ...: 编辑客户端保存的代码方言(1 对 1 映射,不以 # 开头)和宏(映射到代码段,以 # 开头)
... list: 列出所有保存的宏/方言;存在几个预定义的宏,源自 自然
... define <key> <value>: 定义宏/方言映射;可以是全新的,也可以是覆盖现有的。
macro define_clipboard <key>: 同上,但仅适用于宏,并读取玩家的剪贴板
... remove <key>: 移除给定键的映射条目(如果存在)
/hexParse conflict: 解决具有相同短名称(ID 路径)的多个模式之间的冲突
- 仅在物理客户端(单人游戏、本地多人游戏)或拥有 OP 权限时启用
... 或 ... list: 列出由多个长 ID 指向的所有短名称
... list <short_name>: 列出在特定短名称下的所有冲突 ID
... set <short_name> <long_ID>: 将特定短名称重定向到输入的模式 ID
杂项与辅助工具
/hexParse donate [amount]: 向自然捐赠自定义数量的媒体。如果因使用此模组而感到内疚,请进行捐赠 ::)
/hexParse learn_great: 读取手持物品并学习其中的伟大模式。
/hexParse lehmer [...nums]: 计算给定排列的 Lehmer 码(按升序排列,例如 0 1 2 3 4);输入项应以空格分隔;结果数字可用于 骗子赌注。
仅限 OP 的命令
/hexParse unlock_great (unlockAll|lockAll|unlock <pattern id>|lock <pattern id>): 通过一次性锁定/解锁所有模式或每次执行时锁定/解锁单个伟大模式,来控制当前世界的伟大模式解锁过程。
新增模式
switch_comment: 将输入的 Comment Iota 转换为 String Iota,或将其他所有内容转换为 Comment Iota;若没有 MoreIotas 则无效。
code2focus: 等同于 /hexParse clipboard(现在不仅限于聚焦)。
focus2code: 等同于 /hexParse read。
remove_comments: 清除来自(嵌套)列表输入的注释 iota。
learn_patterns: 读取手持物品并学习其中的伟大模式。
create_linebreak: 向堆栈中添加带有指定数量空格缩进的换行注释 iota。
donate: 等同于 /hexParse donate。
- (伟大法术)
compile: 接收一个 MoreIotas 字符串 iota,并将其解析为代码列表;若没有 MoreIotas 则无效。
简介也写在书中的 HexParse Patterns 部分。
杂项功能
- 在每种模式的页面中,按下
Shift 键可显示该模式的注册 ID。
新 Iota: CommentIota
CommentIota 会显示其内部的字符串,并解析为一个空 iota(ID 为 "hexparse:comment"),执行时不执行任何操作。
注释 iota 包括文本注释、换行符与缩进,以及未知的伟大法术占位符。
当玩家按住 Shift 键时,所有注释将被隐藏。
HexParseAPI
- 位置:
io.yukkuric.hexparse.api.HexParseAPI
- 内容:
AddForthParser(p: IStr2Nbt)
AddForthParser(p: IStr2Nbt, id: String) — 替换之前在同一 ID 下注册的解析器
AddBackParser(p: INbt2Str)
AddBackParser(p: INbt2Str, id: String) — 相同的基于 ID 的替换
RemoveForthParser(p: IStr2Nbt)
RemoveBackParser(p: INbt2Str)
<T : SpecialHandler> AddSpecialHandlerBackParser(cls: Class<T>, func: (T, CompoundTag) -> String)
CreateItemIOMethod(cls: Class<*>, writer: ((ItemStack, CompoundTag) -> Unit)?, reader: ((ItemStack) -> CompoundTag?)?, priority: Int = 0, validator: ((ItemStack, Boolean) -> Boolean)?)
有关详细的使用指南,请参阅 How-To (由 DeepSeek-v4.1-Flash 生成)
外部文档
支持的表达式
有关所有可用符号,请参阅 此文件。
可用配置
有关所有可用配置,请参阅 此文件。
HexParse mod


Provides a pair of patterns and a set of commands to convert custom code into (pattern or literal) list iota; requires
player to have a focus item in hand.

(Old KubeJS version HERE)
| Example Code |
Example Iota |
Example Iota (Colorful Nested) |
 |
 |
 |
The
highlight VSCode extension
is available on the Marketplace (source code).
Supported IO Item Types
- Focuses
- Spell Books
- (1.20) Thought Knots
- recognized by item classes (matched through the item class hierarchy), able to add more via
HexParseAPI or IOMethod
Commands Added
Reading & Writing
/hexParse <code string> [rename]: parse input code into supported held item; optional rename argument to rename the item.
/hexParse read: read handheld item's iota, parse into code and show in chat window; the result will be copied
when clicked.
/hexParse read_signatures: same as read, but ignores all known pattern IDs and outputs all as angle signatures.
/hexParse clipboard [rename]: read client clipboard text and parse into supported held item; optional rename argument to rename
the item.
/hexParse clipboard_angles [rename]: same as clipboard, but only accept patterns input with raw angle string like
"wedsaq".
/hexParse clipboard_hexpattern [rename]: (experimental) same as clipboard, but accepts .hexpattern format; warning: only partial features supported.
/hexParse share: (experimental) same as read but broadcasts iota's raw content and click-copy-able parsed code to
every player in the server.
/hexParse read_hexbug: same as read but translates the result to the format used by discord HexBug's /patterns hex command. note:
non-pattern constants and some old registry names still need to be handled manually
/hexParse mind_stack ...: read/write iota from player's mind (staff casting VM)
... peek: read the last iota inside mind stack; gets null if stack is empty
... push <code>: parse code and push into mind stack
... push_clipboard: same as above, but code comes from clipboard
/hexParse property ...: (Hexcellular interop) get/set data for PropertyIota; used property names all force-added leading _ for security reason
... read <propName>: read and parse from certain property
... write <propName> <code>: write code into certain property
... clipboard <propName>: same as above, but code comes from clipboard
Configs
/hexParse (macro/dialect) ...: edit client-saved code dialects (1-on-1 mapping, not starting with #) and macros (
mapped to code segments, starting with #)
... list: list all saved macros/dialects; there exist several predefined macros from the nature
... define <key> <value>: define a macro/dialect mapping; could be fresh-new or overriding existed one.
macro define_clipboard <key>: same as above, but only for macros, and reads player's clipboard
... remove <key>: remove mapping entry with given key (if exists)
/hexParse conflict: conflict resolver for multiple patterns with same short name (ID path)
- only enables in physical client (singleplayer, local multiplayer) or with OP permission
... or ... list: list all short names pointed by multiple long IDs
... list <short_name>: list all conflicting IDs under certain short name
... set <short_name> <long_ID>: redirect certain short name to input pattern ID
Misc. & Helpers
/hexParse donate [amount]: donate custom amount of media to the nature. Pay if you feel guilty using this mod ::)
/hexParse learn_great: Read handheld items and learns great pattern(s) inside.
/hexParse lehmer [...nums]: calculate lehmer code for given permutation (from ascending, e.g. 0 1 2 3 4); input
should be separated with space; the result number can be used for Swindler's Gambit.
OP-Only Commands
/hexParse unlock_great (unlockAll|lockAll|unlock <pattern id>|lock <pattern id>): controls great pattern unlocking
process of current
world by locking/unlocking all at once, or a single great pattern each execution.
Patterns Added
switch_comment: Transforms input Comment Iota into String Iota, or everything else into Comment Iota; has no effect without MoreIotas.
code2focus: Equivalent to /hexParse clipboard (now not only focuses).
focus2code: Equivalent to /hexParse read.
remove_comments: Clears comment iotas from a (nested) list input.
learn_patterns: Read handheld items and learns great pattern(s) inside.
create_linebreak: Adds a line-break comment iota with space-indents of given number to the stack.
donate: Equivalent to /hexParse donate.
- (great spell)
compile: takes in a MoreIotas string iota, and parses it into a code list; has no effect without MoreIotas.
Introduction also written in HexParse Patterns section inside the book.
Misc. Features
- At each pattern's page, press
Shift to display the pattern's registry ID
New Iota: CommentIota
CommentIota displays string inside, and parses into a null iota (with id: "hexparse:comment") which executes doing
nothing.
Comment iotas includes text comments, line-breaks & indents, and unknown great spell placeholders.
When player holds Shift key, all comments will be hidden.
HexParseAPI
- Location:
io.yukkuric.hexparse.api.HexParseAPI
- Contents:
AddForthParser(p: IStr2Nbt)
AddForthParser(p: IStr2Nbt, id: String) — replaces the parser previously registered under the same ID
AddBackParser(p: INbt2Str)
AddBackParser(p: INbt2Str, id: String) — same ID-based replacement
RemoveForthParser(p: IStr2Nbt)
RemoveBackParser(p: INbt2Str)
<T : SpecialHandler> AddSpecialHandlerBackParser(cls: Class<T>, func: (T, CompoundTag) -> String)
CreateItemIOMethod(cls: Class<*>, writer: ((ItemStack, CompoundTag) -> Unit)?, reader: ((ItemStack) -> CompoundTag?)?, priority: Int = 0, validator: ((ItemStack, Boolean) -> Boolean)?)
For detailed usage guides, see How-To (Generated by DeepSeek-v4.1-Flash)
External Documents
Supported Expressions
see this file for all available symbols.
Available Configs
see this file for all available configs.
评论 0
登录后参与评分
还没有评论,来抢沙发吧