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); + } + } }