-
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
a9c1c6f
commit 6342f14
Showing
18 changed files
with
83 additions
and
55 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...c/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadC2SPacketMixin.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
4 changes: 2 additions & 2 deletions
4
...c/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/CustomPayloadS2CPacketMixin.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
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
11 changes: 5 additions & 6 deletions
11
.../main/java/net/tonimatasdev/packetfixerfabric/mixin/LoginQueryResponseC2SPacketMixin.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,14 @@ | ||
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.ModifyVariable; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = LoginQueryResponseC2SPacket.class, priority = 9999) | ||
public class LoginQueryResponseC2SPacketMixin { | ||
@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())); | ||
@ModifyConstant(method = "getVanillaPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketEncoderMixin.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
2 changes: 1 addition & 1 deletion
2
fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/PacketInflaterMixin.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
2 changes: 1 addition & 1 deletion
2
fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/SizePrependerMixin.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
25 changes: 20 additions & 5 deletions
25
fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/SplitterHandlerMixin.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,29 @@ | ||
package net.tonimatasdev.packetfixerfabric.mixin; | ||
|
||
import net.minecraft.network.SplitterHandler; | ||
import io.netty.buffer.ByteBuf; | ||
import io.netty.buffer.Unpooled; | ||
import io.netty.channel.ChannelHandlerContext; | ||
import net.minecraft.network.handler.SplitterHandler; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(value = SplitterHandler.class, priority = 9999) | ||
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) { | ||
@ModifyConstant(method = "shouldSplit", constant = @Constant(intValue = 3)) | ||
private static int newSize(int value) { | ||
return 8; | ||
} | ||
|
||
@Inject(method = "handlerRemoved0", at = @At(value = "HEAD"), cancellable = true) | ||
private void redirectReadNullable(ChannelHandlerContext p_299287_, CallbackInfo ci) { | ||
Unpooled.directBuffer(8).release(); | ||
ci.cancel(); | ||
} | ||
|
||
@Redirect(method = "decode", at = @At(value = "FIELD", target = "Lnet/minecraft/network/handler/SplitterHandler;reusableBuf:Lio/netty/buffer/ByteBuf;", opcode = Opcodes.GETFIELD)) | ||
public ByteBuf accountBits(SplitterHandler instance) { | ||
return Unpooled.directBuffer(8); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ava/net/tonimatasdev/packetfixerfabric/mixin/compat/connectivity/PacketInflaterMixin.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
4 changes: 2 additions & 2 deletions
4
...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
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
4 changes: 2 additions & 2 deletions
4
...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
15 changes: 7 additions & 8 deletions
15
.../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,15 +1,14 @@ | ||
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 { | ||
@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())); | ||
@ModifyConstant(method = "readUnknownPayload", constant = @Constant(intValue = 1048576)) | ||
private static int newSize(int value) { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/SplitterHandlerMixin.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/Varint21FrameDecoderMixin.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.tonimatasdev.packetfixerforge.mixin; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import io.netty.buffer.Unpooled; | ||
import io.netty.channel.ChannelHandlerContext; | ||
import net.minecraft.network.Varint21FrameDecoder; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Varint21FrameDecoder.class) | ||
public class Varint21FrameDecoderMixin { | ||
@ModifyConstant(method = "copyVarint", constant = @Constant(intValue = 3)) | ||
private static int newSize(int value) { | ||
return 8; | ||
} | ||
|
||
@Inject(method = "handlerRemoved0", at = @At(value = "HEAD"), cancellable = true) | ||
private void redirectReadNullable(ChannelHandlerContext p_299287_, CallbackInfo ci) { | ||
Unpooled.directBuffer(8).release(); | ||
ci.cancel(); | ||
} | ||
|
||
@Redirect(method = "decode", at = @At(value = "FIELD", target = "Lnet/minecraft/network/Varint21FrameDecoder;helperBuf:Lio/netty/buffer/ByteBuf;", opcode = Opcodes.GETFIELD)) | ||
public ByteBuf accountBits(Varint21FrameDecoder instance) { | ||
return Unpooled.directBuffer(8); | ||
} | ||
} |
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
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