Skip to content

Commit

Permalink
Merge branch '1.20.2' into 1.20.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	src/main/kotlin/me/senseiwells/replay/chunk/ChunkRecorder.kt
#	src/main/kotlin/me/senseiwells/replay/player/PlayerRecorder.kt
#	src/main/kotlin/me/senseiwells/replay/recorder/ReplayRecorder.kt
  • Loading branch information
senseiwells committed Mar 16, 2024
2 parents b24872e + 2af1736 commit 8cb9911
Show file tree
Hide file tree
Showing 27 changed files with 1,425 additions and 182 deletions.
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# <img src="./src/main/resources/assets/serverreplay/icon.png" align="center" width="64px"/> Server Replay
# <img src="./src/main/resources/assets/server-replay/icon.png" align="center" width="64px"/> Server Replay

**English** | [中文](./README_cn.md)

A completely server-side implementation of the replay mod, 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 for rendering.

[![Modrinth download](https://img.shields.io/modrinth/dt/server-replay?label=Download%20on%20Modrinth&style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEuNSIgY2xpcC1ydWxlPSJldmVub2RkIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBkPSJNMTAwIDBIMHYxMDBoMTAwVjBaTTQ2LjAwMiA0OS4yOTVsLjA3NiAxLjc1NyA4LjgzIDMyLjk2MyA3Ljg0My0yLjEwMi04LjU5Ni0zMi4wOTQgNS44MDQtMzIuOTMyLTcuOTk3LTEuNDEtNS45NiAzMy44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MC40NTEgMC01Ljc2OCA0LjY4My0xMC40NTEgMTAuNDUxLTEwLjQ1MVoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNjKSI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDBkODQ1IiBzdHJva2Utd2lkdGg9IjkiIGQ9Ik01MCA1MCA1LjE3MSA3NS44ODIiLz48L2c+PGNsaXBQYXRoIGlkPSJkIj48cGF0aCBkPSJNNTAgMGMyNy41OTYgMCA1MCAyMi40MDQgNTAgNTBzLTIyLjQwNCA1MC01MCA1MFMwIDc3LjU5NiAwIDUwIDIyLjQwNCAwIDUwIDBabTAgMjUuMzZjMTMuNTk5IDAgMjQuNjQgMTEuMDQxIDI0LjY0IDI0LjY0UzYzLjU5OSA3NC42NCA1MCA3NC42NCAyNS4zNiA2My41OTkgMjUuMzYgNTAgMzYuNDAxIDI1LjM2IDUwIDI1LjM2WiIvPjwvY2xpcFBhdGg+PGcgY2xpcC1wYXRoPSJ1cmwoI2QpIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiMwMGQ4NDUiIHN0cm9rZS13aWR0aD0iOSIgZD0ibTUwIDUwIDUwLTEzLjM5NyIvPjwvZz48cGF0aCBmaWxsPSIjMDBkODQ1IiBkPSJNMzcuMjQzIDUyLjc0NiAzNSA0NWw4LTkgMTEtMyA0IDQtNiA2LTQgMS0zIDQgMS4xMiA0LjI0IDMuMTEyIDMuMDkgNC45NjQtLjU5OCAyLjg2Ni0yLjk2NCA4LjE5Ni0yLjE5NiAxLjQ2NCA1LjQ2NC04LjA5OCA4LjAyNkw0Ni44MyA2NS40OWwtNS41ODctNS44MTUtNC02LjkyOVoiLz48L3N2Zz4=)](https://modrinth.com/mod/server-replay)

### Why Server-Side?

Compared to the client [Replay Mod](https://www.replaymod.com/) recording
Expand Down Expand Up @@ -206,7 +210,7 @@ After you boot the server a new file will be generated in the path
| `"optimize_entity_packets"` | <p> 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. </p> |
| `"record_voice_chat"` | <p> This enables support for recording voice-chat if you have the [simple-voice-chat](https://github.com/henkelmax/simple-voice-chat) mod installed, when watching back the replay you must have [replay-voice-chat](https://github.com/henkelmax/replay-voice-chat) installed. </p> |
| `"player_predicate"` | <p> The predicate for recording players automatically, more information in the [Predicates](#predicates-config) section. </p> |
| `"chunks"` | <p> The list of chunks to automatically record when the server stars, more information in the [Chunks](#chunks-config) section. </p> |
| `"chunks"` | <p> The list of chunks to automatically record when the server starts, more information in the [Chunks](#chunks-config) section. </p> |

### Chunks Config

Expand Down Expand Up @@ -386,7 +390,7 @@ repositories {

dependencies {
// For the most recent version, use the latest commit hash
modImplementation("com.github.Senseiwells:ServerReplay:bf89353cd2")
modImplementation("com.github.senseiwells:ServerReplay:da3b0e55ce")
}
```

Expand All @@ -399,7 +403,7 @@ class ExampleMod: ModInitializer {
if (!PlayerRecorders.has(player)) {
if (player.level().dimension() == Level.END) {
val recorder = PlayerRecorders.create(player)
recorder.tryStart(log = true)
recorder.start(log = true)
}
} else {
val existing = PlayerRecorders.get(player)!!
Expand All @@ -417,8 +421,37 @@ class ExampleMod: ModInitializer {
ChunkPos(5, 5),
"Named"
)
recorder.tryStart(log = false)
recorder.start(log = false)
}
}
}
```

If you want to add support to your mod for ServerReplay you can create a plugin:
```kotlin
class MyServerReplayPlugin: ServerReplayPlugin {
override fun onPlayerReplayStart(recorder: PlayerRecorder) {
// Send any additional packets for players here
}


override fun onChunkReplayStart(recorder: ChunkRecorder) {
// Send any additional packets for chunks here
}
}
```
Then you simply register this in your `fabric.mod.json`:
```json5
{
// ...
"entrypoints": {
"main": [
// ...
],
"server_replay": [
"com.example.MyServerReplayPlugin"
]
}
// ...
}
```
Loading

0 comments on commit 8cb9911

Please sign in to comment.