-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3350fc0
commit cb8eaaf
Showing
7 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...ain/java/net/tonimatasdev/packetfixerforge/mixin/ClientboundCustomPayloadPacketMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
|
||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; | ||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ClientboundCustomPayloadPacket.class, priority = 9999) | ||
public class ClientboundCustomPayloadPacketMixin { | ||
@ModifyConstant(method = "<init>*", constant = @Constant(intValue = 1048576)) | ||
private int newSize(int value) { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ain/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomPayloadPacketMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; | ||
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ServerboundCustomPayloadPacket.class, priority = 9999) | ||
public class ServerboundCustomPayloadPacketMixin { | ||
@ModifyConstant(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", constant = @Constant(intValue = 32767)) | ||
private int newSize(int value) { | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 32767)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
23 changes: 14 additions & 9 deletions
23
.../main/java/net/tonimatasdev/packetfixerforge/mixin/ServerboundCustomQueryPacketMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.network.protocol.login.ServerboundCustomQueryPacket; | ||
import net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = ServerboundCustomQueryPacket.class, priority = 9999) | ||
@Mixin(value = ServerboundCustomQueryAnswerPacket.class, priority = 9999) | ||
public class ServerboundCustomQueryPacketMixin { | ||
// <= 1.18 | ||
//@ModifyConstant(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", constant = @Constant(intValue = 1048576)) | ||
//private int newSize(int value) { | ||
// return Integer.MAX_VALUE; | ||
//} | ||
|
||
// >= 1.19 | ||
@ModifyVariable(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/FriendlyByteBuf;readNullable(Lnet/minecraft/network/FriendlyByteBuf$Reader;)Ljava/lang/Object;"), index = 1, argsOnly = true) | ||
private FriendlyByteBuf redirectReadNullable(FriendlyByteBuf value) { | ||
return new FriendlyByteBuf(value.readBytes(value.readableBytes())); | ||
// 1.19 to 1.20.1 | ||
//@ModifyVariable(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/FriendlyByteBuf;readNullable(Lnet/minecraft/network/FriendlyByteBuf$Reader;)Ljava/lang/Object;"), index = 1, argsOnly = true) | ||
//private FriendlyByteBuf redirectReadNullable(FriendlyByteBuf value) { | ||
// return new FriendlyByteBuf(value.readBytes(value.readableBytes())); | ||
//} | ||
|
||
// >= 1.20.2 | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ pluginManagement { | |
} | ||
} | ||
|
||
include("fabric", /*"forge"*/) | ||
include("fabric", "forge") | ||
rootProject.name = "PacketFixer" |