diff --git a/src/main/java/lol/bai/badpackets/impl/mixin/client/MixinClientPacketListener.java b/src/main/java/lol/bai/badpackets/impl/mixin/client/MixinClientPacketListener.java index 29093ca..a1000b8 100644 --- a/src/main/java/lol/bai/badpackets/impl/mixin/client/MixinClientPacketListener.java +++ b/src/main/java/lol/bai/badpackets/impl/mixin/client/MixinClientPacketListener.java @@ -10,7 +10,6 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; -import net.minecraft.network.protocol.game.ClientboundLoginPacket; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -39,13 +38,10 @@ private void badpackets_removeClientPacketHandler(Component reason, CallbackInfo badpacket_packetHandler.onDisconnect(); } - @Inject(method = "handleLogin", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Connection;send(Lnet/minecraft/network/protocol/Packet;)V")) - private void badpackets_initClientPacketHandler(ClientboundLoginPacket packet, CallbackInfo ci) { - badpacket_packetHandler.sendInitialChannelSyncPacket(); - } - @Inject(method = "handleCustomPayload", at = @At("HEAD"), cancellable = true) private void badpackets_receiveS2CPacket(ClientboundCustomPayloadPacket packet, CallbackInfo ci) { + badpacket_packetHandler.sendInitialChannelSyncPacket(); + if (!minecraft.isSameThread()) { FriendlyByteBuf buf = packet.getData(); try {