这是 myramyr(GitHub 用户 'limeae')对 fxn.zip 的说明
概述:
此数据包旨在添加对数组操作、命令列表以及未来调度命令的支持,并包含一些克隆功能。
原版 Minecraft:
- Minecraft 的运行速度为每秒 20 刻(ticks),每刻会运行所有必要的游戏更新。
本数据包使用“刻”而非秒(只需乘以 20)。
- “命名空间(Namespace)”是 Minecraft 数据引用中可以通过
/data 命令访问的任何位置。例如:
"data get storage draft:draft example.data"、"entity @p Health"
- 宏(Macros)是放入函数命令中的变量,它们会替换函数中被引用的任何位置。例如:
/function fxn:command {command:"summon warden"}
其中 fxn:command 包含 | return run $(command)
那么实际执行的命令将是:"return run summon warden"
注意宏可以来自命名空间,但不能同时提供两者(至少不容易做到)
- Minecraft 运行命令时会带入上下文环境:{实体的 UUID(或 'Server' 或 '@')、x、y、z、r0、r1、维度}
当玩家执行命令时,使用的是玩家的 UUID 和位置数据,
但作为服务器执行的命令(以及通过 /schedule 调度的命令)则以 'Server' 身份在 0 0 0 0 0 的主世界运行
fxn:command/* 和 fxn:schedule 会手动获取、设置并存储这些上下文以供将来使用
fxn:context/* 用于获取这些上下文(使用方法很有趣,请阅读每个函数)
函数:
Fxn:
Array:
数组的一般函数
fxn:array/delete/rand 删除命名空间数组中的随机一项
fxn:array/delete/clamp 从命名空间数组中随机删除条目,直到达到最大值
fxn:array/append 将值追加到命名空间数组末尾
fxn:array/prepend 将值插入到命名空间数组开头
fxn:array/cmd 在命名空间数组的每个条目上运行命令
fxn:array/get_max 获取命名空间数组的大小,拥有 1 个条目的数组其大小为 0
fxn:array/if_value 对命名空间中匹配该值的每个条目运行命令
Command:
带上下文的命令执行
fxn:command/merge 使用所有提供的上下文运行命令,默认值会自动设置
fxn:command/handle 使用所有上下文运行命令,分为 ((uuid|无 uuid) | (storage|无 storage)) 两种情况
Context:
将上下文保存到命名空间
fxn:context/block 将当前位置的方块保存到命名空间
fxn:context/player 将当前玩家的昵称保存到命名空间(来自 Mojang 服务器)
fxn:context/pos_int 将当前位置 [x, y, z, r0, r1, dim] 以整数形式保存到命名空间
fxn:context/pos 将当前位置 [x, y, z, r0, r1, dim] 以浮点数形式保存到命名空间
fxn:context/uuid 将当前实体的连字符十六进制 UUID 保存到命名空间
Schedule:
调度(并清除)带有提供上下文的命令,以便在未来执行
fxn:schedule 在经过 timedelta 时间后调度命令,使用所有提供的上下文及其他参数,循环 n 次
fxn:schedule/clear 清除所有已调度的命令
fxn:schedule/clear/ifs 清除满足所有提供条件的已调度命令
fxn:command 执行命令
fxn:raycast 以给定间隔向前执行命令,最多迭代指定次数
fxn:list 按顺序执行提供的命令列表
tl;dr 使用 fxn:schedule 在未来调度命令
使用 fxn:list 执行命令列表
工具:
Select:
选择一个方块区域和另一个等效区域,用于各种克隆命令
tool:select 在当前执行 tool:select/extend
tool:move 在当前执行 tool:select/move
tool:select/extend 扩展玩家的方块区域以包含提供的方块
tool:select/move 移动玩家的等效区域以包含提供的方块
tool:select/strict_move 按提供的偏移量 x, y, z 移动玩家的等效区域
tool:select/particle 显示两个区域的玩家框粒子效果
tool:select/deselect 移除玩家的区域选择
Op(eration):
对两个区域(一个方块区域和一个等效区域)执行各种克隆操作
注意这些函数可以使用玩家的区域,也可以显式提供 x, y, z, dx, dy, dz, qx, qy, qz(以及其他宏)
tool:op/clone 将方块区域克隆到等效区域
tool:op/move clone replace 将方块区域移动到等效区域
tool:op/undo/move clone replace 将等效区域移回方块区域
tool:op/interpolate 将方块区域移动到等效区域,通过一系列延迟克隆实现,最多持续到提供的 timedelta
tool:particle/box 显示盒子区域边缘的粒子效果
tool:kit 给予命令方块,在放置的方块处运行 tool:select 和 tool:move
tl;dr 使用蓝色方块扩展区域,粉色方块移动其副本,并使用 tool:op/move(或 clone 或其他)对这两个区域进行操作
This is an explanation of fxn.zip, by myramyr (github 'limeae')
Overview:
This datapack aims to add support for array operations, lists of commands,
and commands scheduled in the future, as well as some clone functionality
Vanilla Minecraft:
- Minecraft runs at 20 ticks per second, where each tick runs all necessary game updates.
This datapack uses ticks instead of seconds (just multiply by 20).
- A "Namespace" is any position in Minecraft's data referrable by the data command. Ex:
"storage draft:draft example.data", "entity @p Health"
- Macros are variables put into the function command which replace any place in the function they are referenced. Ex:
/function fxn:command {command:"summon warden"}
where fxn:command contains | return run $(command)
then the command ran will be: "return run summon warden"
note that macros can be provided from namespaces, but not both (at least easily)
- Minecraft runs commands with contexts: {the entity's uuid (or 'Server' or '@'), x, y, z, r0, r1, dimension}
where commands ran as the player use the player's uuid and position data,
but commands ran as the server (and by /schedule) run as 'Server', at 0 0 0 0 0 overworld
fxn:command/* and fxn:schedule manually get, set, and store these contexts for future use
fxn:context/* get these contexts (using interesting methods, please read each function)
Functions:
Fxn:
Array:
general functions for arrays
fxn:array/delete/rand deletes a random entry in the namespaced array
fxn:array/delete/clamp deletes a random entries in the namespaced array until the max is reached
fxn:array/append appends the value to the namespaced array
fxn:array/prepend prepends the value to the namespaced array
fxn:array/cmd runs the command at every entry in the namespaced array
fxn:array/get_max gets the size of the namespaced array, with an array with 1 entry having a size of 0
fxn:array/if_value runs the command for each entry in the namespaced that matches the value
Command:
runs commands with contexts
fxn:command/merge runs the command with all provided contexts, where the defaults are automatically set
fxn:command/handle runs the command with all contexts, splitting into ((uuid|no uuid) | (storage|no storage))
Context:
saves contexts to the namespace
fxn:context/block saves the block at the current position to the namespace
fxn:context/player saves the current player's nickname to the namespace (from mojang servers)
fxn:context/pos_int saves the current position [x, y, z, r0, r1, dim] as integers to the namespace
fxn:context/pos saves the current position [x, y, z, r0, r1, dim] as doubles to the namespace
fxn:context/uuid saves the current entity's hyphenated hexadecimal uuid to the namespace
Schedule:
schedules (and clears) commands to be ran in the future with provided contexts
fxn:schedule schedules the command after the timedelta has elapsed with all provided contexts and other, for n loops
fxn:schedule/clear clears all scheduled commands
fxn:schedule/clear/ifs clears all scheduled commands that meet every provided if statement
fxn:command runs the command
fxn:raycast runs the command forward at given intervals with a maximum iterations
fxn:list runs the provided list of commands in order
tl;dr use fxn:schedule to schedule commands in the future
use fxn:list to run a list of commands
Tool:
Select:
select a region of blocks and another equivalent region for various clone commands
tool:select runs tool:select/extend at the current position
tool:move runs tool:select/move at the current position
tool:select/extend extends the player's block region to include the provided block
tool:select/move moves the player's equivalent region to include the provided block
tool:select/strict_move moves the player's equivalent region by the provided offset x, y, z
tool:select/particle shows the player box particles for both regions
tool:select/deselect removes the player's region selections
Op(eration):
operates on a region of blocks and another equivalent region with various clone commands
note these functions can use the player's regions, or explicity provided x, y, z, dx, dy, dz, qx, qy, qz (and other macros)
tool:op/clone clones the block region to the equivalent region
tool:op/move clone replace moves the block region to the equivalent region
tool:op/undo/move clone replace moves the equivalent region to the block region
tool:op/interpolate moves the block region to the equivalent region with a series of delayed clones up to the provided timedelta
tool:particle/box shows particles for the edges of a box region
tool:kit gives command blocks that run tool:select and tool:move at the placed block
tl;dr use the blue block to extend a region, the pink block to move its copy, and tool:op/move (or clone, or other) to operate on the 2 regions
评论 0
登录后参与评分
还没有评论,来抢沙发吧