-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix player recordings not broadcasting certain packets
- Loading branch information
1 parent
3833f8d
commit db13d93
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/me/senseiwells/replay/mixin/common/ChunkMapMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters