mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-21 16:17:37 +01:00
22w11a + fix #175
This commit is contained in:
parent
f6fefb7245
commit
b18697c15e
@ -2,5 +2,5 @@
|
||||
org.gradle.jvmargs=-Xms32M -Xmx4G
|
||||
|
||||
loader_version=0.13.3
|
||||
viaver_version=4.3.0-22w11a-SNAPSHOT
|
||||
viaver_version=4.3.0-22w12a-SNAPSHOT
|
||||
yaml_version=1.30
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.viaversion.fabric.common.handler;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.exception.CancelCodecException;
|
||||
import com.viaversion.viaversion.exception.CancelDecoderException;
|
||||
import com.viaversion.viaversion.exception.InformativeException;
|
||||
import com.viaversion.viaversion.util.PipelineUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
@ -45,11 +48,14 @@ public class FabricDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
private void reorder(ChannelHandlerContext ctx) {
|
||||
int decoderIndex = ctx.pipeline().names().indexOf("decompress");
|
||||
if (decoderIndex == -1) return;
|
||||
|
||||
if (decoderIndex > ctx.pipeline().names().indexOf("via-decoder")) {
|
||||
ChannelHandler encoder = ctx.pipeline().get("via-encoder");
|
||||
ChannelHandler decoder = ctx.pipeline().get("via-decoder");
|
||||
|
||||
ctx.pipeline().remove(encoder);
|
||||
ctx.pipeline().remove(decoder);
|
||||
|
||||
ctx.pipeline().addAfter("compress", "via-encoder", encoder);
|
||||
ctx.pipeline().addAfter("decompress", "via-decoder", decoder);
|
||||
}
|
||||
@ -59,6 +65,12 @@ public class FabricDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
if (PipelineUtil.containsCause(cause, CancelCodecException.class)) return;
|
||||
super.exceptionCaught(ctx, cause);
|
||||
|
||||
if (PipelineUtil.containsCause(cause, InformativeException.class)
|
||||
&& (info.getProtocolInfo().getState() != State.HANDSHAKE
|
||||
|| Via.getManager().debugHandler().enabled())) {
|
||||
cause.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,36 +3,17 @@ package com.viaversion.fabric.mc114.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
|
@ -3,12 +3,10 @@ package com.viaversion.fabric.mc115.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@ -17,21 +15,6 @@ public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
|
@ -3,12 +3,10 @@ package com.viaversion.fabric.mc116.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@ -17,21 +15,6 @@ public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
|
@ -3,12 +3,10 @@ package com.viaversion.fabric.mc117.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@ -17,21 +15,6 @@ public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean bl, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
|
@ -3,35 +3,17 @@ package com.viaversion.fabric.mc118.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/slf4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean rejectBad, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
|
@ -3,37 +3,20 @@ package com.viaversion.fabric.mc119.mixin.pipeline;
|
||||
import com.viaversion.fabric.common.handler.PipelineReorderEvent;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
@Shadow
|
||||
private Channel channel;
|
||||
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/slf4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean rejectBad, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
}
|
||||
@Inject(method = "setCompressionThreshold", at = @At("RETURN"))
|
||||
private void reorderCompression(int compressionThreshold, boolean rejectBad, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
}
|
||||
}
|
||||
|
@ -18,21 +18,4 @@ public class MixinClientConnection {
|
||||
private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
|
||||
channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
|
||||
}
|
||||
|
||||
/*
|
||||
@Redirect(
|
||||
method = "exceptionCaught",
|
||||
remap = false,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
|
||||
))
|
||||
private void redirectDebug(Logger logger, String message, Throwable t) {
|
||||
if ("Failed to sent packet".equals(message)) {
|
||||
logger.info(message, t);
|
||||
} else {
|
||||
logger.debug(message, t);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user