Injector code cleanup, fix connection closing

This commit is contained in:
creeper123123321 2019-10-27 12:20:24 -03:00
parent ff4c2d108e
commit 8abe965958
12 changed files with 150 additions and 264 deletions

View File

@ -0,0 +1,70 @@
/*
* MIT License
*
* Copyright (c) 2018 creeper123123321 and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.creeper123123321.viafabric.handler;
import io.netty.buffer.ByteBuf;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.Direction;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
public class CommonTransformer {
public static final String HANDLER_DECODER_NAME = "viafabric_decoder_handler";
public static final String HANDLER_ENCODER_NAME = "viafabric_encoder_handler";
public static void transformClientbound(ByteBuf draft, UserConnection user) throws Exception {
if (!draft.isReadable()) return;
// Increment sent
user.incrementSent();
transform(draft, user, Direction.OUTGOING);
}
public static void transformServerbound(ByteBuf draft, UserConnection user) throws Exception {
if (!draft.isReadable()) return;
// Ignore if pending disconnect
if (user.isPendingDisconnect()) return;
// Increment received + Check PPS
if (user.incrementReceived() && user.handlePPS()) return;
transform(draft, user, Direction.INCOMING);
}
private static void transform(ByteBuf draft, UserConnection user, Direction direction) throws Exception {
if (!user.isActive()) return;
int id = Type.VAR_INT.read(draft);
if (id == PacketWrapper.PASSTHROUGH_ID) return;
PacketWrapper wrapper = new PacketWrapper(id, draft, user);
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
protInfo.getPipeline().transform(direction, protInfo.getState(), wrapper);
ByteBuf transformed = draft.alloc().buffer();
try {
wrapper.writeToBuffer(transformed);
draft.clear().writeBytes(transformed);
} finally {
transformed.release();
}
}
}

View File

@ -24,15 +24,13 @@
package com.github.creeper123123321.viafabric.handler.clientside;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.exception.CancelException;
import us.myles.ViaVersion.packets.Direction;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.util.PipelineUtil;
@ -40,7 +38,6 @@ import java.util.List;
public class VRDecodeHandler extends ByteToMessageDecoder {
private UserConnection user;
public static final String NAME = "viafabric_decoder_handler";
public VRDecodeHandler(UserConnection user) {
this.user = user;
@ -48,37 +45,12 @@ public class VRDecodeHandler extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
// Based on ViaVersion Sponge encoder code
ByteBuf outBuf = msg.alloc().buffer().writeBytes(msg);
ByteBuf draft = msg.alloc().buffer().writeBytes(msg);
try {
// Increment sent
user.incrementSent();
if (user.isActive()) {
// Handle ID
int id = Type.VAR_INT.read(outBuf);
if (id != PacketWrapper.PASSTHROUGH_ID) {
// Transform
PacketWrapper wrapper = new PacketWrapper(id, outBuf, user);
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper);
ByteBuf newPacket = msg.alloc().buffer();
try {
wrapper.writeToBuffer(newPacket);
outBuf.clear();
outBuf.writeBytes(newPacket);
} finally {
newPacket.release();
}
}
}
// pass to minecraft encoder
out.add(outBuf.retain());
CommonTransformer.transformClientbound(draft, user);
out.add(draft.retain());
} finally {
outBuf.release();
draft.release();
}
}
@ -89,7 +61,8 @@ public class VRDecodeHandler extends ByteToMessageDecoder {
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
ProtocolInfo info = user.get(ProtocolInfo.class);
if (info.getUuid() != null) {
Via.getManager().removePortedClient(info.getUuid());

View File

@ -24,21 +24,17 @@
package com.github.creeper123123321.viafabric.handler.clientside;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.EncoderException;
import io.netty.handler.codec.MessageToByteEncoder;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.exception.CancelException;
import us.myles.ViaVersion.packets.Direction;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.util.PipelineUtil;
public class VREncodeHandler extends MessageToByteEncoder {
private UserConnection user;
public static String NAME = "viafabric_encoder_handler";
public VREncodeHandler(UserConnection user) {
this.user = user;
@ -49,44 +45,12 @@ public class VREncodeHandler extends MessageToByteEncoder {
// Based on Sponge ViaVersion decoder code
if (!(msg instanceof ByteBuf)) throw new EncoderException("Received msg isn't ByteBuf");
ByteBuf outBuffer = ctx.alloc().buffer().writeBytes((ByteBuf) msg);
ByteBuf draft = ctx.alloc().buffer().writeBytes((ByteBuf) msg);
try {
// use transformers
if (outBuffer.readableBytes() > 0) {
// Ignore if pending disconnect
if (user.isPendingDisconnect()) {
return;
}
// Increment received
boolean second = user.incrementReceived();
// Check PPS
if (second && user.handlePPS())
return;
if (user.isActive()) {
// Handle ID
int id = Type.VAR_INT.read(outBuffer);
// Transform
if (id != PacketWrapper.PASSTHROUGH_ID) {
PacketWrapper wrapper = new PacketWrapper(id, outBuffer, user);
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper);
ByteBuf newPacket = outBuffer.alloc().buffer();
try {
wrapper.writeToBuffer(newPacket);
outBuffer.clear();
outBuffer.writeBytes(newPacket);
} finally {
newPacket.release();
}
}
}
out.writeBytes(outBuffer);
}
CommonTransformer.transformServerbound(draft, user);
out.writeBytes(draft);
} finally {
outBuffer.release();
draft.release();
}
}

View File

@ -24,85 +24,33 @@
package com.github.creeper123123321.viafabric.handler.serverside;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.exception.CancelException;
import us.myles.ViaVersion.packets.Direction;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.util.PipelineUtil;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class FabricDecodeHandler extends ByteToMessageDecoder {
// https://github.com/MylesIsCool/ViaVersion/blob/1abc3ebea66878192b08b577353dff7d619ed51e/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeDecodeHandler.java
private final ByteToMessageDecoder minecraftDecoder;
private final UserConnection info;
private final UserConnection user;
public FabricDecodeHandler(UserConnection info, ByteToMessageDecoder minecraftDecoder) {
this.info = info;
this.minecraftDecoder = minecraftDecoder;
public FabricDecodeHandler(UserConnection user) {
this.user = user;
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> list) throws Exception {
// use transformers
if (bytebuf.readableBytes() > 0) {
// Ignore if pending disconnect
if (info.isPendingDisconnect()) {
return;
}
// Increment received
boolean second = info.incrementReceived();
// Check PPS
if (second) {
if (info.handlePPS())
return;
}
if (info.isActive()) {
// Handle ID
int id = Type.VAR_INT.read(bytebuf);
// Transform
ByteBuf newPacket = ctx.alloc().buffer();
try {
if (id == PacketWrapper.PASSTHROUGH_ID) {
newPacket.writeBytes(bytebuf);
} else {
PacketWrapper wrapper = new PacketWrapper(id, bytebuf, info);
ProtocolInfo protInfo = info.get(ProtocolInfo.class);
protInfo.getPipeline().transform(Direction.INCOMING, protInfo.getState(), wrapper);
wrapper.writeToBuffer(newPacket);
}
bytebuf.clear();
bytebuf = newPacket;
} catch (Exception e) {
// Clear Buffer
bytebuf.clear();
// Release Packet, be free!
newPacket.release();
throw e;
}
}
// call minecraft decoder
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
}
} finally {
if (info.isActive()) {
bytebuf.release();
}
}
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
ByteBuf draft = ctx.alloc().buffer().writeBytes(in);
try {
CommonTransformer.transformServerbound(draft, user);
out.add(draft.retain());
} finally {
draft.release();
}
}
@ -113,8 +61,9 @@ public class FabricDecodeHandler extends ByteToMessageDecoder {
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
ProtocolInfo pi = info.get(ProtocolInfo.class);
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx); // May call decode
ProtocolInfo pi = user.get(ProtocolInfo.class);
if (pi.getUuid() != null) {
Via.getManager().removePortedClient(pi.getUuid());
}

View File

@ -24,66 +24,32 @@
package com.github.creeper123123321.viafabric.handler.serverside;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.EncoderException;
import io.netty.handler.codec.MessageToByteEncoder;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.exception.CancelException;
import us.myles.ViaVersion.packets.Direction;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.util.PipelineUtil;
import java.lang.reflect.InvocationTargetException;
public class FabricEncodeHandler extends MessageToByteEncoder {
// https://github.com/MylesIsCool/ViaVersion/blob/master/sponge/src/main/java/us/myles/ViaVersion/sponge/handlers/SpongeEncodeHandler.java
private final UserConnection info;
private final MessageToByteEncoder minecraftEncoder;
private final UserConnection user;
public FabricEncodeHandler(UserConnection info, MessageToByteEncoder minecraftEncoder) {
this.info = info;
this.minecraftEncoder = minecraftEncoder;
public FabricEncodeHandler(UserConnection user) {
this.user = user;
}
@Override
protected void encode(final ChannelHandlerContext ctx, Object o, final ByteBuf bytebuf) throws Exception {
// handle the packet type
if (!(o instanceof ByteBuf)) {
// call minecraft encoder
try {
PipelineUtil.callEncode(this.minecraftEncoder, ctx, o, bytebuf);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
}
}
}
if (bytebuf.readableBytes() == 0) {
throw new CancelException();
}
// Increment sent
info.incrementSent();
if (info.isActive()) {
// Handle ID
int id = Type.VAR_INT.read(bytebuf);
// Transform
ByteBuf oldPacket = bytebuf.copy();
bytebuf.clear();
protected void encode(final ChannelHandlerContext ctx, Object in, final ByteBuf out) throws Exception {
if (!(in instanceof ByteBuf)) throw new EncoderException("Received object isn't ByteBuf");
try {
PacketWrapper wrapper = new PacketWrapper(id, oldPacket, info);
ProtocolInfo protInfo = info.get(ProtocolInfo.class);
protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper);
wrapper.writeToBuffer(bytebuf);
} catch (Exception e) {
bytebuf.clear();
throw e;
} finally {
oldPacket.release();
}
ByteBuf draft = ctx.alloc().buffer().writeBytes((ByteBuf) in);
try {
CommonTransformer.transformClientbound(draft, user);
out.writeBytes(draft);
} finally {
draft.release();
}
}

View File

@ -24,6 +24,9 @@
package com.github.creeper123123321.viafabric.mixin;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import net.minecraft.network.ClientConnection;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
@ -40,11 +43,33 @@ public class MixinClientConnection {
value = "INVOKE",
target = "Lorg/apache/logging/log4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"
))
public void redirectDebug(Logger logger, String message, Throwable t) {
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);
}
}
@Redirect(method = "setMinCompressedSize", at = @At(
value = "INVOKE",
remap = false,
target = "Lio/netty/channel/ChannelPipeline;addBefore(Ljava/lang/String;Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"
))
private ChannelPipeline decodeEncodePlacement(ChannelPipeline instance, String base, String newHandler, ChannelHandler handler) {
// Fixes the handler order
switch (base) {
case "decoder": {
if (instance.get(CommonTransformer.HANDLER_DECODER_NAME) != null)
base = CommonTransformer.HANDLER_DECODER_NAME;
break;
}
case "encoder": {
if (instance.get(CommonTransformer.HANDLER_ENCODER_NAME) != null)
base = CommonTransformer.HANDLER_ENCODER_NAME;
break;
}
}
return instance.addBefore(base, newHandler, handler);
}
}

View File

@ -24,12 +24,11 @@
package com.github.creeper123123321.viafabric.mixin;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import com.github.creeper123123321.viafabric.handler.serverside.FabricDecodeHandler;
import com.github.creeper123123321.viafabric.handler.serverside.FabricEncodeHandler;
import io.netty.channel.Channel;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.MessageToByteEncoder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -45,11 +44,8 @@ public class MixinServerNetworkIoChInit {
UserConnection user = new UserConnection(channel);
new ProtocolPipeline(user);
MessageToByteEncoder oldEncoder = (MessageToByteEncoder) channel.pipeline().get("encoder");
ByteToMessageDecoder oldDecoder = (ByteToMessageDecoder) channel.pipeline().get("decoder");
channel.pipeline().replace("encoder", "encoder", new FabricEncodeHandler(user, oldEncoder));
channel.pipeline().replace("decoder", "decoder", new FabricDecodeHandler(user, oldDecoder));
channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
}
}
}

View File

@ -1,57 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2018 creeper123123321 and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.creeper123123321.viafabric.mixin.client;
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
import com.github.creeper123123321.viafabric.handler.clientside.VREncodeHandler;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import net.minecraft.network.ClientConnection;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ClientConnection.class)
public class MixinClientConnection {
@Redirect(method = "setMinCompressedSize", at = @At(
value = "INVOKE",
remap = false,
target = "Lio/netty/channel/ChannelPipeline;addBefore(Ljava/lang/String;Ljava/lang/String;Lio/netty/channel/ChannelHandler;)Lio/netty/channel/ChannelPipeline;"
))
private ChannelPipeline decodeEncodePlacement(ChannelPipeline instance, String base, String newHandler, ChannelHandler handler) {
// Fixes the handler order
switch (base) {
case "decoder": {
if (instance.get(VRDecodeHandler.class) != null) base = VRDecodeHandler.NAME;
break;
}
case "encoder": {
if (instance.get(VREncodeHandler.class) != null) base = VREncodeHandler.NAME;
break;
}
}
return instance.addBefore(base, newHandler, handler);
}
}

View File

@ -24,6 +24,7 @@
package com.github.creeper123123321.viafabric.mixin.client;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
import com.github.creeper123123321.viafabric.handler.clientside.VREncodeHandler;
import com.github.creeper123123321.viafabric.platform.VRClientSideUserConnection;
@ -44,8 +45,8 @@ public class MixinClientConnectionChInit {
UserConnection user = new VRClientSideUserConnection(channel);
new ProtocolPipeline(user);
channel.pipeline().addBefore("encoder", VREncodeHandler.NAME, new VREncodeHandler(user));
channel.pipeline().addBefore("decoder", VRDecodeHandler.NAME, new VRDecodeHandler(user));
channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new VREncodeHandler(user));
channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new VRDecodeHandler(user));
}
}
}

View File

@ -24,8 +24,7 @@
package com.github.creeper123123321.viafabric.platform;
import com.github.creeper123123321.viafabric.handler.clientside.VRDecodeHandler;
import com.github.creeper123123321.viafabric.handler.clientside.VREncodeHandler;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
@ -53,10 +52,10 @@ public class VRClientSideUserConnection extends UserConnection {
packet.release();
final Channel channel = this.getChannel();
if (currentThread) {
PipelineUtil.getPreviousContext(VRDecodeHandler.NAME, channel.pipeline()).fireChannelRead(copy);
PipelineUtil.getPreviousContext(CommonTransformer.HANDLER_DECODER_NAME, channel.pipeline()).fireChannelRead(copy);
} else {
channel.eventLoop().submit(() -> {
PipelineUtil.getPreviousContext(VRDecodeHandler.NAME, channel.pipeline()).fireChannelRead(copy);
PipelineUtil.getPreviousContext(CommonTransformer.HANDLER_DECODER_NAME, channel.pipeline()).fireChannelRead(copy);
});
}
}
@ -72,17 +71,17 @@ public class VRClientSideUserConnection extends UserConnection {
copy.writeBytes(packet);
packet.release();
final Channel channel = this.getChannel();
PipelineUtil.getPreviousContext(VRDecodeHandler.NAME, channel.pipeline()).fireChannelRead(copy);
PipelineUtil.getPreviousContext(CommonTransformer.HANDLER_DECODER_NAME, channel.pipeline()).fireChannelRead(copy);
return channel.newSucceededFuture();
}
@Override
public void sendRawPacketToServer(ByteBuf packet, boolean currentThread) {
if (currentThread) {
getChannel().pipeline().context(VREncodeHandler.NAME).writeAndFlush(packet);
getChannel().pipeline().context(CommonTransformer.HANDLER_ENCODER_NAME).writeAndFlush(packet);
} else {
getChannel().eventLoop().submit(() -> {
getChannel().pipeline().context(VREncodeHandler.NAME).writeAndFlush(packet);
getChannel().pipeline().context(CommonTransformer.HANDLER_ENCODER_NAME).writeAndFlush(packet);
});
}
}

View File

@ -24,6 +24,7 @@
package com.github.creeper123123321.viafabric.platform;
import com.github.creeper123123321.viafabric.handler.CommonTransformer;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.SharedConstants;
@ -52,12 +53,12 @@ public class VRInjector implements ViaInjector {
@Override
public String getEncoderName() {
return "encoder";
return CommonTransformer.HANDLER_ENCODER_NAME;
}
@Override
public String getDecoderName() {
return "decoder";
return CommonTransformer.HANDLER_DECODER_NAME;
}
@Override

View File

@ -7,7 +7,6 @@
"MixinServerNetworkIoChInit"
],
"client": [
"client.MixinClientConnection",
"client.MixinClientConnectionChInit",
"client.MixinMultiplayerScreen"
],