🎬 Survirec
一个原生的数据包库,用于记录玩家的动作并用假人(或任何其他生物)进行回放。
无需模组、无需资源包:仅使用命令。
- 🎥 记录行走、疾跑、跳跃、潜行、游泳、鞘翅飞行、装备变化和手臂摆动。
- 🧱 同时记录动作:攻击实体、按下按钮和拉杆、打开门、陷阱门和栅栏门、放置和破坏方块。世界可以在每次循环后恢复原状。
- 🔁 在关键帧之间插值回放动作(每
N 刻生成一个关键帧,以保持序列较小)。
- 🧍 默认使用假人,但任何活体实体均可工作。支持针对每次回放覆盖皮肤、纹理、大小、速度、延迟、姿势和装备。
- 📋 序列被复制进一个命令方块的命令中(过长的命令会被拆分成命令方块链):无需移动文件。
- 🏁 挑战模式:记录一名玩家(即使在创造模式下也可以)运行
X 秒,随后拥有相同皮肤的克隆体会以循环方式重播该过程。多个录制可以同步为一组。
- ⚡ 低成本回放:每个实体和每刻仅需一条得分更新和一条
tp 宏命令。静止的实体不会被传送,且附近没有玩家的实体会被暂停。
- 🧩 遵循 Smithed 规范。
📦 嵌入式库:将其打包在你的数据包内部,而不是单独分发。多个数据包可以在同一个世界中嵌入不同版本的 Survirec:只有最新版本会运行(参见规范)。
基于 Minecraft Java 26.2 开发。依赖于 Bookshelf Block (bs.block),已包含在 Survirec_datapack_with_libs.zip 中。
由 Artyu24 制作。
⚡ 快速开始
所有操作都通过 函数标签 #survirec:v1/... 进行。每个标签接收一个单一的 with 复合标签,其中的每个字段都是可选的。
function #survirec:v1/start {with:{name:"walk",every:4}}
你会获得一个停止物品(右键点击以停止,潜行+右键点击可同时走回起点)以及聊天栏中的红色按钮。
录制结束后,点击聊天栏中的黄色按钮以复制回放命令,然后将其粘贴到命令方块中。
运行 function #survirec:v1/help(作为玩家)以获取游戏内帮助,每个主题都有一个对话框及复制按钮。
入口点
| 函数标签 |
with 字段(默认值) |
#survirec:v1/start |
name ("rec"), every (4), group (""), group_radius (50). 以要录制的玩家身份运行 |
#survirec:v1/stop |
无。由玩家运行:停止其录制。由命令方块运行:停止所有录制 |
#survirec:v1/stop_loop |
无。停止并走回起点 |
#survirec:v1/abort |
无。由玩家运行:取消其录制。由命令方块运行:取消所有录制 |
#survirec:v1/play |
name,以及下方的回放字段。可选的 data 用于导入序列 |
#survirec:v1/part |
f, d. 长序列的一部分(命令方块链) |
#survirec:v1/challenge_cmd |
与 challenge 相同的字段。显示一个复制挑战命令的按钮(供命令方块使用,由菜单调用) |
#survirec:v1/challenge |
id ("default"), time (30), group ("main"), sync (0), tp_back (1). 以玩家身份运行 |
#survirec:v1/kill |
tag 或 name(二选一必需)。使用 kill_all 删除所有内容 |
#survirec:v1/kill_all |
无 |
#survirec:v1/group_restart |
group, radius (50). 重启该组中最近的场景;radius:0 重启所有同名场景 |
#survirec:v1/forget |
name. 删除存储的序列 |
#survirec:v1/range |
r (128). 动画范围(方块数) |
#survirec:v1/settings |
range (128), move_every (2). 缺失的字段保留其原值。参见性能优化 |
#survirec:v1/help |
无。打开帮助对话框(以玩家身份运行) |
#survirec:v1/help_page |
page (1). 打开帮助对话框的一页(1 到 5) |
#survirec:v1/reset |
无。取消所有录制并清除录制数据 |
#survirec:v1/debug |
无。列出动画实体 |
#survirec:v1/menu |
无。打开 Survirec 菜单(以玩家身份运行) |
#survirec:v1/menu_item |
无。将菜单物品给予运行该命令的玩家 |
#survirec:v1/records |
无。在聊天栏中列出你保存的录制 |
#survirec:v1/commands |
无。显示带有复制按钮的有用命令 |
#survirec:v1/export |
name. 再次显示已保存录制的复制按钮 |
execute as @p run function #survirec:v1/start {with:{name:"walk",every:4}}
execute positioned 10 64 10 run function #survirec:v1/play {with:{name:"walk",loop:1,speed:150}}
execute as @p run function #survirec:v1/challenge {with:{id:"a",time:5,group:"room1"}}
function #survirec:v1/kill {with:{tag:"door"}}
跟随一个在你距离超过 5 个方块时停止的 NPC:function #survirec:v1/play {with:{name:"npc",range:5}}。
只有 #survirec:v1/... 函数标签是公开的。survirec:v<version>/ 下的所有内容(例如 survirec:v1.2.0/)均为内部内容,并随每个版本而变化。
菜单
execute as @p run function #survirec:v1/menu_item
给予 Survirec 物品。右键点击它以打开菜单:开始录制、准备挑战命令(任意时长,复制后放入命令方块)、停止或取消、列出你的录制文件(在你站立的位置播放其中一个、再次复制其命令、删除它)、获取有用的命令以便复制、打开游戏内帮助或此 README。
该菜单也位于暂停屏幕中,Smithed 数据包 列表之下。
每条完成的录制都会以它的名字保存在世界中:#survirec:v1/play {with:{name:"walk"}} 会在不复制数据的情况下重放它。
该物品是一个相机头模 (minecraft-heads.com,自定义头颅 ID 120246)。若要使用其他头模,请将它的 base64 textures 值粘贴到 MENU_HEAD_TEXTURE(user/menu.py)中并重新构建(留空则为望远镜外观)。
菜单和所有聊天按钮都运行 /function,因此它们仅对操作员有效。获得该物品的非操作员可以打开菜单,但没有任何按钮能执行任何操作。
对话框仅在世界或服务器启动时加载:更新数据包后,请重启而不是使用 /reload。
播放字段
录制开始后复制的命令包含以下字段。在运行命令方块之前编辑它们。
| 字段 |
含义 |
name |
序列名称(字母、数字、_) |
pos |
实体出现的位置。默认:你开始录制的位置。"~ ~ ~" 是命令方块的中心,"~ ~-0.5 ~" 是其站立的地板位置 |
entity |
minecraft:mannequin(默认)或任何活体实体 |
size |
缩放比例。1 正常,0.5 一半,2 双倍 |
loop |
1 循环,0 播放一次并保持存在,2 播放一次后消失(无死亡动画,不掉落任何物品) |
redstone |
1:在每个循环结束时,一个红石块会被放置在启动播放的命令方块上方 2 个方块处(中间隔一个方块,因此不会再次给启动命令方块充能),并在 4 刻后被移除(产生脉冲,因此紧邻放置的命令方块每次都会触发)。如果该位置不为空,则不放置任何物品。若有 group,则在每个组周期结束时生效。默认 0 |
restore |
世界还原:1 在每个新循环开始时(默认),2 也在实体结束播放时(loop 为 0 或 2 时),0 从不还原。除非设置为 0,否则 kill 也会还原 |
hit_players |
1:实体的攻击也会伤害玩家(默认 0) |
speed |
百分比。100 正常 |
delay |
启动延迟(以刻为单位),用于使多个实体不同步 |
range |
此播放的暂停距离(方块):只有当玩家在 range 个方块范围内时,实体才会移动。0(默认)使用全局范围(#survirec:v1/range,默认为 128) |
tag |
再次触发方块会将实体替换为此标签。标签在全局范围内有效:请为每个建筑使用唯一的标签,否则两个相同的建筑副本会互相消除对方的实体 |
group |
组名称。同组的实体同时开始和结束(见下文)。loop 然后应用于整个组 |
group_radius |
距离(方块,默认 50),在此距离内实体会加入同名现有组 |
pose |
留空则保持录制的姿态。否则强制指定:standing(站立)、crouching(蹲下)、swimming(游泳)、sleeping(睡觉)、fall_flying(滑翔) |
skin |
玩家名称(仅限假人) |
texture |
Base64 textures 属性值,若 skin 为空时使用 |
head chest legs feet mainhand offhand |
物品覆盖。留空则保持录制的装备 |
data |
录制的序列(f, n, y, p, d, e, s, a)。请勿编辑 |
挑战组
每个双人动作都属于一个组(默认为 main)。同一玩家和组的动作会同时开始和结束:
较短的动作会在最后位置冻结,直到最长的动作完成,然后全部走回起点(2 秒)并一起重新开始。
再次触发挑战会移除该玩家之前针对该 id 的双人动作,并记录一个新的。
时间结束后,玩家会被传送回录制开始的位置,面朝相同的方向(tp_back:1,默认)。若设为 tp_back:0,则留在原地。
多名玩家可以同时录制,各自拥有自己的序列或挑战。
与组同步录制
使用 sync:1,录制不会立即开始:它会处于待命状态,并在组的动作开始新循环的确切时刻启动。
在第一个动作播放时录制第二个版本,那么两者将在每个循环开始时一起启动:
execute as @p run function #survirec:v1/challenge {with:{id:"a",time:10,group:"scene1"}}
execute as @p run function #survirec:v1/challenge {with:{id:"b",time:10,group:"scene1",sync:1}}
如果该组还没有任何动作,录制将立即开始。#survirec:v1/abort 可取消待命的录制。
动作
在录制过程中,Survirec 还会记录你对世界的操作。在播放期间,实体会在同一时刻、相对于其起点相同的位置再次执行这些操作:
| 操作 |
记录时机 |
回放表现 |
| 攻击 (Hit) |
你击中了一个实体 |
位于该实体正前方的所有实体都会受到相当于玩家手持相同武器(拳头 1、钻石剑 7...)的伤害,并附带击退效果。仅对玩家生效,需设置 hit_players:1 |
| 交互 (Interact) |
你右键点击按钮、拉杆、门(非铁门)、活板门(非铁活板门)或栅栏门 |
方块被按下或切换状态,从而触发红石反应,包括通过按钮或拉杆所附着的方块进行传导(例如后方有一个命令方块也会工作)。按钮会在 1 秒后(石头材质)或 1.5 秒后(木质材质)弹起 |
| 放置 (Place) |
你放置了一个方块 |
放置相同的方块,并保持其朝向(对于门和床:包含两端部分) |
| 破坏 (Break) |
你注视的方块消失 |
方块以粒子效果和声音被破坏;不会掉落任何物品 |
压力板和绊线无需额外设置:实体走在上面时会自动触发它们。
世界恢复。 在改变方块之前,实体会将其复制到一个隐藏的维度中(survirec:vault,一个无法到达的空界世界)。启用 restore:1 后,每个循环开始时,所有复制的方块会按相反顺序放回原位,确保每个循环都从相同的世界状态开始。仅恢复该实体自身改变的方块:由活塞推动的方块、流动的水、被杀死的生物等不会被恢复。
每个实体只在其第一次改变方块时进行一次复制:相同的副本将在每次循环中使用,因此隐藏维度不会随着场景循环而增长。当实体消失时,其副本会被释放;执行 #survirec:v1/kill_all 可重置整个区域。
录制期间,你自己的改动会在录制结束或被中断(停止、取消、断开连接、reset)后立即撤销:这些动作由回放时的实体执行。Survirec 会保存你当前视线范围内 3x3x3 方块的副本,以便知晓你在破坏、放置或使用某物之前的原始状态。
该维度仅在世界或服务器启动时创建:安装或更新数据包后,请重启服务器而非使用 /reload。
限制条件:空中的攻击以及未注视时破坏的方块不会被记录。附魔和攻击冷却时间未被计入。方块及其完整状态通过 Bookshelf 的方块模块读取,因此可以还原游戏版本中的所有方块。
经典回放的组(Groups)
挑战组属于单个玩家。经典回放(#survirec:v1/play)使用本地组:组由名称 和 位置共同定义。
function #survirec:v1/play {with:{name:"a",group:"scene1"}}
function #survirec:v1/play {with:{name:"b",group:"scene1"}}
当实体出现时,它会加入距离最近且名称相同的组,范围在 group_radius 格内(默认为 50)。如果不存在这样的组,则创建一个新组。
因此,将同一场景放置在相距较远的两个位置会产生两个独立的组,但使用相同的命令方块。对于大于 50 格的场景,请提高 group_radius 值;若要将同一场景的两个副本保持超过 group_radius 的距离分开,需分别管理。
同一组内的实体会等待最慢的那个成员完成。后续行为取决于 loop 参数:
loop |
当组内所有实体完成后发生的情况 |
1 |
它们走回起点(耗时 2 秒),然后同时重新开始(默认值) |
0 |
它们冻结在最后的位置 |
2 |
它们消失 |
在同一刻生成的组内实体(例如由同时触发的命令方块生成)将同时开始。稍后生成的实体将等待下一个循环(对于不循环的组,直到 group_restart 为止)。
#survirec:v1/group_restart {with:{group:"scene1"}} 可随时重启最近的 scene1(在 radius 范围内,默认为 50),例如用于重播一个不循环的组。
要与组同步录制新的片段,请在 #survirec:v1/start 中提供 group 参数:
function #survirec:v1/start {with:{name:"b",every:4,group:"scene1"}}
录制将加入距离玩家 group_radius 格范围内的最近 scene1 组,处于待命状态,并在该组开始新循环时启动。如果附近没有此类组,则立即开始。执行 #survirec:v1/abort 可取消录制。
权限
只有操作员(OP)可以使用 Survirec:所有入口点均为 /function,且数据包不包含 /trigger。
非操作员只能参与由命令方块启动的挑战(即带有 execute as @p run function #survirec:v1/challenge {...} 的按钮或压力板)。玩家无法停止或取消挑战。
📡 信号
你可以向这些函数标签中添加自定义函数。
| 标签 |
触发时机 |
执行者 |
#survirec:v1/signals/on_record_start |
录制(或挑战)刚刚启动 |
正在被录制的玩家(真实玩家,而非木偶实体) |
#survirec:v1/signals/on_record_stop |
录制已结束 |
曾被录制的玩家。如果玩家在录制过程中离开,则在他们返回时发送此信号 |
#survirec:v1/signals/on_spawn |
回放实体刚刚创建 |
新实体(木偶实体) |
🗂️ 序列格式
序列存储在 survirec:data 存储下的 seqs.<name> 路径中。数据包可以在其加载函数中自带自己的序列:
data modify storage survirec:data seqs.walk set value {n:4,y:0,p:0,d:[[120,0,-340,500,0,0]],e:[],s:[]}
| 键 |
含义 |
n |
两个关键帧之间的刻数 |
y / p |
起始偏航角 / 俯仰角,单位为百分之一度 |
d |
关键帧 [dx,dy,dz,dyaw,dpitch,flags]:相对于上一个关键帧的增量,单位分别为千分之一方块和百分之一度。flags(标志位):1 表示潜行,2 表示游泳,4 表示滑翔 |
e |
装备事件 {k:<关键帧索引>,v:{<装备>}} |
| s | 发生手臂摆动的时间点(以刻为单位) |
| a | 动作 {t:<tick>,k:<kind>}。其中 k:1 表示攻击,2 表示使用,3 表示放置,4 表示破坏。除了攻击之外,x、y、z 给出相对于起始方块的坐标;放置动作还包含 b(带有其状态的方块),对于门或床,还包含 p(另一半) |
然后使用 #survirec:v1/play {with:{name:"walk"}} 来运行它。
🧩 规范
-
命名空间:所有函数、标签、分数板、队伍和存储均以 survirec 为前缀。
-
版本控制:每个函数和进度均位于 survirec:v<version>/(例如 survirec:v1.2.0/)下,因此不同版本的文件互不覆盖。公共入口点为 #survirec:v1/... 函数标签(仅主版本号):每个版本会在版本守卫后将其各自的 survirec:v<version>/api/<name> 添加至其中。未来的 v2 可与之并存,而不会破坏 v1 用户的使用。
-
数据包 ID 与加载:pack.mcmeta(包含 "id": "survirec")及带版本控制的加载逻辑(LanternLoad)由 StewBeet 从 beet.yml 生成。当多个数据包嵌入了 Survirec 时,enumerate / resolve 标签会选出最新版本:仅该版本会被加载、运行 tick、响应 #survirec:v1/... 标签并记录操作(其进度也会检查版本号)。
-
依赖项:StewBeet 会查找 #bs.block: 调用,在加载时检查 Bookshelf Block 的版本(若缺失则显示可点击的消息),并将模块焊接到 Survirec_datapack_with_libs.zip 中。
-
数据包启用标签(#survirec:installed、#survirec:major 等):由 StewBeet 从 Minecraft 26.3 生成,因为所需注册表在该版本中存在。
-
数据包菜单对话框:survirec:about 列于 #smithed:data_packs(暂停屏幕)中,且 required: false。
-
标签规范:生成的实体携带 smithed.entity 和 smithed.strict;停止物品携带 {smithed:{ignore:{everything:1b}}},菜单项携带 {smithed:{ignore:{functionality:1b,crafting:1b}}}。
⚡ 性能
实体在运行时的开销:每个 tick 执行少量记分板操作,并在每 move_every 个 tick 执行一次传送(默认为 2)。实体轮流行动,因此每个 tick 仅有一半的实体会移动。挥击、动作和计时完全精确到 tick:只有可见位置更新的频率较低,客户端会在其间平滑处理移动效果。move_every:1 最为流畅,3 或 4 则最轻量。
| 实体状态 |
消耗 |
播放中,且玩家在 range 范围内 |
完整消耗(见上文) |
已暂停(无玩家在 range 范围内)、冻结(loop:0)或等待其所在组别 |
几乎可以忽略不计:每刻执行 3 次检查 |
| 在序列中静止不动 |
不传送 |
数量多少? 这取决于服务器的硬件配置,因此需要自行测量:运行 /tick query(它显示每刻的平均毫秒数,即 mspt),添加实体,并保持在大约 40 mspt 以下(50 = 卡顿)。作为一个粗略的数量级估计,同时有数百个实体在玩家附近播放,而远处有许多实体处于暂停状态。除了服务器性能外,每个木偶都是一个需要渲染的玩家模型:当屏幕上出现数百个时,玩家的帧率往往首先成为瓶颈。
若想进一步优化:降低 range 值,使只有靠近玩家的实体才会播放;提高 move_every 的值;并在录制时优先使用 every:4 或更大的值(以减少需要读取的关键帧数量)。
🔍 注意事项
-
名称 (name, id, group, tag):仅包含字母、数字和下划线 _,长度为 1 到 32 个字符。其他任何内容都会因消息被拒绝。
-
每位玩家一个录制:每位玩家都有自己独立的录制状态,因此多名玩家可以同时录制。已经处于录制状态或持有武器的玩家将被拒绝(挑战压力板会被静默忽略)。
-
录制期间离开:当玩家返回时,录制将被取消。
-
装备名称、描述文本、书的内容和自定义数据不会被记录:它们在回放实体上是不可见的,且其中的引号会破坏复制的命令。
-
长时间的录制会导出为多个命令(每个命令包含 300 个关键帧)。当装备和手臂摆动较多时,它们会获得各自的命令,以保持不超过命令方块的大小限制。
-
皮肤使用玩家名称,这需要在线模式服务器才能解析该名称。
-
对方块或实体的攻击和右键点击会被记录为挥动动作。在空中挥动无法通过数据包检测,除非阻止玩家的真实交互行为。
-
录制坐标以整数形式存储:请保持在距离原点约 200 万格以内的范围。
-
pose、profile 和 equipment 使用目标版本的实体字段:如果未来版本重命名了这些字段,请进行检查。
🛠️ 开发
基于 StewBeet(一种 Beet 框架)构建,与其他 Smithed 风格的库类似(Cinemalya、CommonSignals...)。
没有手写的数据包文件:所有函数、标签、进度、对话框和维度均由 user/ 目录下的 Python 代码生成,具体取决于 beet.yml 中的版本。
本地构建
要求:Python 3.14 或更高版本 以及 uv。
uv run stewbeet
从项目文件夹(包含 beet.yml 的那个)中运行它。然后 build/ 将包含:
| 文件 |
内容 |
Survirec_datapack.zip |
仅 Survirec(需单独安装 Bookshelf Block) |
Survirec_datapack_with_libs.zip |
包含合并后的 Bookshelf Block(Smithed Weld):推荐分发版本 |
首次构建会从 Modrinth 下载 Bookshelf Block(缓存于 .beet_cache/)。uv run stewbeet watch 会在每次更改时重新生成。
若要每次构建后直接将数据包复制到世界目录中,请取消注释 beet.yml 中的 build_copy_destinations。
项目结构
| 路径 |
作用 |
beet.yml |
项目配置:id、作者、版本、Minecraft 版本、管道设置 |
user/link.py |
构建入口点:调用下方的所有模块 |
user/api.py |
公开函数标签(默认值、名称检查、版本守卫)及信号 |
user/common.py |
模块间共享的命令片段(聊天文本、按钮、按轴循环等...) |
user/load.py |
目标、世界状态、tick 和卸载 |
user/record.py、playback.py、spawn.py、challenge.py、vault.py、core.py |
录制、回放、生成、挑战、方块复制、管理 |
user/block.py |
基于 Bookshelf Block 的方块读取 |
user/menu.py、help_pages.py、dialogs.py |
菜单项、帮助对话框、其他对话框 |
user/resources.py |
维度、方块和物品标签、进度 |
upload.py |
发布版本(GitHub、Modrinth、Smithed) |
CHANGELOG.md |
每个版本的变更记录 |
StewBeet 会生成 pack.mcmeta、带版本控制的加载逻辑(LanternLoad)、依赖检查、记分板常量(#<n> survirec.data)、函数头部以及卸载函数。
版本号仅保存在 beet.yml 中。
发布
构建完成后运行 uv run python upload.py。它会从 ~/stewbeet/credentials.yml 读取令牌。
📄 许可证
MIT
🎬 Survirec
A vanilla datapack library that records a player's movements and replays them with a mannequin (or any other living entity).
No mods, no resource pack: only commands.
- 🎥 Records walking, sprinting, jumping, sneaking, swimming, elytra flight, equipment changes and arm swings.
- 🧱 Records actions too: hitting entities, pressing buttons and levers, opening doors, trapdoors and fence gates, placing and breaking blocks. The world can be put back as it was at every loop.
- 🔁 Replays the movement in a loop, interpolated between keyframes (one keyframe every
N ticks, so sequences stay small).
- 🧍 Mannequin by default, but any living entity works. Per-playback skin, texture, size, speed, delay, pose and equipment overrides.
- 📋 The sequence is copied into one command block command (long ones are split in a command block chain): no file to move around.
- 🏁 Challenge mode: a player (even in adventure) is recorded for
X seconds, then a double with their skin replays the run in a loop. Several recordings can be synchronized in a group.
- ⚡ Cheap playback: scores and one
tp macro per entity and tick. Stationary entities are not teleported, and entities with no player nearby are paused.
- 🧩 Follows the Smithed conventions.
📦 Embedded library: package it inside your datapack rather than shipping it separately. Several datapacks can embed different versions of Survirec in the same world: only the newest one runs (see Conventions).
Developed for Minecraft Java 26.2. Depends on Bookshelf Block (bs.block), already included in Survirec_datapack_with_libs.zip.
Made by Artyu24.
⚡ Quick start
Everything goes through the function tags #survirec:v1/.... Each one takes a single with compound, and every field inside is optional.
function #survirec:v1/start {with:{name:"walk",every:4}}
You get a stop item (right-click to stop, sneak + right-click to also walk back to the start) and red buttons in the chat.
When the recording ends, click the yellow button in the chat to copy the playback command, then paste it in a command block.
Run function #survirec:v1/help (as a player) for the in-game help, one dialog per topic with copy buttons.
Entry points
| Function tag |
with fields (defaults) |
#survirec:v1/start |
name ("rec"), every (4), group (""), group_radius (50). Run as the player to record |
#survirec:v1/stop |
none. Run by a player: stops their recording. Run by a command block: stops all of them |
#survirec:v1/stop_loop |
none. Stops and walks back to the start point |
#survirec:v1/abort |
none. Run by a player: cancels their recording. Run by a command block: cancels all of them |
#survirec:v1/play |
name, plus the playback fields below. Optional data to import a sequence |
#survirec:v1/part |
f, d. One part of a long sequence (chain of command blocks) |
#survirec:v1/challenge_cmd |
Same fields as challenge. Shows a button that copies the challenge command for a command block (used by the menu) |
#survirec:v1/challenge |
id ("default"), time (30), group ("main"), sync (0), tp_back (1). Run as the player |
#survirec:v1/kill |
tag or name (one is required). Use kill_all to remove everything |
#survirec:v1/kill_all |
none |
#survirec:v1/group_restart |
group, radius (50). Restarts the nearest scene of that group; radius:0 restarts every scene of that name |
#survirec:v1/forget |
name. Deletes the stored sequence |
#survirec:v1/range |
r (128). Animation range in blocks |
#survirec:v1/settings |
range (128), move_every (2). Missing fields keep their value. See Performance |
#survirec:v1/help |
none. Opens the help dialog (run as a player) |
#survirec:v1/help_page |
page (1). Opens one page of the help dialog (1 to 5) |
#survirec:v1/reset |
none. Cancels every recording and clears the recording data |
#survirec:v1/debug |
none. Lists the animated entities |
#survirec:v1/menu |
none. Opens the Survirec menu (run as a player) |
#survirec:v1/menu_item |
none. Gives the menu item to the player who runs it |
#survirec:v1/records |
none. Lists your saved recordings in the chat |
#survirec:v1/commands |
none. Shows the useful commands with copy buttons |
#survirec:v1/export |
name. Shows the copy buttons of a saved recording again |
execute as @p run function #survirec:v1/start {with:{name:"walk",every:4}}
execute positioned 10 64 10 run function #survirec:v1/play {with:{name:"walk",loop:1,speed:150}}
execute as @p run function #survirec:v1/challenge {with:{id:"a",time:5,group:"room1"}}
function #survirec:v1/kill {with:{tag:"door"}}
Following an NPC that stops when you get more than 5 blocks away: function #survirec:v1/play {with:{name:"npc",range:5}}.
Only the #survirec:v1/... function tags are public. Everything under survirec:v<version>/ (for example survirec:v1.2.0/) is internal and changes with every version.
Menu
execute as @p run function #survirec:v1/menu_item
Gives the Survirec item. Right-click it to open a menu: start a recording, prepare a challenge command (any duration, copied for a command block), stop or cancel it, list your recordings (play one where you stand, copy its command again, delete it), get the useful commands to copy, open the in-game help or this README.
The menu is also in the pause screen, under the Smithed Data Packs list.
Every finished recording is kept in the world under its name: #survirec:v1/play {with:{name:"walk"}} replays it without the copied data.
The item is a camera head (minecraft-heads.com, Custom Head ID 120246). To use another head, paste its base64 textures value in MENU_HEAD_TEXTURE (user/menu.py) and rebuild (empty = spyglass look).
The menu and every chat button run /function, so they only work for operators. A non-operator who gets the item can open the menu but no button does anything.
Dialogs are only loaded when the world or server starts: after updating the datapack, restart instead of /reload.
Playback fields
The command copied after a recording starts with these fields. Edit them before running the command block.
| Field |
Meaning |
name |
Sequence name (letters, digits, _) |
pos |
Where the entity appears. Default: where you started recording. "~ ~ ~" is the center of the command block, "~ ~-0.5 ~" the floor it stands on |
entity |
minecraft:mannequin (default) or any living entity |
size |
Scale. 1 normal, 0.5 half, 2 double |
loop |
1 loop, 0 play once and stay, 2 play once and disappear (no death animation, nothing dropped) |
redstone |
1: at the end of every loop, a redstone block is placed 2 blocks above the command block that started the playback (one block gap, so it does not power the launching command block again), and removed 4 ticks later (a pulse, so a command block placed right next to it fires every time). Nothing is placed if that spot is not empty. With a group, at the end of every group cycle. Default 0 |
restore |
World restoring: 1 at every new loop (default), 2 also when the entity ends (loop 0 or 2), 0 never. kill restores too unless 0 |
hit_players |
1: the entity's hits also damage players (default 0) |
speed |
Percent. 100 normal |
delay |
Start delay in ticks, to desynchronize several entities |
range |
Pause distance in blocks for this playback: the entity only moves while a player is within range blocks of it. 0 (default) uses the global range (#survirec:v1/range, 128 by default) |
tag |
Triggering the block again replaces the entity with this tag. The tag is global to the world: use a unique one per build, otherwise two copies of a build erase each other's entities |
group |
Group name. Entities of the same group start and finish together (see below). loop then applies to the whole group |
group_radius |
Distance (blocks, default 50) within which an entity joins an existing group of the same name |
pose |
Empty keeps the recorded poses. Otherwise forced: standing, crouching, swimming, sleeping, fall_flying |
skin |
Player name (mannequin only) |
texture |
Base64 textures property value, used if skin is empty |
head chest legs feet mainhand offhand |
Item overrides. Empty keeps the recorded equipment |
data |
The recorded sequence (f, n, y, p, d, e, s, a). Do not edit |
Challenge groups
Every double belongs to a group (main by default). Doubles of the same player and group start and finish together:
a shorter double stays frozen on its last position until the longest one is done, then all of them walk back to their start point (2 seconds) and start again together.
Triggering a challenge again removes the player's previous double for that id and records a new one.
When the time is up, the player is teleported back to where the recording started, facing the same way (tp_back:1, default). With tp_back:0, they stay where they are.
Several players can record at the same time, each one their own sequence or challenge.
Recording in sync with a group
With sync:1, the recording does not start immediately: it is armed, and starts exactly when the doubles of the group start a new cycle.
Record a second take while the first one plays, then both start together on every cycle:
execute as @p run function #survirec:v1/challenge {with:{id:"a",time:10,group:"scene1"}}
execute as @p run function #survirec:v1/challenge {with:{id:"b",time:10,group:"scene1",sync:1}}
If the group has no double yet, the recording starts at once. #survirec:v1/abort cancels an armed recording.
Actions
While recording, Survirec also notes what you do to the world. During playback, the entity does it again at the same moment and at the same place (relative to its start point):
| Action |
Recorded when |
Played back as |
| Hit |
You hit an entity |
Every entity just in front of the entity takes the damage of a player holding the same weapon (fist 1, diamond sword 7...), with knockback. Players only with hit_players:1 |
| Interact |
You right-click a button, a lever, a door (not iron), a trapdoor (not iron) or a fence gate |
The block is pressed or toggled, so redstone reacts, including through the block the button or lever is attached to (a command block behind it works). Buttons are released after 1 s (stone) or 1.5 s (wood) |
| Place |
You place a block |
The same block, with its orientation (doors and beds: both halves) |
| Break |
A block you look at disappears |
The block is broken with its particles and sound; nothing is dropped |
Pressure plates and tripwires need nothing: the entity walking on them triggers them.
World restoring. Before changing a block, the entity copies it into a hidden dimension of the pack (survirec:vault, a void world no player can reach). With restore:1, every copied block is put back at the start of each loop, in reverse order, so each loop starts from the same world. Only the blocks the entity changed itself are restored: blocks pushed by a piston, flowing water, mobs killed... are not.
Each entity copies a block only once, the first time it changes it: the same copy is used at every loop, so the hidden dimension does not grow while scenes loop. The copies of an entity are freed when it disappears, and #survirec:v1/kill_all resets the whole area.
While recording, your own changes are undone as soon as the recording ends or is interrupted (stop, cancel, disconnection, reset): the entity is the one doing them on playback. Survirec keeps a copy of the 3x3x3 blocks you are looking at, so it knows what was there before you broke, placed or used something.
The dimension is only created when the world or server starts: after installing or updating the datapack, restart instead of /reload.
Limits: hits in the air and blocks broken while not looking at them are not recorded. Enchantments and attack cooldown are not taken into account. Blocks and their full state are read with Bookshelf's block module, so every block of the game version can be placed back.
Groups for classic playback
Challenge groups belong to one player. Classic playbacks (#survirec:v1/play) use local groups: a group is a name and a place.
function #survirec:v1/play {with:{name:"a",group:"scene1"}}
function #survirec:v1/play {with:{name:"b",group:"scene1"}}
When an entity appears, it joins the nearest group of the same name within group_radius blocks (50 by default). If there is none, it starts a new group.
So the same scene pasted at two places far apart gives two independent groups, with the same command blocks. Raise group_radius for scenes larger than 50 blocks, and keep two copies of a scene more than group_radius apart.
Entities of the same group wait for the longest one. What happens next depends on loop:
loop |
When all the entities of the group have finished |
1 |
They walk back to their start point (2 seconds) and start again together (default) |
0 |
They stay frozen on their last position |
2 |
They disappear |
Entities of a group that are created in the same tick (for example by command blocks triggered together) start together. One created later waits for the next cycle (for a group that does not loop, until group_restart).
#survirec:v1/group_restart {with:{group:"scene1"}} restarts the nearest scene1 (within radius, 50 by default) at any time, for example to replay a group that does not loop.
To record a new take in sync with a group, give group to #survirec:v1/start:
function #survirec:v1/start {with:{name:"b",every:4,group:"scene1"}}
The recording joins the nearest scene1 within group_radius blocks of the player, is armed, and starts when that group starts a new cycle. If there is no such group nearby, it starts at once. #survirec:v1/abort cancels it.
Permissions
Only operators can use Survirec: every entry point is a /function, and the datapack has no /trigger.
Non-operators can only take part in a challenge started by a command block (button or pressure plate with execute as @p run function #survirec:v1/challenge {...}). A challenge cannot be stopped or cancelled by the player.
📡 Signals
Add your own function to these function tags.
| Tag |
When |
Runs as |
#survirec:v1/signals/on_record_start |
A recording (or challenge) has just started |
the player being recorded (the real player, not the mannequin) |
#survirec:v1/signals/on_record_stop |
A recording has ended |
the player who was recorded. When a player leaves during a recording, it is sent when they come back |
#survirec:v1/signals/on_spawn |
A playback entity has just been created |
the new entity (the mannequin) |
🗂️ Sequence format
Sequences live in the storage survirec:data, under seqs.<name>. A datapack can ship its own in its load function:
data modify storage survirec:data seqs.walk set value {n:4,y:0,p:0,d:[[120,0,-340,500,0,0]],e:[],s:[]}
| Key |
Meaning |
n |
Ticks between two keyframes |
y / p |
Start yaw / pitch, in hundredths of a degree |
d |
Keyframes [dx,dy,dz,dyaw,dpitch,flags]: deltas from the previous keyframe, in thousandths of a block and hundredths of a degree. flags: 1 sneaking, 2 swimming, 4 gliding |
e |
Equipment events {k:<keyframe index>,v:{<equipment>}} |
s |
Ticks at which an arm swing happened |
a |
Actions {t:<tick>,k:<kind>}. k: 1 hit, 2 use, 3 place, 4 break. Except hits, x y z give the block relative to the start block; a place also has b (the block with its state) and, for a door or a bed, p (the other half) |
Then play it with #survirec:v1/play {with:{name:"walk"}}.
🧩 Conventions
- Namespacing: every function, tag, score, team and storage is prefixed with
survirec.
- Versioning: every function and advancement lives under
survirec:v<version>/ (for example survirec:v1.2.0/), so two versions never overwrite each other's files. The public entry points are the #survirec:v1/... function tags (major version only): each version adds its own survirec:v<version>/api/<name> to them, behind a version guard. A future v2 can live next to it without breaking v1 users.
- Pack ID and loading:
pack.mcmeta (with "id": "survirec") and the versioned load (LanternLoad) are generated by StewBeet from beet.yml. When several datapacks embed Survirec, the enumerate / resolve tags elect the newest version: only that one loads, ticks, answers the #survirec:v1/... tags and records the actions (its advancements check the version too).
- Dependencies: StewBeet finds the
#bs.block: calls, checks the Bookshelf Block version at load (with a clickable message when it is missing) and welds the module into Survirec_datapack_with_libs.zip.
- Pack enabled tags (
#survirec:installed, #survirec:major...): generated by StewBeet from Minecraft 26.3, where the registry they need exists.
- Data pack menu dialog:
survirec:about is listed in #smithed:data_packs (pause screen), with required: false.
- Tag specification: spawned entities carry
smithed.entity and smithed.strict; the stop item carries {smithed:{ignore:{everything:1b}}}, the menu item {smithed:{ignore:{functionality:1b,crafting:1b}}}.
⚡ Performance
Cost of an entity while it plays, per tick: a few scoreboard operations, and one teleport every move_every ticks (2 by default). Entities take turns, so only half of them move on a given tick. Swings, actions and timing stay exact to the tick: only the visible position is updated less often, and the client smooths the movement in between. move_every:1 is the smoothest, 3 or 4 the lightest.
| Entity state |
Cost |
Playing, a player within range |
Full cost (above) |
Paused (no player within range), frozen (loop:0) or waiting for its group |
Almost nothing: 3 checks per tick |
| Standing still in its sequence |
No teleport |
How many? It depends on the server's hardware, so measure it: run /tick query (it shows the average milliseconds per tick, mspt), add entities, and stay under about 40 mspt (50 = lag). As a rough order of magnitude, a few hundred entities playing near players at the same time, and many more paused far from players. Beyond the server, every mannequin is a player model to draw: the players' frame rate often becomes the limit first when hundreds are on screen.
To go further: lower range so that only the entities near players play, raise move_every, and prefer every:4 or more when recording (fewer keyframes to read).
🔍 Notes
-
Names (name, id, group, tag): letters, digits and _ only, 1 to 32 characters. Anything else is refused with a message.
-
One recording per player: every player has their own recording state, so several players can record at the same time. A player who is already recording or armed is refused (a challenge pressure plate is silently ignored).
-
Leaving during a recording: the recording is cancelled when the player comes back.
-
Equipment names, lore, book contents and custom data are not recorded: they are invisible on a playback entity, and quotes in them would break the copied command.
-
A long recording is exported in several commands (300 keyframes each). Equipment and arm swings get their own command when there are many of them, to stay under the command block size limit.
-
Skins use a player name, which needs an online-mode server for the name to be resolved.
-
Hits and right-clicks on blocks or entities are recorded as swings. Swings in the air cannot be detected by a datapack without blocking the player's real interactions.
-
The recording coordinates are stored as integers: stay within about 2 million blocks of the origin.
-
pose, profile and equipment use entity fields of the target version: check them if a future version renames them.
🛠️ Development
Built with StewBeet (a Beet framework), like the other Smithed-style libraries (Cinemalya, CommonSignals...).
There is no hand-written datapack file: every function, tag, advancement, dialog and the dimension are generated by the Python code in user/, under the version of beet.yml.
Build locally
Requirements: Python 3.14 or newer and uv.
uv run stewbeet
Run it from the project folder (the one containing beet.yml). build/ then holds:
| File |
Content |
Survirec_datapack.zip |
Survirec alone (Bookshelf Block must be installed separately) |
Survirec_datapack_with_libs.zip |
Survirec with Bookshelf Block merged in (Smithed Weld): the one to ship |
The first build downloads Bookshelf Block from Modrinth (cached in .beet_cache/). uv run stewbeet watch rebuilds on every change.
To copy the datapack straight into a world after each build, uncomment build_copy_destinations in beet.yml.
Project layout
| Path |
Role |
beet.yml |
Project configuration: id, author, version, Minecraft version, pipeline |
user/link.py |
Build entry point: calls every module below |
user/api.py |
Public function tags (defaults, name checks, version guard) and signals |
user/common.py |
Command fragments shared by the modules (chat text, buttons, per-axis loops...) |
user/load.py |
Objectives, world state, tick and unload |
user/record.py, playback.py, spawn.py, challenge.py, vault.py, core.py |
Recording, playback, spawning, challenges, block copies, management |
user/block.py |
Block reading on top of Bookshelf Block |
user/menu.py, help_pages.py, dialogs.py |
Menu item, help dialogs, other dialogs |
user/resources.py |
Dimension, block and item tags, advancements |
upload.py |
Publishes a release (GitHub, Modrinth, Smithed) |
CHANGELOG.md |
Changes of every version |
StewBeet generates pack.mcmeta, the versioned load (LanternLoad), the dependency check, the scoreboard constants (#<n> survirec.data), the function headers and the unload function.
The version lives in beet.yml only.
Publish
Run uv run python upload.py after a build. It reads the tokens from ~/stewbeet/credentials.yml.
📄 License
MIT
评论 0
登录后参与评分
还没有评论,来抢沙发吧