Server Replay
English | 中文
这是一个完全服务端的 Replay Mod 和 Flashback 实现,此模组允许你同时记录服务器上在线的多个玩家或区块区域。这将生成回放文件,随后可配合 Replay Mod 或 Flashback 进行渲染。
为什么是服务端?
与客户端的 Replay Mod 或 Flashback 录制相比,服务端录制具有许多优势:
- 能够录制静态区块。
- 你可以指定确切的区块大小(不受服务器视距限制)。
- 录制的区块即使卸载也不会影响回放。
- 不会出现区块闪烁(由区块卸载和加载引起)。
- 录制器本身不会加载这些区块(例如 PCRC 就会这样做)。
- 可以根据区块是否正在加载或区块内是否有玩家来暂停和恢复录制。
- 能够单独录制玩家。
- 玩家无需安装 Replay Mod 或 Flashback。
- 你可以一次性录制所有玩家的视角。
- 可以通过配置文件实现录制的自动化。
- 操作员(或拥有相应权限的人)可以随时开始录制。
然而,也存在一些缺点和已知问题:
- 某些功能不会被区块录制所记录,例如自定义Boss血条。
- 玩家录制的内容可能与客户端的 Replay Mod 或 Flashback 不完全一致。
- ServerReplay 并非专为重度魔改服务器设计。
实现了自定义数据包的复杂模组可能不兼容。
使用方法
此模组需要 Fabric 加载器、Fabric API 和 Fabric Kotlin。
服务端有两种录制方式:你可以配置它跟随并从玩家视角进行录制。
或者,你可以录制一个固定的区块区域。
快速入门
注意:
本文档适用于该模组的最新版本,如需了解旧版本,请参阅其他分支。
本节文档将简要引导你完成基本设置。
其中包含了一些重要信息。
玩家
要在你的服务器上录制玩家,你可以运行 /replay start players <player(s)>,例如:
/replay start players senseiwells
/replay start players @a
/replay start players @a[gamemode=survival]
玩家录制器与玩家绑定,并将在服务器的视距范围内进行录制。
如果玩家离开或服务器停止,回放将自动停止并保存。
或者,如果你想手动停止录制,可以运行 /replay stop players <player(s)> <save?>,
使用此命令你还可以在不保存的情况下停止录制,例如:
/replay stop players senseiwells
/replay stop players @r
/replay stop players senseiwells false
回放随后会保存在 "player_recording_path" 指定的位置,位于一个以玩家 UUID 命名的文件夹中。
默认情况下,这会位于 ./recordings/players/<uuid>/<date-and-time>.mcpr。
然后可以将此文件放入客户端的 ./replay_recordings 目录中,并通过 Replay Mod 打开。
警告:
尝试录制 Carpet 机器人或其他非真实玩家的行为可能会导致意外情况。
如果您想录制大范围的区块,请使用区块录制器!
区块
注意:
虽然模组会录制您指定的区块,但 Minecraft 客户端不会渲染最外层的区块。
因此,要录制可见的区块区域,您必须在边界外加一个区块,例如,要录制从 -5, -5 到 5, 5 的可见区域,您必须录制从 -6, -6 到 6, 6 之间的范围。
要在服务器上录制一块区域的区块,您可以运行 /replay start chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> named <name?>,例如:
/replay start chunks from -5 -5 to 5 5 in minecraft:overworld named MyChunkRecording
/replay start chunks from 54 67 to 109 124
/replay start chunks from 30 30 to 60 60 in minecraft:the_nether
或者,您可以指定一个区块及其周围的半径进行录制 /replay start chunks around <chunkX> <chunkZ> radius <radius> in <dimension?> named <name?>,例如:
/replay start chunks around 0 0 radius 5
/replay start chunks around 67 12 radius 16 in minecraft:overworld named Perimeter Recorder
区块录制器是静态的,无法移动,它们只录制指定的区块。
需要注意的是,当回放开始时,指定的区块会被加载(如有必要还会生成)。
然而,在此之后,区块录制器不再加载这些区块。
您可以通过 "chunk_recorder_load_radius" 设置进一步配置此项,这将设置区块录制器加载的最大初始半径,任何超出此半径的已录制区块都需要“自然”加载才能被记录。
如果服务器停止,回放将自动停止并保存。
或者,如果您希望手动停止录制,可以使用其名称停止指定的录制器 /replay stop chunks named <name> <save?>,例如:
/replay stop chunks named "Perimeter Recorder" false
/replay stop chunks named MyChunkRecording
回放随后会保存在 "chunk_recording_path" 指定的位置,位于一个以区块录制器名称命名的文件夹中。
默认情况下,这会位于 ./recordings/chunks/<name>/<date-and-time>.mcpr。
然后可以将此文件放入客户端的 ./replay_recordings 目录中,并通过 Replay Mod 打开。
编码
ServerReplay 支持 Flashback(适用于较新版本)以及 Replay Mod 回放格式。
默认情况下,所有录制都将使用 Replay Mod 的格式;但是,您可以通过在游戏中运行以下命令来更改此设置:
/replay encoding default set flashback
/replay encoding default set replay_mod
注意:
您可以同时使用 Flashback 和 Replay Mod 录制玩家的视角。
您可以通过将默认编码设置为 Flashback,开始录制,然后将编码设置为 Replay Mod 并开始另一次录制来实现这一点。
区块录制也可以这样做,但每个录制器必须具有唯一的名称。
查看
回放录制完成后,您可以在服务器端完全查看该回放。
观看回放的玩家在实际服务器中将被完全移除,他们被视为离线状态。
本质上,这只是“运行”另一个向客户端发送数据包的服务器。这与主服务器异步运行,因此对性能几乎没有影响。
当回放录制完成后,您可以点击聊天中的绿色文本以查看刚刚结束的回放。
查看区块回放的命令是:/replay view chunks <name> <date-time>,而玩家回放的命令是:
/replay view players <uuid> <date-time>,例如:
/replay view player "d4fca8c4-e083-4300-9a73-bf438847861c" "2024-05-11--19-19-55"
/replay view chunks "Chunks (183, 166) to (203, 186)" "2024-05-11--19-19-55"
随后您将被传送至新的“服务器”,回放将开始播放。
在观看回放时,您只能访问有限的命令集,包括:
/replay view pause 暂停当前回放的播放。
/replay view unpause 取消暂停当前回放的播放。
/replay view speed <multiplier> 设置当前回放的播放速度。
/replay view restart 重新开始当前回放的播放。
/replay view close 关闭当前回放并将您带回服务器。
/replay view progress <hide|show> 隐藏或显示进度 Boss 栏。
如果在观看回放时断开连接,登录后您将回到服务器。
下载
如果配置中启用了 "allow_downloading_replays" 并且正确设置了服务器 IP 和下载端口,您可以从服务器下载任何回放。
您可以使用 /replay download 命令获取指定回放的下载 URL,例如:
/replay download players d4fca8c4-e083-4300-9a73-bf438847861c "2024-05-11--19-19-55"
/replay download chunks "Chunks (183, 166) to (203, 186)" "2024-05-11--19-19-55"
这将向您发送一条聊天消息;您可以点击提供的链接以下载文件。
命令
关于所有命令的说明:玩家必须拥有 OP(等级 4),或者如果您使用了权限模组(例如 LuckPerms),玩家可以拥有 server-replay.commands.replay 权限来访问这些命令。
/replay start players <player(s)> 手动开始为指定玩家录制回放。
/replay start chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> named <name?>
手动开始为指定的区块区域录制回放;如果未指定维度,则使用执行命令者所在的维度;名称决定了回放文件将保存在录制路径中的位置。
/replay start chunks around <chunkX> <chunkZ> radius <radius> in <dimension?> named <name?>
此命令与上一条命令效果相同;不过,你可以指定某个给定区块周围的半径范围进行录制。
/replay stop players <player(s)> <save?> 手动停止为指定玩家录制回放;
你可以选择性地传入是否保存回放参数;默认情况下,该值为 true(即保存)。
/replay stop chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> <save?>
手动停止为指定区块区域录制回放;如果未指定维度,则使用执行命令者所在的维度;你可以选择性地传入是否保存回放参数;默认情况下,该值为 true(即保存)。
/replay stop chunks named <name> <save?>
此命令让你可以执行与上一条命令相同的操作;不过,你可以通过名称来指定区块区域。
/replay stop [chunks|players] all <save?> 手动停止所有区块或玩家的回放录制;你可以选择性地传入是否保存回放参数;默认情况下,该值为 true(即保存)。
/replay status 发送一条状态消息,告知回放功能是否已启用,并列出当前正在录制的玩家和区块列表、录制时长以及文件大小。
/replay reload 重新加载回放模组的配置文件。
/replay encoding default set <encoding-type> 设置要录制的回放类型,可选 flashback 或 replay_mod
配置
启动服务器后,会在以下路径生成一个新文件:
./config/server-replay/config.json,默认内容如下所示:
{
"default_encoding": "replay_mod",
"world_name": "World",
"server_name": "Server",
"chunk_recording_path": "./recordings/chunks",
"player_recording_path": "./recordings/players",
"player_recording_name": "{uuid}",
"max_file_size": "0 B",
"restart_after_max_file_size": false,
"max_duration": "0s",
"restart_after_max_duration": false,
"recover_unsaved_replays": true,
"delete_replays_after_duration": "0s",
"log_deleted_replays": true,
"chunk_recorder_load_radius": -1,
"chunk_recording_strategy": "always",
"pause_notify_players": true,
"notify_admins_of_status": true,
"include_resource_packs": true,
"ignore_custom_payloads": false,
"ignore_sound_packets": false,
"ignore_light_packets": true,
"ignore_chat_packets": false,
"ignore_action_bar_packets": false,
"ignore_scoreboard_packets": false,
"optimize_explosion_packets": true,
"optimize_entity_packets": false,
"record_hotbar": false,
"record_voice_chat": false,
"replay_server_ip": null,
"allow_downloading_replays": false,
"automatically_record": false,
"player_predicate": {
"type": "none"
},
"chunks": []
}
| 配置项 |
描述 |
"default_encoding" |
录制回放时使用的编码格式,可选值为 "replay_mod" 或 "flashback"。默认使用 "replay_mod"(若未指定)。 |
"world_name" |
将显示在回放文件中的世界名称。 |
"server_name" |
将显示在回放文件中的服务器名称。 |
"player_recording_path" |
希望保存玩家录制文件的目录路径。 |
"chunk_recording_path" |
希望保存区块录制文件的目录路径。 |
"player_recording_name" |
用于确定每个特定玩家的录制目录名称。默认设置为 "{uuid}",即使用玩家的 UUID。你也可以通过 "{username}" 插入玩家用户名。例如可以设置为:"Recordings for: {username} ({uuid})"。 |
"max_file_size" |
此选项指定回放的 max_file_size 限制。当达到该限制时,录制将自动停止。此处文件大小指的是原始录制数据的大小,而非最终压缩后的回放文件大小,通常最终压缩后的回放文件会小得多。 |
"restart_after_max_file_size" |
如果设置了 max_file_size 且达到了该限制,则回放录制将自动重启,并创建一个新的回放文件。 |
| "max_duration" |
设置回放的最大持续时间。一旦回放录制了指定的时间,它将停止。该值为任意数字后跟单位(也可以有多个单位),例如 "4h 35m 2.1s"。设置为 "0s" 表示没有最大持续时间限制。注意:如果录制器处于暂停状态,其持续时间不会增加。
|
|
"restart_after_max_duration" |
如果设置了 max_duration 且达到了此限制,则回放录制将自动重启,创建一个新的回放文件。
|
|
"recover_unsaved_replays" |
尝试恢复任何未保存的回放,例如当服务器崩溃或在回放停止或完成保存之前停止时。这不能保证回放不会损坏,但会尽力挽救可用的内容。
|
|
"delete_replays_after_duration" |
删除旧回放文件的持续时间。这是自文件上次修改以来的持续时间。持续时间的格式与 max_duration 选项相同,例如 "5d 10h"。设置为 "0s" 以禁用。
|
|
"log_deleted_replays" |
是否在回放因过时而被删除时输出服务器日志。必须启用 delete_replays_after_duration 才能生效。
|
|
"fixed_daylight_cycle" |
如果您不想在长时间延时摄影中保持昼夜循环,这将固定回放中的昼夜循环。该值应设置为一天中的时间点(以刻为单位),例如 6000(正午)。要禁用固定的昼夜循环,请将值设置为 -1。
|
|
"chunk_recorder_load_radius" |
这设置了默认区块记录器的加载半径,当您想要录制非常大的区域而不希望所有记录的区块同时加载时非常有用。
例如,如果您正在录制一个 13x13 的区块区域,您可以将半径设置为 3,这样最中心的 7x7 区块会初始加载,其余区块将在它们“自然”加载时被记录。
设置为 -1 以加载所有区块。
|
|
"chunk_recording_strategy" |
这定义了区块记录器如何记录,有 4 个选项:
-
"always" - 即使区块未加载也始终记录(就像已加载一样) -
"chunk_loaded" - 仅当区域内的任何区块被加载时才记录,如果所有区块都未加载,则暂停记录 -
"chunk_contains_player" - 仅当玩家在该区域内时才记录区块(仅限回溯功能) -
"chunk_contains_non_spectator_player" - 同上,但仅适用于非旁观者玩家(仅限回溯功能)
|
|
"pause_notify_players" |
如果 chunk_recording_strategy 设置为允许录制器自动暂停的选项,并且启用了此项,那么每当区块区域的录制暂停或恢复时,所有在线玩家都会收到通知。
|
|
"notify_admins_of_status" |
启用后,这将通知管理员回放何时开始、何时结束、何时完成保存,以及发生的任何错误。
|
| "include_resource_packs" |
如果启用,所有服务端资源包将被复制到回放文件中,以确保正确播放。禁用此项可减小文件大小,但查看回放时会尝试从原始来源下载该资源包,无法保证此操作能正常工作。(仅 Replay Mod)
|
|
"ignore_custom_payloads" |
如果启用,所有自定义数据包(模组数据包)都将被忽略。如果其他模组的数据包导致录制问题,可以启用此项。
|
|
"ignore_sound_packets" |
如果您正在为延时摄影录制大范围区域,通常不需要录制声音,因为它们会占用大量存储空间。
|
|
"ignore_light_packets" |
光照在客户端和服务端都会进行计算,因此光照数据包大多冗余。
|
|
"ignore_chat_packets" |
如果聊天数据包对您的回放并非必需,则阻止记录来自服务端和其他玩家的聊天数据包。
|
|
"ignore_action_bar_packets" |
如果动作栏数据包对您的回放并非必需,则阻止记录它们。
|
|
"ignore_scoreboard_packets" |
阻止记分板数据包的记录(例如,如果您有一个显示挖掘进度的记分板,它将不会显示,玩家分数也不会被记录)。
|
|
"optimize_explosion_packets" |
通过不向客户端发送爆炸数据包,仅发送爆炸粒子效果和声音,从而大幅减小文件大小。
|
|
"optimize_entity_packets" |
通过让客户端处理部分实体(如投射物和 TNT)的逻辑来减小文件大小。这可能会导致一些不一致性,但影响可能微乎其微。
|
|
"record_hotbar" |
启用此选项以记录玩家的热键栏,从而获得更好的第一人称体验。(仅 Flashback)
|
| "record_voice_chat" |
如果你安装了 simple-voice-chat 模组,此选项将启用语音聊天录制支持。在回放模式下查看时可直接使用,但在 Replay Mod 中观看录制的回放时,必须安装 replay-voice-chat。
|
|
"replay_server_ip" |
如果你的服务器使用了自定义服务端资源包,并且希望在服务端回放查看器中查看这些资源包,则此项为必填。此外,若你希望允许用户下载回放文件,也需设置此项。
此处应填写你服务器的公网 IP 地址。
|
|
"allow_downloading_replays" |
决定用户是否能够下载已录制的回放文件。
|
|
"automatically_record" |
是否根据 "player_predicate" 和/或 "chunks" 配置自动记录玩家或区块。启用后,任何符合定义条件的玩家将被自动记录,而定义的区块将在服务器启动时自动记录。
|
|
"player_predicate" |
用于自动记录玩家的谓词(predicate),更多信息请参阅 Predicates 部分。
|
|
"chunks" |
服务器启动时自动记录的区块列表,更多信息请参阅 Chunks 部分。
|
区块配置
你可以在服务器启动或启用 ServerReplay 时,定义需要自动记录的区块区域。
每个区块定义必须包含:"name"、"dimension"、"from_x"、"to_x"、"from_z" 和 "to_z"。例如:
{
// ...
"chunks": [
{
"name": "My Chunks",
"dimension": "minecraft:overworld",
"from_x": -5,
"from_z": -5,
"to_x": 5,
"to_z": 5
},
{
"name": "My Nether Chunks",
"dimension": "minecraft:the_nether",
"from_x": 100,
"from_z": 50,
"to_x": 90,
"to_z": 60
}
// ...
]
}
谓词配置
你可以定义一个谓词,用于决定服务器上哪些玩家会被自动记录。
你可以通过指定玩家是否具有特定的 UUID、名称、是否属于特定队伍,或者是否是管理员(operator)来实现。
定义谓词后,你需要在游戏中运行 /replay reload,然后玩家需要重新登录才能被记录(前提是满足谓词条件)。
最基本的选项是记录所有玩家,在这种情况下你可以使用:
{
// ...
"player_predicate": {
"type": "all"
}
}
如果你只想记录具有特定名称或 UUID 的玩家,可以这样做:
{
// ...
"player_predicate": {
"type": "has_name",
"names": [
"senseiwells",
"foobar"
]
}
}
{
// ...
"player_predicate": {
"type": "has_uuid",
"uuids": [
"41048400-886d-497d-9d97-9fe7c9b63afa",
"71266dbd-db0a-484a-b859-3f135590d7a9",
"47d072ca-d7a2-467c-9b60-de501907e91d",
"0e324e7f-e78e-4777-b501-7ae08a65b1eb",
"7d9e24c2-9d0f-479f-81c7-27389624ebb2"
]
}
}
如果你只想记录管理员:
{
// ...
"player_predicate": {
"type": "has_op",
"level": 4
}
}
如果你只想记录特定队伍中的玩家,这非常有用,因为它允许你在游戏中添加和移除玩家,你只需将玩家加入某个队伍,然后让他们重新登录即可:
{
// ...
"player_predicate": {
"type": "in_team",
"teams": [
"Red",
"Blue",
"Spectators"
]
}
}
你还可以使用 not 取反谓词,并使用 or 和 and 组合它们。
例如,如果你想记录所有非管理员,且名称不是 'senseiwells' 也不在红队中的玩家:
{
// ...
"player_predicate": {
"type": "and",
"predicates": [
{
"type": "not",
"predicate": {
"type": "has_op",
"level": 4
}
},
{
"type": "not",
"predicate": {
"type": "or",
"predicates": [
{
"type": "has_name",
"names": [
"senseiwells"
]
},
{
"type": "in_team",
"teams": [
"Red"
]
}
]
}
}
]
}
}
如果你正在使用 Carpet 模组并拥有生成假玩家的能力,你可能希望将这些假玩家排除在记录之外。
你可以使用 is_fake 谓词来实现这一点:
{
// ...
"player_predicate": {
"type": "not",
"predicate": {
"type": "is_fake"
}
}
}
致谢
感谢 ExperimentalIdea
帮助测试回溯功能的支持!
Server Replay
English | 中文
A completely server-side implementation of Replay Mod and Flashback, this mod allows you
to record multiple players that are online, or chunk areas, on a server at a time. This will
produce replay files which can then be used with the replay mod or flashback for rendering.
Why Server-Side?
Compared to the client Replay Mod or Flashback recording
server-side has many benefits:
- The ability to record static chunks.
- You can specify the exact chunk size (not bound by server view distance).
- The recorded chunks may be unloaded without affecting the replay.
- No chunk flickering (from unloading and loading the chunks).
- The chunks will also not be loaded by the recorder (like, for example, PCRC).
- Pause and resume the recorders based on whether the chunks are being loaded or whether
there are players in the chunks
- The ability to record individual players.
- Players aren't required to install replay mod or flashback.
- You can record all POVs at once.
- Recordings can be automated using the configuration.
- Recordings can be started at anytime by operators (or anyone with permissions).
However, there are also some downsides and known issues:
- Some features are not recorded by chunk recordings, e.g. custom boss bars.
- Player recordings may not be 100% consistent with the client Replay Mod or Flashback.
- ServerReplay isn't really designed for heavily modded servers.
More complex mods that implement their own packets may not be compatible.
- If you encounter any compatability issues, please submit an issue.
Usage
This mod requires the fabric launcher, fabric-api, and fabric-kotlin.
There are two ways of recording on the server, you can either configure it
to follow and record players from their view.
Alternatively, you can record a static area of chunks.
Quick Start
Note:
This documentation is for the latest version of the mod, for older
versions of the mod please see the other branches
This section of the documentation will briefly guide you through a basic setup.
As well as containing some important information.
Players
To record a player on your server you can run /replay start players <player(s)>, for example:
/replay start players senseiwells
/replay start players @a
/replay start players @a[gamemode=survival]
Player recorders are tied to the player and will record at the
servers view distance.
If the player leaves or the server stops, the replay will automatically stop and save.
Alternatively if you wish to stop the recording manually you can run /replay stop players <player(s)> <save?>,
using this command you can also stop a recording without saving it, for example:
/replay stop players senseiwells
/replay stop players @r
/replay stop players senseiwells false
The replay will then be saved to your "player_recording_path" location
specified in a folder with the player's uuid.
By default, this will be in ./recordings/players/<uuid>/<date-and-time>.mcpr.
This file can then be put in ./replay_recordings on your client and be opened with replay mod.
Warning:
Trying to record carpet bots or other non-real players may lead to unexpected behaviour.
If you want to record a large chunk area please use a chunk recorder instead!
Chunks
Note:
While the mod will record the chunks you specify, the Minecraft client will not render the outermost chunks.
So to record an area of visible chunks, you must add one chunk to your border, e.g. recording a visible area from -5, -5 to 5, 5 you must record between -6, -6 and 6, 6.
To record an area of chunks on your server you can run /replay start chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> named <name?>, for example:
/replay start chunks from -5 -5 to 5 5 in minecraft:overworld named MyChunkRecording
/replay start chunks from 54 67 to 109 124
/replay start chunks from 30 30 to 60 60 in minecraft:the_nether
Alternatively you can specify a chunk and a radius around it to be recorded /replay start chunks around <chunkX> <chunkZ> radius <radius> in <dimension?> named <name?>, for example:
/replay start chunks around 0 0 radius 5
/replay start chunks around 67 12 radius 16 in minecraft:overworld named Perimeter Recorder
Chunk recorders are static and cannot move, they record the specified chunks.
An important thing to note is that when the replay starts, the specified chunks
will be loaded (and generated if necessary).
However, after this, the chunk recorder does not load the chunks.
You can further configure this with the
"chunk_recorder_load_radius" setting, which will set a maximum initial radius
that the chunk recorder will load, any chunks outside this radius that are recorded
will need to be loaded 'naturally' to be recorded.
If the server stops, the replay will automatically stop and save.
Alternatively if you wish to stop the recording manually you can stop a specified
recorder using its name with /replay stop chunks named <name> <save?>, for example:
/replay stop chunks named "Perimeter Recorder" false
/replay stop chunks named MyChunkRecording
The replay will then be saved to your "chunk_recording_path" location
specified in a folder with the chunk recorders name.
By default, this will be in ./recordings/chunks/<name>/<date-and-time>.mcpr.
This file can then be put in ./replay_recordings on your client and be opened with replay mod.
Encoding
ServerReplay supports flashback (for the more recent versions), as well as replay mod replays.
By default, all recordings will be recorded using replay mod's
format; however, you can change this by running the following commands in game:
/replay encoding default set flashback
/replay encoding default set replay_mod
Note:
You can record a player's perspective using both flashback and replay-mod simultaneously.
You can do this by setting the default encoding to flashback, starting a recording,
then setting the encoding to replay_mod and starting another recording.
The same can be done for chunk recordings, but each recorder must be given a unique name.
Viewing
After a replay has finished recording, you are able to view the replay completely server-side.
The player viewing the replay will be completely removed from the actual server while they
view the replay, and will be treated as if they are offline.
Essentially, this just "runs" another server that sends the client packets. This runs asynchronously
from the main server, so there is little to no impact on performance.
When a replay has finished recording, you can click on the green text in chat to view the
replay that just finished.
The command to view chunk replays is: /replay view chunks <name> <date-time>, and for players:
/replay view players <uuid> <date-time>, for example:
/replay view player "d4fca8c4-e083-4300-9a73-bf438847861c" "2024-05-11--19-19-55"
/replay view chunks "Chunks (183, 166) to (203, 186)" "2024-05-11--19-19-55"
You will then be teleported to the new "server" where the replay will start playing.
You will only have access to a limited set of commands when viewing replays, these include:
/replay view pause Pauses the playback of the current replay.
/replay view unpause Unpauses the playback of the current replay.
/replay view speed <multiplier> Sets the playback speed of the current replay.
/replay view restart Restarts the playback of the current replay.
/replay view close Closes the current replay and brings you back to the server.
/replay view progress <hide|show> Hides or shows the progress bossbar.
If you disconnect while watching a replay, you will be brought back to the server when you log in.
Downloading
You can download any replay from the server if "allow_downloading_replays" is enabled in the config
and the server-ip and downloading port is set up correctly.
You can use the /replay download command to retrieve the URL to download the specified replay, for example:
/replay download players d4fca8c4-e083-4300-9a73-bf438847861c "2024-05-11--19-19-55"
/replay download chunks "Chunks (183, 166) to (203, 186)" "2024-05-11--19-19-55"
This will send you a chat message; you can click on the link provided which will download the file.
Commands
A note for all commands; players must either have op (level 4), alternatively if you
have a permission mod (for example, LuckPerms) players can
have the permission server-replay.commands.replay to access these commands.
/replay start players <player(s)> Manually starts recording the replay for some given player(s).
/replay start chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> named <name?>
Manually starts recording the replay for the given chunk area, if no dimension is specified the command user's
dimension will be used instead, the name determines where the replay file will be saved in the recording path.
/replay start chunks around <chunkX> <chunkZ> radius <radius> in <dimension?> named <name?>
This achieves the same as the command above; however, you can specify a radius around a given chunk instead.
/replay stop players <player(s)> <save?> Manually stops recording the replay for some given player(s),
you may optionally pass in whether the replay should be saved; by default, this is true.
/replay stop chunks from <chunkFromX> <chunkFromZ> to <chunkToX> <chunkToZ> in <dimension?> <save?>
Manually stops recording the replay for the given chunk area, if no dimension is specified the command user's
dimension will be used instead, you may optionally pass in whether the replay should be saved; by default, this is true.
/replay stop chunks named <name> <save?>
This lets you do the same as the command above; however, you can specify the chunk area by its name.
/replay stop [chunks|players] all <save?> Manually stops all chunks or player replays you may optionally pass in whether the
replay should be saved; by default, this is true.
/replay status Sends a status message of whether replay is enabled and a list of all the
players and chunks that are currently being recorded, how long they've been recorded for, and their file sizes.
/replay reload Reloads the config file for the replay mod.
/replay encoding default set <encoding-type> Sets what type of replay to record, either flashback or replay_mod
Configuring
After you boot the server a new file will be generated in the path
./config/server-replay/config.json, by default, it should look like:
{
"default_encoding": "replay_mod",
"world_name": "World",
"server_name": "Server",
"chunk_recording_path": "./recordings/chunks",
"player_recording_path": "./recordings/players",
"player_recording_name": "{uuid}",
"max_file_size": "0 B",
"restart_after_max_file_size": false,
"max_duration": "0s",
"restart_after_max_duration": false,
"recover_unsaved_replays": true,
"delete_replays_after_duration": "0s",
"log_deleted_replays": true,
"chunk_recorder_load_radius": -1,
"chunk_recording_strategy": "always",
"pause_notify_players": true,
"notify_admins_of_status": true,
"include_resource_packs": true,
"ignore_custom_payloads": false,
"ignore_sound_packets": false,
"ignore_light_packets": true,
"ignore_chat_packets": false,
"ignore_action_bar_packets": false,
"ignore_scoreboard_packets": false,
"optimize_explosion_packets": true,
"optimize_entity_packets": false,
"record_hotbar": false,
"record_voice_chat": false,
"replay_server_ip": null,
"allow_downloading_replays": false,
"automatically_record": false,
"player_predicate": {
"type": "none"
},
"chunks": []
}
| Config |
Description |
"default_encoding" |
The encoding to record your replays in, either "replay_mod" or "flashback". "replay_mod" by default (if not specified). |
"world_name" |
The name of the world that will appear on the replay file. |
"server_name" |
The name of the server that will appear on the replay file. |
"player_recording_path" |
The path where you want player recordings to be saved. |
"chunk_recording_path" |
The path where you want chunk recordings to be saved. |
"player_recording_name" |
This determines the name of each specific player's recording directory. By default is set to "{uuid}" which uses the player's uuid. You can also insert the player's name with "{username}". You could for example have: "Recordings for: {username} ({uuid})". |
"max_file_size" |
This specifies a max_file_size for the replay, if the limit is reached the the recording will be automatically stopped. This file size refers to the raw recording size and not the final compressed replay size, typically the final compressed replay size will be much smaller. |
"restart_after_max_file_size" |
If the max_file_size is set and this limit is reached then the replay recording will automatically restart creating a new replay file. |
"max_duration" |
Sets the maximum duration for a replay, once the replay has recorded for the specified amount of time it will stop, this is any number followed by units (you may also have multiple units), e.g. "4h 35m 2.1s". Set this to "0s" to not have a max duration limit. Note: if a recorder is paused it's duration does not increase. |
"restart_after_max_duration" |
If the max_duration is set and this limit is reached then the replay recording will automatically restart creating a new replay file. |
"recover_unsaved_replays" |
This tries to recover any unsaved replays, for example if your server crashes or stops before a replay is stopped or has finished saving, this does not guarantee that the replay will not be corrupt, but it will try to salvage what is available. |
"delete_replays_after_duration" |
The duration at which to delete old replay files. This is the duration since the file was last modified. The duration is the same format as the max_duration option, e.g. "5d 10h". Set this to "0s" to disable. |
"log_deleted_replays" |
Whether to output a server log when a replay is deleted as a result of it being stale. delete_replays_after_duration must be enabled for this to work. |
"fixed_daylight_cycle" |
This fixes the daylight cycle in the replay if you do not want the constant day-night cycle in long timelapses. This should be set to the time of day in ticks, e.g. 6000 (midday). To disable the fixed daylight cycle set the value to -1. |
"chunk_recorder_load_radius" |
This sets the default chunk recorder loading radius, this is useful when you want to record a very large area and you don't want all of the recorded chunks to be loaded at once. For example if you are recording a 13x13 chunk area, you could set the radius to 3, so the center-most 7x7 would be initially loaded, the rest of the chunks will then be recorded whenever they're 'naturally' loaded. Set this to -1 to load all chunks. |
"chunk_recording_strategy" |
This defines how a chunk recorder will record, there are 4 options: -
"always" - always records the chunks even when unloaded (as if they were loaded) -
"chunk_loaded" - only records when any of the chunks in the area are loaded, if all chunks are unloaded it pauses recording -
"chunk_contains_player" - only records the chunks when a player is within the area (flashback only) -
"chunk_contains_non_spectator_player" - same as above but only for non-spectator players (flashback only) |
"pause_notify_players" |
If chunk_recording_strategy is set to an option that allows for the recorder to automatically pause and this is enabled then whenever the recording for the chunk area is paused or resumed all online players will be notified. |
"notify_admins_of_status" |
When enabled this will notify admins of when a replay starts, when a replay ends, and when a replay has finished saving, as well as any errors that occur. |
"include_resource_packs" |
If enabled all server-side resource packs will be copied in the replay file to ensure correct playback. Disabling this will decrease file size but instead it'll try to download the pack from the original source whenever viewing the replay, there is no guarantee that this will work correctly. (replay mod only) |
"ignore_custom_payloads" |
If enabled all custom payloads (modded packets) will be ignored, this can be enabled if another mod's packets are causing recordings issues |
"ignore_sound_packets" |
If you are recording a large area for a timelapse it's unlikely you'll want to record any sounds, these can eat up significant storage space. |
"ignore_light_packets" |
Light is calculated on the client as well as on the server so light packets are mostly redundant. |
"ignore_chat_packets" |
Stops chat packets (from both the server and other players) from being recorded if they are not necessary for your replay. |
"ignore_action_bar_packets" |
Stops action bar packets from being recorded if they are not necessary for your replay. |
"ignore_scoreboard_packets" |
Stops scoreboard packets from being recorded (for example, if you have a scoreboard displaying digs then this will not appear, and player's scores will also not be recorded). |
"optimize_explosion_packets" |
This reduces the file size greatly by not sending the client explosion packets instead just sending the explosion particles and sounds. |
"optimize_entity_packets" |
This reduces the file size by letting the client handle the logic for some entities, e.g. projectiles and tnt. This may cause some inconsistencies however it will likely be negligible. |
"record_hotbar" |
This enables recording the hotbar for player recordings for a better first-person experience. (flashback only) |
"record_voice_chat" |
This enables support for recording voice-chat if you have the simple-voice-chat mod installed, this will work out of the box when viewing in flashback but when watching back the replay in replay-mod you must have replay-voice-chat installed. |
"replay_server_ip" |
This is required if your server uses custom server-side resource packs and you want to be able to view these packs in the server-side replay viewer. This is also required if you want to allow users to download replays. This should contain the public ip address of your server. |
"allow_downloading_replays" |
Determines whether users will be able to download recorded replays. |
"automatically_record" |
Whether to automatically record players or chunks based on the "player_predicate" and/or "chunks" configuration. If enabled any players that meet the predicate defined will be recorded automatically, and any chunks defined will be recorded on server startup. |
"player_predicate" |
The predicate for recording players automatically, more information in the Predicates section. |
"chunks" |
The list of chunks to automatically record when the server starts, more information in the Chunks section. |
Chunks Config
You can define chunk areas to be recorded automatically when the server starts or when
you enable ServerReplay.
Each chunk definition must include: "name", "dimension", "from_x", "to_x", "from_z", and "to_z". For example:
{
// ...
"chunks": [
{
"name": "My Chunks",
"dimension": "minecraft:overworld",
"from_x": -5,
"from_z": -5,
"to_x": 5,
"to_z": 5
},
{
"name": "My Nether Chunks",
"dimension": "minecraft:the_nether",
"from_x": 100,
"from_z": 50,
"to_x": 90,
"to_z": 60
}
// ...
]
}
Predicates Config
You can define a predicate, which determines which players on your server
will be recorded automatically.
You can do this by specifying whether players have a specific uuid,
name, are on a specific team, or whether they are an operator.
After defining a predicate you must run /replay reload in game then players must
re-log if they want to be recorded (and meet the predicate criteria).
Most basic option is just to record all players in which case you can use:
{
// ...
"player_predicate": {
"type": "all"
}
}
If you wanted to only record players with specific names or uuids you can do the following:
{
// ...
"player_predicate": {
"type": "has_name",
"names": [
"senseiwells",
"foobar"
]
}
}
{
// ...
"player_predicate": {
"type": "has_uuid",
"uuids": [
"41048400-886d-497d-9d97-9fe7c9b63afa",
"71266dbd-db0a-484a-b859-3f135590d7a9",
"47d072ca-d7a2-467c-9b60-de501907e91d",
"0e324e7f-e78e-4777-b501-7ae08a65b1eb",
"7d9e24c2-9d0f-479f-81c7-27389624ebb2"
]
}
}
If you only wanted to record operators:
{
// ...
"player_predicate": {
"type": "has_op",
"level": 4
}
}
If you only want to record players on specific teams, this is useful for allowing players to be
added and removed in-game, as you can just add players to a team and then have them re-log:
{
// ...
"player_predicate": {
"type": "in_team",
"teams": [
"Red",
"Blue",
"Spectators"
]
}
}
You are also able to negate predicates, using 'not' and combine them using 'or' and 'and'.
For example, if you wanted to record all non-operators that also don't have the name 'senseiwells' or is on the red team:
{
// ...
"player_predicate": {
"type": "and",
"predicates": [
{
"type": "not",
"predicate": {
"type": "has_op",
"level": 4
}
},
{
"type": "not",
"predicate": {
"type": "or",
"predicates": [
{
"type": "has_name",
"names": [
"senseiwells"
]
},
{
"type": "in_team",
"teams": [
"Red"
]
}
]
}
}
]
}
}
If you are using carpet mod and have the ability to spawn fake players you may want to exclude them from being recorded.
You can do this with the is_fake predicate:
{
// ...
"player_predicate": {
"type": "not",
"predicate": {
"type": "is_fake"
}
}
}
Acknowledgements
Thank you to ExperimentalIdea
for helping test flashback support!
评论 0
登录后参与评分
还没有评论,来抢沙发吧