Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiwells committed Nov 13, 2024
1 parent 3966715 commit f08005b
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 264 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ repositories {
}

dependencies {
modImplementation("me.senseiwells:server-replay:1.2.2+1.20.6")
modImplementation("me.senseiwells:server-replay:1.2.2+1.20.1")
}
```

Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ dependencies {

modCompileOnly(libs.carpet)
modCompileOnly(libs.vmp)
modCompileOnly(libs.servux)
modCompileOnly(libs.syncmatica)
modImplementation(libs.voicechat)
implementation(libs.voicechat.api)

Expand Down
16 changes: 6 additions & 10 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
fabric-loom = "1.7-SNAPSHOT"
mod-publish = "0.7.0"
shadow = "8.1.1"
minecraft = "1.20.6"
minecraft = "1.20.1"
fabric-loader = "0.16.5"
parchment = "1.20.6:2024.05.01"
fabric-api = "0.99.0+1.20.6"
parchment = "1.20.1:2023.08.06"
fabric-api = "0.92.2+1.20.1"
fabric-kotlin = "1.11.0+kotlin.2.0.0"
permissions = "0.3.1"
inject = "2.2.2"

# Compatability depdendencies
carpet = "1.4.141"
voicechat = "fabric-1.20.6-2.5.17"
carpet = "1.4.112"
voicechat = "fabric-1.20.1-2.5.7"
voicechat-api = "2.4.0"
vmp = "0.2.0+beta.7.155+1.20.6"
servux = "1.20.6-0.2.0"
syncmatica = "1.20.6-sakura.10"
vmp = "0.2.0+beta.7.102+1.20.1"
replay-studio = "1e96fda605"

[libraries]
Expand All @@ -34,8 +32,6 @@ carpet = { module = "com.github.gnembon:fabric-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" }
servux = { module = "com.github.sakura-ryoko:servux" , version.ref = "servux" }
syncmatica = { module = "com.github.sakura-ryoko:syncmatica" , version.ref = "syncmatica" }

[plugins]
fabric-loom = { id = "fabric-loom", version.ref = "fabric-loom" }
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/me/senseiwells/replay/ducks/PackTracker.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package me.senseiwells.replay.ducks;

import net.minecraft.network.protocol.game.ClientboundResourcePackPacket;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

public interface ServerReplay$PackTracker {
@ApiStatus.Internal
public interface PackTracker {
void replay$setPack(@Nullable ClientboundResourcePackPacket pack);

@Nullable ClientboundResourcePackPacket replay$getPack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import me.senseiwells.replay.chunk.ChunkRecorder;
import me.senseiwells.replay.ducks.ChunkRecordable;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.*;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.chunk.LevelChunk;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -34,9 +34,9 @@ public abstract class ChunkHolderMixin implements ChunkRecordable {

@Shadow public abstract @Nullable LevelChunk getFullChunk();

@Shadow @Final private ChunkPos pos;
@Shadow @Final ChunkPos pos;

@Inject(
@Inject(
method = "broadcast",
at = @At("HEAD")
)
Expand Down Expand Up @@ -103,7 +103,7 @@ private void onChunkUnload(ChunkMap chunkMap, Executor executor, CallbackInfo ci
public void replay$addRecorder(ChunkRecorder recorder) {
if (this.replay$recorders.add(recorder)) {
this.getFullChunkFuture().thenAccept(result -> {
result.ifSuccess(recorder::onChunkLoaded);
result.ifLeft(recorder::onChunkLoaded);
});

recorder.addRecordable(this);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.senseiwells.replay.mixin.rejoin;

import me.senseiwells.replay.ducks.ServerReplay$PackTracker;
import me.senseiwells.replay.ducks.PackTracker;
import net.minecraft.network.PacketSendListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundResourcePackPacket;
Expand All @@ -13,7 +13,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ServerGamePacketListenerImpl.class)
public class ServerGamePacketListenerImplMixin implements ServerReplay$PackTracker {
public class ServerGamePacketListenerImplMixin implements PackTracker {
// We need to keep track of what pack a player has...
// We don't really care if the player accepts / declines them, we'll record them anyway.
@Unique @Nullable private ClientboundResourcePackPacket replay$pack = null;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ import me.senseiwells.replay.rejoin.RejoinConnection
import net.minecraft.network.PacketSendListener
import net.minecraft.network.protocol.Packet
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.network.CommonListenerCookie
import net.minecraft.server.network.ServerGamePacketListenerImpl

class ChunkGamePacketPacketListener(
private val recorder: ChunkRecorder,
player: ServerPlayer
): ServerGamePacketListenerImpl(
recorder.server,
RejoinConnection(),
player,
CommonListenerCookie.createInitial(recorder.profile, false)
) {
): ServerGamePacketListenerImpl(recorder.server, RejoinConnection(), player) {
override fun send(packet: Packet<*>, listener: PacketSendListener?) {
this.recorder.record(packet)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import net.minecraft.commands.Commands
import net.minecraft.network.protocol.game.ClientboundResourcePackPacket

object PackCommand {
@JvmStatic
fun register(dispatcher: CommandDispatcher<CommandSourceStack>) {
dispatcher.register(
Commands.literal("resource-pack").then(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import me.senseiwells.replay.http.DownloadReplaysHttpInjector
import me.senseiwells.replay.player.PlayerRecorders
import me.senseiwells.replay.recorder.ReplayRecorder
import me.senseiwells.replay.util.FileUtils.streamDirectoryEntriesOrEmpty
import me.senseiwells.replay.viewer.ReplayViewers
import me.senseiwells.replay.viewer.ReplayViewer
import net.minecraft.ChatFormatting
import net.minecraft.commands.CommandSourceStack
import net.minecraft.commands.Commands
Expand Down Expand Up @@ -417,7 +417,8 @@ object ReplayCommand {
val replayPath = path.resolve("${replayName}.mcpr")

if (replayPath.exists()) {
ReplayViewers.start(replayPath, player)
val viewer = ReplayViewer(replayPath, player.connection)
viewer.start()
return 1
}

Expand Down Expand Up @@ -450,7 +451,7 @@ object ReplayCommand {
val url = DownloadReplaysHttpInjector.createUrl(context.source.server, path)
val here = Component.literal("[here]")
.withStyle(ChatFormatting.YELLOW, ChatFormatting.BOLD)
.withStyle { it.withClickEvent(ClickEvent(ClickEvent.Action.OPEN_URL, url)) }
.withStyle { it.withClickEvent(ClickEvent(ClickEvent.Action.OPEN_URL, "$url/$path")) }
val message = Component.literal("You can download the replay ").append(here)
context.source.sendSystemMessage(message)
return 1
Expand Down
13 changes: 0 additions & 13 deletions src/main/kotlin/me/senseiwells/replay/compat/ReplayMixinConfig.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.senseiwells.replay.compat

import com.google.common.collect.HashMultimap
import net.fabricmc.loader.api.FabricLoader
import org.objectweb.asm.tree.ClassNode
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
Expand All @@ -9,13 +8,6 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo
class ReplayMixinConfig: IMixinConfigPlugin {
companion object {
private const val MIXIN_COMPAT = "me.senseiwells.replay.mixin.compat."

private val incompatible = HashMultimap.create<String, String>()

init {
this.incompatible.put("me.senseiwells.replay.mixin.chunk.ChunkMapMixin", "c2me")
this.incompatible.put("me.senseiwells.replay.mixin.chunk.ChunkHolderMixin", "c2me")
}
}

override fun onLoad(mixinPackage: String?) {
Expand All @@ -31,11 +23,6 @@ class ReplayMixinConfig: IMixinConfigPlugin {
val modId = mixinClassName.removePrefix(MIXIN_COMPAT).substringBefore('.')
return FabricLoader.getInstance().isModLoaded(modId)
}
for (modId in incompatible.get(mixinClassName)) {
if (FabricLoader.getInstance().isModLoaded(modId)) {
return false
}
}
return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import java.util.*

@Suppress("unused")
object ReplayVoicechatPlugin: VoicechatPlugin, ServerReplayPlugin {
/**
* Mod id of the replay voicechat mod, see [here](https://github.com/henkelmax/replay-voice-chat/blob/master/src/main/java/de/maxhenkel/replayvoicechat/ReplayVoicechat.java).
Expand Down

This file was deleted.

Loading

0 comments on commit f08005b

Please sign in to comment.