Skip to content

Commit

Permalink
1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TonimatasDEV committed Oct 30, 2023
1 parent db758b8 commit b3ee4d4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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 = "<init>(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;
//}
}
Original file line number Diff line number Diff line change
@@ -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 = "<init>*", 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;
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<init>(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;
//}
}
Original file line number Diff line number Diff line change
@@ -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 = "<init>(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;
//}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit b3ee4d4

Please sign in to comment.