Skip to content

Commit

Permalink
Merge pull request #24 from Luke100000/SplitterFix
Browse files Browse the repository at this point in the history
Fixed crash on very large packages
  • Loading branch information
TonimatasDEV authored Oct 30, 2023
2 parents 9447f75 + 14f261a commit 0592770
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.tonimatasdev.packetfixerfabric.mixin;

import net.minecraft.network.SizePrepender;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(SizePrepender.class)
public class SizePrependerMixin {
@ModifyConstant(method = "encode(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Lio/netty/buffer/ByteBuf;)V", constant = @Constant(intValue = 3))
private int newSize(int value) {
return 8;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package net.tonimatasdev.packetfixerfabric.mixin;

import net.minecraft.network.SplitterHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(SplitterHandler.class)
public class SplitterHandlerMixin {
@ModifyConstant(method = "decode(Lio/netty/channel/ChannelHandlerContext;Lio/netty/buffer/ByteBuf;Ljava/util/List;)V", constant = @Constant(intValue = 3))
private int newSize(int value) {
return 8;
}
}
2 changes: 2 additions & 0 deletions fabric/src/main/resources/packetfixer.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"NbtTagSizeTrackerMixin",
"PacketEncoderMixin",
"PacketInflaterMixin",
"SizePrependerMixin",
"SplitterHandlerMixin",
"compat.connectivity.PacketInflaterMixin",
"compat.immersiveportals.CustomPayloadS2CPacketMixin"
],
Expand Down

0 comments on commit 0592770

Please sign in to comment.