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
  • Loading branch information
senseiwells committed Feb 4, 2024
2 parents b9cb1a7 + f56c631 commit 6b4cd41
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.senseiwells.replay.mixin.common;

import me.senseiwells.replay.player.PlayerRecorder;
import me.senseiwells.replay.player.PlayerRecorders;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ChunkMap.class)
public class ChunkMapMixin {
@Inject(
method = "broadcast",
at = @At("HEAD")
)
private void onBroadcast(Entity entity, Packet<?> packet, CallbackInfo ci) {
if (entity instanceof ServerPlayer player) {
PlayerRecorder recorder = PlayerRecorders.get(player);
if (recorder != null) {
recorder.record(packet);
}
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/serverreplay.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"chunk.ServerBossEventMixin",
"chunk.TrackedEntityMixin",
"chunk.WitherBossAccessor",
"common.ChunkMapMixin",
"common.MinecraftServerMixin",
"common.PlayerListAccessor",
"common.ServerLevelMixin",
Expand Down

0 comments on commit 6b4cd41

Please sign in to comment.