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