From 72b6b915189638e8438c9ec35c8901ced8445099 Mon Sep 17 00:00:00 2001 From: Crystal_0404 <120556221+Crystal0404@users.noreply.github.com> Date: Wed, 13 Nov 2024 02:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8E=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=89=88minihud=E4=B8=8D=E5=85=BC=E5=AE=B9=20(#82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix crash with minihud * minihud-fabric-1.21-0.32.51 * ops * use jitpack * fix * remove extra spaces * replace < with >= in preprocess comment * add minihud conflict in fabric.mod.json --------- Co-authored-by: Fallen_Breath --- common.gradle | 3 ++- .../minihud/RenderHandlerMixin.java | 20 +++++++++++++++++++ src/main/resources/fabric.mod.json | 3 +++ versions/1.21.1/gradle.properties | 7 ++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/common.gradle b/common.gradle index e1cf5d08..ec6f97b6 100644 --- a/common.gradle +++ b/common.gradle @@ -34,7 +34,7 @@ static String curseForgeOrOther(version, curseForge, other) { // list of (dependencyNotation -> should use modImplementation) def mod_dependencies = [ - ["fi.dy.masa.malilib:${project.malilib_version}", true], + [mcVersion == 12101 ? "com.github.sakura-ryoko:malilib:${project.malilib_version}" : "fi.dy.masa.malilib:${project.malilib_version}", true], [curseForgeOrOther(project.tweakeroo_file_id , 'curse.maven:tweakeroo-297344' , 'com.github.sakura-ryoko:tweakeroo' ), true], [curseForgeOrOther(project.itemscroller_file_id, 'curse.maven:item-scroller-242064', 'com.github.sakura-ryoko:itemscroller'), true], [curseForgeOrOther(project.minihud_file_id , 'curse.maven:minihud-244260' , 'com.github.sakura-ryoko:minihud' ), true], @@ -200,6 +200,7 @@ processResources { "version": fullModVersion, "minecraft_dependency": project.minecraft_dependency, "malilib_dependency": project.malilib_dependency, + "minihud_conflict": project.getProperties().getOrDefault("minihud_conflict", "<0.0.0"), ] expand valueMap } diff --git a/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/mod_tweaks/serverDataSyncer/minihud/RenderHandlerMixin.java b/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/mod_tweaks/serverDataSyncer/minihud/RenderHandlerMixin.java index 446c1f1d..e7c0f617 100644 --- a/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/mod_tweaks/serverDataSyncer/minihud/RenderHandlerMixin.java +++ b/src/main/java/me/fallenbreath/tweakermore/mixins/tweaks/mod_tweaks/serverDataSyncer/minihud/RenderHandlerMixin.java @@ -37,6 +37,11 @@ import org.spongepowered.asm.mixin.injection.Slice; //#endif +//#if MC >= 12101 +//$$ import com.llamalad7.mixinextras.lib.apache.commons.tuple.Pair; +//$$ import net.minecraft.nbt.NbtCompound; +//#endif + @Restriction(require = @Condition(ModIds.minihud)) @Mixin(RenderHandler.class) public abstract class RenderHandlerMixin @@ -54,22 +59,37 @@ public abstract class RenderHandlerMixin ), at = @At( value = "INVOKE", + //#if MC >= 12101 + //$$ target = "Lfi/dy/masa/minihud/event/RenderHandler;getTargetedBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/client/MinecraftClient;)Lcom/llamalad7/mixinextras/lib/apache/commons/tuple/Pair;", + //#else target = "Lfi/dy/masa/minihud/event/RenderHandler;getTargetedBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/client/MinecraftClient;)Lnet/minecraft/block/entity/BlockEntity;", + //#endif ordinal = 0, remap = true ), remap = false ) + //#if MC >= 12101 + //$$ private Pair serverDataSyncer4BeehiveBeeCount(Pair original) + //#else private BlockEntity serverDataSyncer4BeehiveBeeCount(BlockEntity blockEntity) + //#endif { if (TweakerMoreConfigs.SERVER_DATA_SYNCER.getBooleanValue()) { + //#if MC >= 12101 + //$$ BlockEntity blockEntity = original.getLeft(); + //#endif if (blockEntity instanceof BeehiveBlockEntity && !MinecraftClient.getInstance().isIntegratedServerRunning()) { ServerDataSyncer.getInstance().syncBlockEntity(blockEntity); } } + //#if MC >= 12101 + //$$ return original; + //#else return blockEntity; + //#endif } //#endif } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c0a59e77..954a70f6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,6 +32,9 @@ "tweakermore.mixins.json" ], + "breaks": { + "minihud": "${minihud_conflict}" + }, "depends": { "fabricloader": ">=0.11.4", "minecraft": "${minecraft_dependency}", diff --git a/versions/1.21.1/gradle.properties b/versions/1.21.1/gradle.properties index f8d79693..26d29b4a 100644 --- a/versions/1.21.1/gradle.properties +++ b/versions/1.21.1/gradle.properties @@ -6,6 +6,7 @@ # Fabric Mod Metadata minecraft_dependency = 1.21.x malilib_dependency = >=0.18.0 + minihud_conflict = <0.32.51 # Build Information # The target mc versions for the mod during mod publishing, separated with \n @@ -16,7 +17,7 @@ # https://masa.dy.fi/maven/fi/dy/masa/malilib/ # https://jitpack.io/#sakura-ryoko/malilib - malilib_version = malilib-fabric-1.21.1:0.21.0 + malilib_version = 1.21-0.21.1 # https://legacy.curseforge.com/minecraft/mc-mods/tweakeroo/files # tweakeroo-fabric-1.21.1-0.21.50.jar @@ -31,8 +32,8 @@ litematica_file_id = 5647809 # https://legacy.curseforge.com/minecraft/mc-mods/minihud/files - # minihud-fabric-1.21.1-0.32.50.jar - minihud_file_id = 5647790 + # minihud-fabric-1.21-0.32.51.jar + minihud_file_id = 1.21-0.32.51 # https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ mod_menu_version = 11.0.1