Skip to content

Commit

Permalink
Merge branch '1.21.4' into 1.21.3
Browse files Browse the repository at this point in the history
# Conflicts:
#	libs.versions.toml
  • Loading branch information
senseiwells committed Dec 22, 2024
2 parents e702aee + 011eb0d commit 6ff8c00
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ repositories {
maven("https://maven.maxhenkel.de/repository/public")
maven("https://maven.andante.dev/releases/")
maven("https://maven4.bai.lol")
maven("https://maven.nucleoid.xyz")
mavenCentral()
}


val modVersion = "1.2.8"
val modVersion = "1.2.9"
val releaseVersion = "${modVersion}+mc${libs.versions.minecraft.get()}"
version = releaseVersion
group = "me.senseiwells"
Expand All @@ -55,6 +56,7 @@ dependencies {
modCompileOnly(libs.servux)
modCompileOnly(libs.syncmatica)
modCompileOnly(libs.voicechat)
modCompileOnly(libs.polymer.core)
compileOnly(libs.voicechat.api)

shade(implementation(libs.replay.studio.get())!!)
Expand Down
16 changes: 9 additions & 7 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ vmp = "0.2.0+beta.7.180+1.21.3"
c2me = "0.3.0+beta.1.0+1.21.3"
servux = "1.21.3-0.4.0-sakura.2"
syncmatica = "1.21.3-sakura.10"
polymer = "0.10.2+1.21.3"
replay-studio = "aa5ab3a302"

# Plugins
Expand All @@ -35,13 +36,14 @@ inject-http = { module = "net.mcbrawls.inject:http" , version.ref
inject-fabric = { module = "net.mcbrawls.inject:fabric" , version.ref = "inject" }

# Compatability depdendencies
carpet = { module = "com.github.gnembon:fabric-carpet" , version.ref = "carpet" }
voicechat = { module = "maven.modrinth:simple-voice-chat" , version.ref = "voicechat" }
voicechat-api = { module = "de.maxhenkel.voicechat:voicechat-api", version.ref = "voicechat-api" }
vmp = { module = "maven.modrinth:vmp-fabric" , version.ref = "vmp" }
c2me = { module = "maven.modrinth:c2me-fabric" , version.ref = "c2me" }
servux = { module = "com.github.sakura-ryoko:servux" , version.ref = "servux" }
syncmatica = { module = "com.github.sakura-ryoko:syncmatica" , version.ref = "syncmatica" }
carpet = { module = "com.github.gnembon:fabric-carpet" , version.ref = "carpet" }
voicechat = { module = "maven.modrinth:simple-voice-chat" , version.ref = "voicechat" }
voicechat-api = { module = "de.maxhenkel.voicechat:voicechat-api", version.ref = "voicechat-api" }
vmp = { module = "maven.modrinth:vmp-fabric" , version.ref = "vmp" }
c2me = { module = "maven.modrinth:c2me-fabric" , version.ref = "c2me" }
servux = { module = "com.github.sakura-ryoko:servux" , version.ref = "servux" }
syncmatica = { module = "com.github.sakura-ryoko:syncmatica" , version.ref = "syncmatica" }
polymer-core = { module = "eu.pb4:polymer-core" , version.ref = "polymer" }

[plugins]
fabric-loom = { id = "fabric-loom" , version.ref = "fabric-loom" }
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/me/senseiwells/replay/chunk/ChunkRecorder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive
import me.senseiwells.replay.ServerReplay
import me.senseiwells.replay.api.ServerReplayPluginManager
import me.senseiwells.replay.compat.polymer.PolymerPacketPatcher
import me.senseiwells.replay.mixin.chunk.WitherBossAccessor
import me.senseiwells.replay.mixin.rejoin.ChunkMapAccessor
import me.senseiwells.replay.player.PlayerRecorder
Expand Down Expand Up @@ -84,6 +85,10 @@ class ChunkRecorder internal constructor(
override val rotation: Vec2
get() = Vec2.ZERO

override fun record(outgoing: Packet<*>) {
super.record(PolymerPacketPatcher.replace(this.dummy.connection, outgoing))
}

/**
* This gets the name of the replay recording.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.senseiwells.replay.compat.polymer

import eu.pb4.polymer.core.impl.networking.PacketPatcher
import net.fabricmc.loader.api.FabricLoader
import net.minecraft.network.protocol.Packet
import net.minecraft.server.network.ServerCommonPacketListenerImpl

object PolymerPacketPatcher {
private val hasPolymer = FabricLoader.getInstance().isModLoaded("polymer-core")

fun replace(listener: ServerCommonPacketListenerImpl, packet: Packet<*>): Packet<*> {
if (this.hasPolymer) {
return PacketPatcher.replace(listener, packet)
}
return packet
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.senseiwells.replay.player

import com.mojang.authlib.GameProfile
import me.senseiwells.replay.api.ServerReplayPluginManager
import me.senseiwells.replay.compat.polymer.PolymerPacketPatcher
import me.senseiwells.replay.recorder.ChunkSender
import me.senseiwells.replay.recorder.ReplayRecorder
import me.senseiwells.replay.rejoin.RejoinedReplayPlayer
Expand Down Expand Up @@ -157,7 +158,7 @@ class PlayerRecorder internal constructor(
* @param packet The packet to be recorded.
*/
override fun sendPacket(packet: Packet<*>) {
this.record(packet)
this.record(PolymerPacketPatcher.replace(this.getPlayerOrThrow().connection, packet))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ abstract class ReplayRecorder(
*
* @param outgoing The outgoing [MinecraftPacket].
*/
fun record(outgoing: MinecraftPacket<*>) {
open fun record(outgoing: MinecraftPacket<*>) {
if (!this.started) {
throw IllegalStateException("Cannot record packets if recorder not started")
}
Expand Down

0 comments on commit 6ff8c00

Please sign in to comment.