Skip to content

Commit

Permalink
Extend packet size bugfix pt. 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jul 18, 2024
1 parent ffc316e commit 76fa286
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package mod.acgaming.universaltweaks.bugfixes.misc.packetsize.mixin;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import net.minecraft.network.play.client.CPacketCustomPayload;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(CPacketCustomPayload.class)
public class UTCPacketCustomPayloadClientMixin
{
@ModifyConstant(method = "<init>(Ljava/lang/String;Lnet/minecraft/network/PacketBuffer;)V", constant = @Constant(intValue = 32767))
public int utPacketSizeCustomPayloadInit(int constant)
{
return UTConfigBugfixes.MISC.utPacketSize;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package mod.acgaming.universaltweaks.bugfixes.misc.packetsize.mixin;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import net.minecraft.network.play.client.CPacketCustomPayload;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(CPacketCustomPayload.class)
public class UTCPacketCustomPayloadCommonMixin
{
@ModifyConstant(method = "readPacketData", constant = @Constant(intValue = 32767))
public int utPacketSizeCustomPayloadRead(int constant)
{
return UTConfigBugfixes.MISC.utPacketSize;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package mod.acgaming.universaltweaks.bugfixes.misc.packetsize.mixin;

import net.minecraft.network.NettyCompressionDecoder;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import net.minecraft.network.NettyCompressionDecoder;
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,8 +1,7 @@
package mod.acgaming.universaltweaks.bugfixes.misc.packetsize.mixin;

import net.minecraft.network.PacketBuffer;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import net.minecraft.network.PacketBuffer;
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,21 +1,21 @@
package mod.acgaming.universaltweaks.bugfixes.misc.packetsize.mixin;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import net.minecraft.network.play.client.CPacketCustomPayload;
import net.minecraft.network.play.server.SPacketCustomPayload;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(CPacketCustomPayload.class)
public class UTCPacketCustomPayloadMixin
@Mixin(SPacketCustomPayload.class)
public class UTSPacketCustomPayloadMixin
{
@ModifyConstant(method = "<init>(Ljava/lang/String;Lnet/minecraft/network/PacketBuffer;)V", constant = @Constant(intValue = 32767))
@ModifyConstant(method = "<init>(Ljava/lang/String;Lnet/minecraft/network/PacketBuffer;)V", constant = @Constant(intValue = 1048576))
public int utPacketSizeCustomPayloadInit(int constant)
{
return UTConfigBugfixes.MISC.utPacketSize;
}

@ModifyConstant(method = "readPacketData", constant = @Constant(intValue = 32767))
@ModifyConstant(method = "readPacketData", constant = @Constant(intValue = 1048576))
public int utPacketSizeCustomPayloadRead(int constant)
{
return UTConfigBugfixes.MISC.utPacketSize;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/mixins.bugfixes.misc.packetsize.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTNettyCompressionDecoderMixin", "UTPacketBufferMixin"],
"client": ["UTCPacketCustomPayloadMixin"]
"mixins": ["UTCPacketCustomPayloadCommonMixin", "UTNettyCompressionDecoderMixin", "UTPacketBufferMixin", "UTSPacketCustomPayloadMixin"],
"client": ["UTCPacketCustomPayloadClientMixin"]
}

0 comments on commit 76fa286

Please sign in to comment.