Use HandlerNames class for netty injection in 1.20.6

This commit is contained in:
FlorianMichael 2024-06-11 23:41:36 +02:00
parent 2c47fabcd5
commit cb0d2aea88
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -31,6 +31,7 @@ import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkSide;
import net.minecraft.network.handler.HandlerNames;
import net.minecraft.network.handler.PacketSizeLogger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -38,7 +39,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientConnection.class)
public class MixinClientConnection {
@Shadow
@ -61,8 +61,8 @@ public class MixinClientConnection {
protocolPipeline.add(HostnameParserProtocol.INSTANCE);
}
pipeline.addBefore(clientSide ? "encoder" : "outbound_config", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
pipeline.addBefore(clientSide ? "inbound_config" : "decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
pipeline.addBefore(clientSide ? HandlerNames.ENCODER : HandlerNames.OUTBOUND_CONFIG, CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
pipeline.addBefore(clientSide ? HandlerNames.INBOUND_CONFIG : HandlerNames.DECODER, CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
}
}
}