From 2f867e6aeaf24d145ea7abe2bf46700c7098c7f4 Mon Sep 17 00:00:00 2001 From: TonimatasDEV Date: Tue, 19 Sep 2023 03:28:47 +0200 Subject: [PATCH] Add method missing in Immersive Portals --- .../packetfixerfabric/mixin/MixinConfigPlugin.java | 1 + .../CustomPayloadS2CPacketMixin.java | 14 ++++++++++++++ fabric/src/main/resources/packetfixer.mixins.json | 3 ++- .../packetfixerforge/mixin/MixinConfigPlugin.java | 1 + .../ClientboundCustomPayloadPacketMixin.java | 14 ++++++++++++++ forge/src/main/resources/packetfixer.mixins.json | 3 ++- 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/compat/immersiveportals/CustomPayloadS2CPacketMixin.java create mode 100644 forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/compat/immersiveportals/ClientboundCustomPayloadPacketMixin.java diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/MixinConfigPlugin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/MixinConfigPlugin.java index e6d04e9..5463199 100644 --- a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/MixinConfigPlugin.java +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/MixinConfigPlugin.java @@ -31,6 +31,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerfabric.mixin.PacketInflaterMixin")) return !connectivity; if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerfabric.mixin.compat.connectivity.PacketInflaterMixin")) return connectivity; if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerfabric.mixin.CustomPayloadS2CPacket")) return !immersivePortals; + if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerfabric.mixin,immersiveportals.CustomPayloadS2CPacket")) return immersivePortals; return true; } diff --git a/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/compat/immersiveportals/CustomPayloadS2CPacketMixin.java b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/compat/immersiveportals/CustomPayloadS2CPacketMixin.java new file mode 100644 index 0000000..5abd5a2 --- /dev/null +++ b/fabric/src/main/java/net/tonimatasdev/packetfixerfabric/mixin/compat/immersiveportals/CustomPayloadS2CPacketMixin.java @@ -0,0 +1,14 @@ +package net.tonimatasdev.packetfixerfabric.mixin.compat.immersiveportals; + +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 = "(Lnet/minecraft/util/Identifier;Lnet/minecraft/network/PacketByteBuf;)V", constant = @Constant(intValue = 1048576)) + private int newSize(int value) { + return Integer.MAX_VALUE; + } +} diff --git a/fabric/src/main/resources/packetfixer.mixins.json b/fabric/src/main/resources/packetfixer.mixins.json index 19ae55e..37de13a 100644 --- a/fabric/src/main/resources/packetfixer.mixins.json +++ b/fabric/src/main/resources/packetfixer.mixins.json @@ -12,7 +12,8 @@ "NbtTagSizeTrackerMixin", "PacketEncoderMixin", "PacketInflaterMixin", - "compat.connectivity.PacketInflaterMixin" + "compat.connectivity.PacketInflaterMixin", + "compat.immersiveportals.CustomPayloadS2CPacketMixin" ], "injectors": { "defaultRequire": 1 diff --git a/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.java index cb1784b..2794c4e 100644 --- a/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.java +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/MixinConfigPlugin.java @@ -28,6 +28,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.CompressionDecoderMixin")) return !connectivity; if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.compat.connectivity.CompressionDecoderMixin")) return connectivity; if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.ClientboundCustomPayloadPacketMixin")) return !immersivePortals; + if (mixinClassName.equalsIgnoreCase("net.tonimatasdev.packetfixerforge.mixin.compat.immersiveportals.ClientboundCustomPayloadPacketMixin")) return immersivePortals; return true; } diff --git a/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/compat/immersiveportals/ClientboundCustomPayloadPacketMixin.java b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/compat/immersiveportals/ClientboundCustomPayloadPacketMixin.java new file mode 100644 index 0000000..823e092 --- /dev/null +++ b/forge/src/main/java/net/tonimatasdev/packetfixerforge/mixin/compat/immersiveportals/ClientboundCustomPayloadPacketMixin.java @@ -0,0 +1,14 @@ +package net.tonimatasdev.packetfixerforge.mixin.compat.immersiveportals; + +import net.minecraft.network.protocol.game.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 = "(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/network/FriendlyByteBuf;)V", constant = @Constant(intValue = 1048576)) + private int newSize(int value) { + return Integer.MAX_VALUE; + } +} \ No newline at end of file diff --git a/forge/src/main/resources/packetfixer.mixins.json b/forge/src/main/resources/packetfixer.mixins.json index f48144e..b55a012 100644 --- a/forge/src/main/resources/packetfixer.mixins.json +++ b/forge/src/main/resources/packetfixer.mixins.json @@ -16,6 +16,7 @@ "PacketEncoderMixin", "ServerboundCustomPayloadPacketMixin", "ServerboundCustomQueryPacketMixin", - "compat.connectivity.CompressionDecoderMixin" + "compat.connectivity.CompressionDecoderMixin", + "compat.immersiveportals.ClientboundCustomPayloadPacketMixin" ] }