From 4d1a594cca2ecfd5c726548de71ed97be6be7477 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 7 May 2023 15:16:09 +0700 Subject: [PATCH] among --- .../land/chipmunk/chipmunkmod/listeners/Listener.java | 2 ++ .../chipmunkmod/mixin/ClientConnectionMixin.java | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java b/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java index cf46c0d..02eda9f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java +++ b/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java @@ -7,4 +7,6 @@ public class Listener { public void chatMessageReceived (Text message) {} public void packetReceived (Packet packet) {} + + public void packetSent (Packet packet) {} } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java index 7fe1cc3..93cb4fe 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java @@ -31,7 +31,7 @@ public class ClientConnectionMixin { } @Inject(method = "handlePacket", at = @At("HEAD"), cancellable = true) - private static void handlePacket (Packet packet, PacketListener _listener, CallbackInfo ci) { + private static void handlePacket (Packet packet, PacketListener _listener, CallbackInfo ci) { // please don't skid this.,. // mabe mabe mabe if (packet instanceof ParticleS2CPacket t_packet) { @@ -46,4 +46,11 @@ public class ClientConnectionMixin { listener.packetReceived(packet); } } + + @Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("TAIL")) + private static void sendPacket (Packet packet, CallbackInfo ci) { + for (Listener listener : ListenerManager.listeners) { + listener.packetSent(packet); + } + } }