From b3ee4d4f8fa22e4d99be7970600f9c3b97668d67 Mon Sep 17 00:00:00 2001 From: TonimatasDEV Date: Tue, 31 Oct 2023 00:37:13 +0100 Subject: [PATCH] 1.20.1 --- .../mixin/CustomPayloadC2SPacketMixin.java | 11 +++++++++-- .../mixin/CustomPayloadS2CPacketMixin.java | 11 +++++++++-- .../mixin/LoginQueryRequestS2CPacketMixin.java | 9 ++++++++- .../mixin/LoginQueryResponseC2SPacketMixin.java | 17 ++++++++++++++--- .../mixin/PacketEncoderMixin.java | 2 +- .../mixin/PacketInflaterMixin.java | 2 +- 6 files changed, 42 insertions(+), 10 deletions(-) diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadC2SPacketMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadC2SPacketMixin.java index b3dc5a5..8237a78 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadC2SPacketMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadC2SPacketMixin.java @@ -1,15 +1,22 @@ package net.tonimatasdev.packetfixerfabric.mixin; -import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; +import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(value = CustomPayloadC2SPacket.class, priority = 9999) public class CustomPayloadC2SPacketMixin { - @ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 32767)) + // <= 1.20.1 + @ModifyConstant(method = "(Lnet/minecraft/network/PacketByteBuf;)V", constant = @Constant(intValue = 32767)) private static int newSize(int value) { return Integer.MAX_VALUE; } + + // 1.20.2 + //@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 32767)) + //private static int newSize(int value) { + // return Integer.MAX_VALUE; + //} } diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadS2CPacketMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadS2CPacketMixin.java index 0b89c74..c84353c 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadS2CPacketMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadS2CPacketMixin.java @@ -1,14 +1,21 @@ package net.tonimatasdev.packetfixerfabric.mixin; -import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket; +import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(value = CustomPayloadS2CPacket.class, priority = 9999) public class CustomPayloadS2CPacketMixin { - @ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) + // <= 1.20.1 + @ModifyConstant(method = "*", constant = @Constant(intValue = 1048576)) private static int newSize(int value) { return Integer.MAX_VALUE; } + + // 1.20.2 + //@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) + //private static int newSize(int value) { + // return Integer.MAX_VALUE; + //} } diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryRequestS2CPacketMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryRequestS2CPacketMixin.java index cdfe8f9..72bed78 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryRequestS2CPacketMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryRequestS2CPacketMixin.java @@ -7,8 +7,15 @@ @Mixin(value = LoginQueryRequestS2CPacket.class, priority = 9999) public class LoginQueryRequestS2CPacketMixin { - @ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) + // <= 1.20.1 + @ModifyConstant(method = "(Lnet/minecraft/network/PacketByteBuf;)V", constant = @Constant(intValue = 1048576)) private static int newSize(int value) { return Integer.MAX_VALUE; } + + // 1.20.2 + //@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) + //private static int newSize(int value) { + // return Integer.MAX_VALUE; + //} } diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryResponseC2SPacketMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryResponseC2SPacketMixin.java index 895ea43..200d2ef 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryResponseC2SPacketMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryResponseC2SPacketMixin.java @@ -1,14 +1,25 @@ package net.tonimatasdev.packetfixerfabric.mixin; +import net.minecraft.network.PacketByteBuf; import net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(value = LoginQueryResponseC2SPacket.class, priority = 9999) public class LoginQueryResponseC2SPacketMixin { - @ModifyConstant(method = "getVanillaPayload", constant = @Constant(intValue = 1048576)) - private static int newSize(int value) { - return Integer.MAX_VALUE; + // <= 1.20.1 + @ModifyVariable(method = "(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/PacketByteBuf;readNullable(Lnet/minecraft/network/PacketByteBuf$PacketReader;)Ljava/lang/Object;"), index = 1, argsOnly = true) + private PacketByteBuf redirectReadNullable(PacketByteBuf value) { + return new PacketByteBuf(value.readBytes(value.readableBytes())); } + + + // 1.20.2 + //@ModifyConstant(method = "getVanillaPayload", constant = @Constant(intValue = 1048576)) + //private static int newSize(int value) { + // return Integer.MAX_VALUE; + //} } diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketEncoderMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketEncoderMixin.java index 9931f1e..fef6f19 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketEncoderMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketEncoderMixin.java @@ -1,6 +1,6 @@ package net.tonimatasdev.packetfixerfabric.mixin; -import net.minecraft.network.handler.PacketEncoder; +import net.minecraft.network.PacketEncoder; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketInflaterMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketInflaterMixin.java index d2fbdf5..c61f013 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketInflaterMixin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketInflaterMixin.java @@ -1,6 +1,6 @@ package net.tonimatasdev.packetfixerfabric.mixin; -import net.minecraft.network.handler.PacketInflater; +import net.minecraft.network.PacketInflater; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant;