mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-21 11:55:13 +01:00
Fix pipeline injection in 1.17+
This commit is contained in:
parent
d2d5ed4458
commit
f589b3a28d
@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.Connection;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(targets = "net.minecraft.network.Connection$1")
|
||||
public class MixinConnection_1 {
|
||||
|
||||
@Final
|
||||
@Mutable
|
||||
Connection val$connection;
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
|
||||
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
|
||||
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
|
||||
final ChannelPipeline handler = instance.addLast(s, channelHandler);
|
||||
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
|
||||
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.Connection;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(targets = "net.minecraft.network.Connection$1")
|
||||
public class MixinConnection_1 {
|
||||
|
||||
@Final
|
||||
@Mutable
|
||||
Connection val$connection;
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
|
||||
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
|
||||
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
|
||||
final ChannelPipeline handler = instance.addLast(s, channelHandler);
|
||||
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
|
||||
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.Connection;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(targets = "net.minecraft.network.Connection$1")
|
||||
public class MixinConnection_1 {
|
||||
|
||||
@Final
|
||||
@Mutable
|
||||
Connection val$connection;
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
|
||||
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
|
||||
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
|
||||
final ChannelPipeline handler = instance.addLast(s, channelHandler);
|
||||
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
|
||||
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,25 +20,22 @@ package de.florianmichael.viaforge.mixin;
|
||||
|
||||
import de.florianmichael.viaforge.common.ViaForgeCommon;
|
||||
import de.florianmichael.viaforge.common.protocoltranslator.netty.VFNetworkManager;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.Connection;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(targets = "net.minecraft.network.Connection$1")
|
||||
public class MixinConnection_1 {
|
||||
|
||||
@Final
|
||||
@Mutable
|
||||
Connection val$connection;
|
||||
|
||||
@Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
|
||||
private void onInitChannel(Channel channel, CallbackInfo ci) {
|
||||
ViaForgeCommon.getManager().inject(channel, (VFNetworkManager) val$connection);
|
||||
@Redirect(method = "initChannel", at = @At(value = "INVOKE", target = "Lio/netty/channel/ChannelPipeline;addLast(Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"))
|
||||
private ChannelPipeline hookViaPipeline(ChannelPipeline instance, String s, ChannelHandler channelHandler) {
|
||||
final ChannelPipeline handler = instance.addLast(s, channelHandler);
|
||||
if (channelHandler instanceof VFNetworkManager mixinNetworkManager) {
|
||||
ViaForgeCommon.getManager().inject(instance.channel(), mixinNetworkManager);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user