Search in sources :

Example 1 with MixinClientConnectionAccessor

use of com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAccessor in project ViaFabric by ViaVersion.

the class MixinMultiplayerServerListPingerListener method onResponseCaptureServerInfo.

@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
    FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel().pipeline().get(FabricDecodeHandler.class);
    if (decoder != null) {
        ((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
        ((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
    }
    return serverInfo.getIcon();
}
Also used : FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) MixinClientConnectionAccessor(com.viaversion.fabric.mc118.mixin.debug.client.MixinClientConnectionAccessor) ViaServerInfo(com.viaversion.fabric.common.gui.ViaServerInfo) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 2 with MixinClientConnectionAccessor

use of com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAccessor in project ViaFabric by ViaVersion.

the class MixinMultiplayerServerListPingerListener method onResponseCaptureServerInfo.

@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
    FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel().pipeline().get(FabricDecodeHandler.class);
    if (decoder != null) {
        ((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
        ((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
    }
    return serverInfo.getIcon();
}
Also used : FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) MixinClientConnectionAccessor(com.viaversion.fabric.mc117.mixin.debug.client.MixinClientConnectionAccessor) ViaServerInfo(com.viaversion.fabric.common.gui.ViaServerInfo) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 3 with MixinClientConnectionAccessor

use of com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAccessor in project ViaFabric by ViaVersion.

the class MixinMultiplayerServerListPingerListener method onResponseCaptureServerInfo.

@Redirect(method = "onResponse(Lnet/minecraft/network/packet/s2c/query/QueryResponseS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ServerInfo;getIcon()Ljava/lang/String;"))
private String onResponseCaptureServerInfo(ServerInfo serverInfo) {
    FabricDecodeHandler decoder = ((MixinClientConnectionAccessor) this.getConnection()).getChannel().pipeline().get(FabricDecodeHandler.class);
    if (decoder != null) {
        ((ViaServerInfo) serverInfo).setViaTranslating(decoder.getInfo().isActive());
        ((ViaServerInfo) serverInfo).setViaServerVer(decoder.getInfo().getProtocolInfo().getServerProtocolVersion());
    }
    return serverInfo.getIcon();
}
Also used : FabricDecodeHandler(com.viaversion.fabric.common.handler.FabricDecodeHandler) MixinClientConnectionAccessor(com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAccessor) ViaServerInfo(com.viaversion.fabric.common.gui.ViaServerInfo) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

ViaServerInfo (com.viaversion.fabric.common.gui.ViaServerInfo)3 FabricDecodeHandler (com.viaversion.fabric.common.handler.FabricDecodeHandler)3 Redirect (org.spongepowered.asm.mixin.injection.Redirect)3 MixinClientConnectionAccessor (com.viaversion.fabric.mc117.mixin.debug.client.MixinClientConnectionAccessor)1 MixinClientConnectionAccessor (com.viaversion.fabric.mc118.mixin.debug.client.MixinClientConnectionAccessor)1 MixinClientConnectionAccessor (com.viaversion.fabric.mc119.mixin.debug.client.MixinClientConnectionAccessor)1