From ad749aea8be47bd8d563ccb2917af426de7fc60b Mon Sep 17 00:00:00 2001 From: ziro Date: Thu, 30 Nov 2023 11:55:45 +0700 Subject: [PATCH 1/3] chore: Maven migration (again) --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 4388590..2a30e7e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ pluginManagement { repositories { maven("https://maven.fabricmc.net/") - maven("https://maven.aap.my.id/releases/") // For early access to "unstable" features + maven("https://maven.aap.my.id/") // For early access to "unstable" features maven("https://maven.architectury.dev/") maven("https://jitpack.io/") maven("https://files.minecraftforge.net/maven/") From 778397b5c6ee013b2aa4c61df1f139cc1ea67472 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani <46041660+null2264@users.noreply.github.com> Date: Sat, 2 Dec 2023 16:17:32 +0700 Subject: [PATCH 2/3] fix: GH-55 - Incompatibility with FAPI 0.91+ (GH-56) * fix: Catch NoClassDefFoundError on FAPI 0.91+ * chore: Simplify Create Mixin * fix: Never use FAPI's PacketByteBufPayload --- gradle.properties | 6 ++--- .../fluid/CreateFluidReactionsMixin.java | 9 ++++---- .../ClientboundCustomPayloadPacketMixin.java | 18 +++++++-------- .../mixin/network/ConnectionMixin.java | 2 +- .../ServerboundCustomPayloadPacketMixin.java | 22 +++++++++---------- .../network/CGClientPlayNetworkHandler.java | 4 ---- .../network/CGServerPlayNetworkHandler.java | 4 ---- 7 files changed, 28 insertions(+), 37 deletions(-) diff --git a/gradle.properties b/gradle.properties index f77e8d2..d76aeda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,12 +16,12 @@ loader_version_1_18_2=0.14.14 fabric_version_1_18_2=0.76.0+1.18.2 # Runtime Properties -recipe_viewer=none +recipe_viewer=emi # Dependencies jankson_version=1.2.2 -emi_version=1.0.21 +emi_version=1.0.26 # Version Specific Dependencies create_version_1_18_2=0.5.0.i-1002+1.18.2 -port_lib_version_1_18_2=1.2.869-beta+1.18.2 +port_lib_version_1_18_2=1.2.869-beta+1.18.2 \ No newline at end of file diff --git a/src/main/java/io/github/null2264/cobblegen/mixin/fluid/CreateFluidReactionsMixin.java b/src/main/java/io/github/null2264/cobblegen/mixin/fluid/CreateFluidReactionsMixin.java index a9156a0..d3a7209 100644 --- a/src/main/java/io/github/null2264/cobblegen/mixin/fluid/CreateFluidReactionsMixin.java +++ b/src/main/java/io/github/null2264/cobblegen/mixin/fluid/CreateFluidReactionsMixin.java @@ -31,11 +31,10 @@ private static boolean handleReaction(Level level, BlockPos pos, Fluid fluid1, F return FLUID_INTERACTION.interactFromPipe(level, pos, fluid1, fluid2); } + @SuppressWarnings("InvalidInjectorMethodSignature") // False positive @Inject( - //#if FABRIC - method = "handlePipeFlowCollision(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lio/github/fabricators_of_create/porting_lib/util/FluidStack;Lio/github/fabricators_of_create/porting_lib/util/FluidStack;)V", - //#else - //$$ method = "handlePipeFlowCollision", + method = "handlePipeFlowCollision", + //#if FABRIC<=0 //$$ remap = false, //#endif at = @At(value = "HEAD"), cancellable = true @@ -49,7 +48,7 @@ private static boolean handleReaction(Level level, BlockPos pos, Fluid fluid1, F } @Inject( - method = "handlePipeSpillCollision(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/material/Fluid;Lnet/minecraft/world/level/material/FluidState;)V", + method = "handlePipeSpillCollision", //#if FABRIC<=0 //$$ remap = false, //#endif diff --git a/src/main/java/io/github/null2264/cobblegen/mixin/network/ClientboundCustomPayloadPacketMixin.java b/src/main/java/io/github/null2264/cobblegen/mixin/network/ClientboundCustomPayloadPacketMixin.java index acd46da..62b9909 100644 --- a/src/main/java/io/github/null2264/cobblegen/mixin/network/ClientboundCustomPayloadPacketMixin.java +++ b/src/main/java/io/github/null2264/cobblegen/mixin/network/ClientboundCustomPayloadPacketMixin.java @@ -8,22 +8,22 @@ //$$ import io.github.null2264.cobblegen.network.PacketByteBufPayload; //$$ import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; //$$ import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +//$$ import net.minecraft.resources.ResourceLocation; +//$$ import org.spongepowered.asm.mixin.injection.At; +//$$ import org.spongepowered.asm.mixin.injection.Inject; +//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +//$$ +//$$ import static io.github.null2264.cobblegen.CobbleGen.MOD_ID; //#endif -import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Debug; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import static io.github.null2264.cobblegen.CobbleGen.SYNC_CHANNEL; -import static io.github.null2264.cobblegen.CobbleGen.SYNC_PING_CHANNEL; - -@Mixin(ClientboundCustomPayloadPacket.class) +@Mixin(value = ClientboundCustomPayloadPacket.class, priority = 999) public abstract class ClientboundCustomPayloadPacketMixin { //#if MC>=1.20.2 //$$ @Inject(method = "readPayload", at = @At("HEAD"), cancellable = true) //$$ private static void read(ResourceLocation id, FriendlyByteBuf buf, CallbackInfoReturnable cir) { - //$$ if (!(id.equals(SYNC_CHANNEL)) || (id.equals(SYNC_PING_CHANNEL))) + //$$ if (!id.getNamespace().equals(MOD_ID)) //$$ return; //$$ //$$ FriendlyByteBuf newBuf = new FriendlyByteBuf(Unpooled.buffer()); diff --git a/src/main/java/io/github/null2264/cobblegen/mixin/network/ConnectionMixin.java b/src/main/java/io/github/null2264/cobblegen/mixin/network/ConnectionMixin.java index 67dca0b..1c018dd 100644 --- a/src/main/java/io/github/null2264/cobblegen/mixin/network/ConnectionMixin.java +++ b/src/main/java/io/github/null2264/cobblegen/mixin/network/ConnectionMixin.java @@ -15,7 +15,7 @@ public abstract class ConnectionMixin { //#if MC>=1.20.2 //$$ @Shadow public abstract boolean isConnected(); - + //$$ //$$ @Inject(method = "disconnect", at = @At("TAIL")) //$$ private void disconnect(Component component, CallbackInfo ci) { //$$ if (this.isConnected()) diff --git a/src/main/java/io/github/null2264/cobblegen/mixin/network/ServerboundCustomPayloadPacketMixin.java b/src/main/java/io/github/null2264/cobblegen/mixin/network/ServerboundCustomPayloadPacketMixin.java index 3078111..f60b6f0 100644 --- a/src/main/java/io/github/null2264/cobblegen/mixin/network/ServerboundCustomPayloadPacketMixin.java +++ b/src/main/java/io/github/null2264/cobblegen/mixin/network/ServerboundCustomPayloadPacketMixin.java @@ -1,29 +1,29 @@ package io.github.null2264.cobblegen.mixin.network; -import net.minecraft.network.FriendlyByteBuf; +import org.spongepowered.asm.mixin.Debug; +import org.spongepowered.asm.mixin.Mixin; //#if MC<1.20.2 import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; //#else +//$$ import net.minecraft.network.FriendlyByteBuf; //$$ import io.netty.buffer.Unpooled; //$$ import io.github.null2264.cobblegen.network.PacketByteBufPayload; //$$ import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; //$$ import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +//$$ import net.minecraft.resources.ResourceLocation; +//$$ import org.spongepowered.asm.mixin.injection.At; +//$$ import org.spongepowered.asm.mixin.injection.Inject; +//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +//$$ +//$$ import static io.github.null2264.cobblegen.CobbleGen.MOD_ID; //#endif -import net.minecraft.resources.ResourceLocation; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import static io.github.null2264.cobblegen.CobbleGen.SYNC_CHANNEL; -import static io.github.null2264.cobblegen.CobbleGen.SYNC_PING_CHANNEL; -@Mixin(ServerboundCustomPayloadPacket.class) +@Mixin(value = ServerboundCustomPayloadPacket.class, priority = 999) public abstract class ServerboundCustomPayloadPacketMixin { //#if MC>=1.20.2 //$$ @Inject(method = "readPayload", at = @At("HEAD"), cancellable = true) //$$ private static void read(ResourceLocation id, FriendlyByteBuf buf, CallbackInfoReturnable cir) { - //$$ if (!(id.equals(SYNC_CHANNEL)) || (id.equals(SYNC_PING_CHANNEL))) + //$$ if (!id.getNamespace().equals(MOD_ID)) //$$ return; //$$ //$$ FriendlyByteBuf newBuf = new FriendlyByteBuf(Unpooled.buffer()); diff --git a/src/main/java/io/github/null2264/cobblegen/network/CGClientPlayNetworkHandler.java b/src/main/java/io/github/null2264/cobblegen/network/CGClientPlayNetworkHandler.java index 3410094..21324e0 100644 --- a/src/main/java/io/github/null2264/cobblegen/network/CGClientPlayNetworkHandler.java +++ b/src/main/java/io/github/null2264/cobblegen/network/CGClientPlayNetworkHandler.java @@ -29,10 +29,6 @@ public static boolean handlePacket(ClientPacketListener listener, ClientboundCus //$$ public static boolean handlePacket(ClientCommonPacketListenerImpl listener, CustomPacketPayload packet) { //#endif //#if MC>=1.20.2 - //#if FABRIC>=1 - //$$ if (LoaderCompat.isModLoaded("fabric") && packet instanceof net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload && packet.id().getNamespace().equals(MOD_ID)) - //$$ packet = new PacketByteBufPayload(packet.id(), ((net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload) packet).data()); - //#endif //$$ if (!(packet instanceof PacketByteBufPayload)) return false; //$$ ResourceLocation id = ((PacketByteBufPayload) packet).id(); //#else diff --git a/src/main/java/io/github/null2264/cobblegen/network/CGServerPlayNetworkHandler.java b/src/main/java/io/github/null2264/cobblegen/network/CGServerPlayNetworkHandler.java index 739f4d1..6368578 100644 --- a/src/main/java/io/github/null2264/cobblegen/network/CGServerPlayNetworkHandler.java +++ b/src/main/java/io/github/null2264/cobblegen/network/CGServerPlayNetworkHandler.java @@ -51,10 +51,6 @@ public static boolean handlePacket(ServerGamePacketListenerImpl listener, Server //$$ public static boolean handlePacket(ServerCommonPacketListenerImpl listener, CustomPacketPayload packet) { //#endif //#if MC>=1.20.2 - //#if FABRIC>=1 - //$$ if (LoaderCompat.isModLoaded("fabric") && packet instanceof net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload && packet.id().getNamespace().equals(MOD_ID)) - //$$ packet = new PacketByteBufPayload(packet.id(), ((net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload) packet).data()); - //#endif //$$ if (!(packet instanceof PacketByteBufPayload)) return false; //$$ ResourceLocation id = ((PacketByteBufPayload) packet).id(); //#else From 2bd8a5e7c989f160737b0749b680219016ab05df Mon Sep 17 00:00:00 2001 From: ziro Date: Sat, 2 Dec 2023 16:20:50 +0700 Subject: [PATCH 3/3] chore: Bumps version to 5.2.3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d76aeda..2b7f88b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx5G # Mod Properties -mod_version=5.2.2 +mod_version=5.2.3 version_stage=BETA maven_group=io.github.null2264 archives_base_name=cobblegen