From 40f29978ea2480ca10f052d61dcc6a342c2e9da5 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 5 May 2023 19:52:11 +0700 Subject: [PATCH] add magic (please don't skid) --- .../chipmunkmod/mixin/ClientConnectionMixin.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java index 29ed5a3..7fe1cc3 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientConnectionMixin.java @@ -6,6 +6,7 @@ import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; import net.minecraft.network.listener.PacketListener; import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.s2c.play.ParticleS2CPacket; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -29,8 +30,18 @@ public class ClientConnectionMixin { } } - @Inject(method = "handlePacket", at = @At("HEAD")) + @Inject(method = "handlePacket", at = @At("HEAD"), cancellable = true) private static void handlePacket (Packet packet, PacketListener _listener, CallbackInfo ci) { + // please don't skid this.,. + // mabe mabe mabe + if (packet instanceof ParticleS2CPacket t_packet) { + final double max = 1000; + + if (t_packet.getCount() > max) { + ci.cancel(); + } + } + for (Listener listener : ListenerManager.listeners) { listener.packetReceived(packet); }