From 9c5515c56344875090ce13958318e6543c59e19d Mon Sep 17 00:00:00 2001 From: plulsls Date: Sun, 24 Oct 2021 23:46:37 +0800 Subject: [PATCH] fix mod deps --- gradle.properties | 2 +- .../com/plusls/MasaGadget/MasaGadgetMixinPlugin.java | 3 +++ .../java/com/plusls/MasaGadget/config/Configs.java | 11 +++++++++++ .../java/com/plusls/MasaGadget/gui/GuiConfigs.java | 2 +- .../malilib/fastSwitchMasaConfigGui/MasaGuiUtil.java | 5 ++++- .../MixinInputHandler.java | 5 +++-- .../fastSwitchMasaConfigGui/MixinGuiConfigBase.java | 4 ++++ .../MixinRenderUtils.java | 1 - 8 files changed, 27 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 13783d00..c8b5de47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ tweakeroo_version=3383609 # litematica-fabric-1.17.1-0.0.0-dev.20210713.103711.jar litematica_version=3387062 multiconnect_version=1.4.15 -mod_menu_version=2.0.2 +mod_menu_version=2.0.14 # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api fabric_version=0.40.8+1.17 diff --git a/src/main/java/com/plusls/MasaGadget/MasaGadgetMixinPlugin.java b/src/main/java/com/plusls/MasaGadget/MasaGadgetMixinPlugin.java index a7726458..289a83ea 100644 --- a/src/main/java/com/plusls/MasaGadget/MasaGadgetMixinPlugin.java +++ b/src/main/java/com/plusls/MasaGadget/MasaGadgetMixinPlugin.java @@ -36,12 +36,14 @@ public class MasaGadgetMixinPlugin implements IMixinConfigPlugin { public static final String TWEAKEROO_MOD_ID = "tweakeroo"; public static final String MINIHUD_MOD_ID = "minihud"; public static final String LITEMATICA_MOD_ID = "litematica"; + public static final String MODMENU_MOD_ID = "modmenu"; public static final String BBOR_MOD_ID = "bbor"; public static boolean isTweakerooLoaded = false; public static boolean isMinihudLoaded = false; public static boolean isLitematicaLoaded = false; public static boolean isBborLoaded = false; + public static boolean isModmenu = false; private final List obfuscatedMixinList = new ArrayList<>(); static private Path tempDirectory; @@ -69,6 +71,7 @@ public void onLoad(String mixinPackage) { isMinihudLoaded = FabricLoader.getInstance().isModLoaded(MINIHUD_MOD_ID); isLitematicaLoaded = FabricLoader.getInstance().isModLoaded(LITEMATICA_MOD_ID); isBborLoaded = FabricLoader.getInstance().isModLoaded(BBOR_MOD_ID); + isModmenu = FabricLoader.getInstance().isModLoaded(MODMENU_MOD_ID); if (!FabricLoader.getInstance().isDevelopmentEnvironment()) { Object urlLoader = Thread.currentThread().getContextClassLoader(); Class knotClassLoader; diff --git a/src/main/java/com/plusls/MasaGadget/config/Configs.java b/src/main/java/com/plusls/MasaGadget/config/Configs.java index 910131ef..a5d48309 100644 --- a/src/main/java/com/plusls/MasaGadget/config/Configs.java +++ b/src/main/java/com/plusls/MasaGadget/config/Configs.java @@ -106,6 +106,17 @@ public static class Malilib { FIX_GET_INVENTORY_TYPE, OPTIMIZE_CONFIG_WIDGET_SEARCH ); + + public static final List GUI_OPTIONS = new LinkedList<>(OPTIONS); + + static { + GUI_OPTIONS.removeIf(iConfigBase -> { + if (iConfigBase == FAST_SWITCH_MASA_CONFIG_GUI && !MasaGadgetMixinPlugin.isModmenu) { + return true; + } + return false; + }); + } } public static class Minihud { diff --git a/src/main/java/com/plusls/MasaGadget/gui/GuiConfigs.java b/src/main/java/com/plusls/MasaGadget/gui/GuiConfigs.java index 290b8fad..ea98cff2 100644 --- a/src/main/java/com/plusls/MasaGadget/gui/GuiConfigs.java +++ b/src/main/java/com/plusls/MasaGadget/gui/GuiConfigs.java @@ -78,7 +78,7 @@ public List getConfigs() { } else if (tab == ConfigGuiTab.LITEMATICA) { configs = Configs.Litematica.GUI_OPTIONS; } else if (tab == ConfigGuiTab.MALILIB) { - configs = Configs.Malilib.OPTIONS; + configs = Configs.Malilib.GUI_OPTIONS; } else if (tab == ConfigGuiTab.MINIHUD) { configs = Configs.Minihud.GUI_OPTIONS; } else if (tab == ConfigGuiTab.TWEAKEROO) { diff --git a/src/main/java/com/plusls/MasaGadget/malilib/fastSwitchMasaConfigGui/MasaGuiUtil.java b/src/main/java/com/plusls/MasaGadget/malilib/fastSwitchMasaConfigGui/MasaGuiUtil.java index 7a974c6a..4117987d 100644 --- a/src/main/java/com/plusls/MasaGadget/malilib/fastSwitchMasaConfigGui/MasaGuiUtil.java +++ b/src/main/java/com/plusls/MasaGadget/malilib/fastSwitchMasaConfigGui/MasaGuiUtil.java @@ -1,5 +1,6 @@ package com.plusls.MasaGadget.malilib.fastSwitchMasaConfigGui; +import com.plusls.MasaGadget.MasaGadgetMixinPlugin; import com.plusls.MasaGadget.ModInfo; import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; @@ -23,7 +24,9 @@ public static void init() { } public static void initMasaModScreenList(MinecraftClient client) { - + if (!MasaGadgetMixinPlugin.isModmenu) { + return; + } FabricLoader.getInstance().getEntrypointContainers("modmenu", ModMenuApiMarker.class).forEach(entrypoint -> { ModMetadata metadata = entrypoint.getProvider().getMetadata(); try { diff --git a/src/main/java/com/plusls/MasaGadget/mixin/litematica/nudgeSelectionSupportFreeCamera/MixinInputHandler.java b/src/main/java/com/plusls/MasaGadget/mixin/litematica/nudgeSelectionSupportFreeCamera/MixinInputHandler.java index 0690a1bf..c05b7044 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/litematica/nudgeSelectionSupportFreeCamera/MixinInputHandler.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/litematica/nudgeSelectionSupportFreeCamera/MixinInputHandler.java @@ -13,8 +13,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -@Dependencies(dependencyList = @Dependency(modId = MasaGadgetMixinPlugin.LITEMATICA_MOD_ID, version = "<" + LitematicaDependencyUtil.NUDGE_SELECTION_SUPPORT_FREECAMERA_BREAK_VERSION, - predicate = LitematicaDependencyUtil.TweakerooPredicate.class)) +@Dependencies(dependencyList = {@Dependency(modId = MasaGadgetMixinPlugin.LITEMATICA_MOD_ID, version = "<" + LitematicaDependencyUtil.NUDGE_SELECTION_SUPPORT_FREECAMERA_BREAK_VERSION, + predicate = LitematicaDependencyUtil.TweakerooPredicate.class), + @Dependency(modId = MasaGadgetMixinPlugin.TWEAKEROO_MOD_ID, version = "*")}) @Mixin(value = InputHandler.class, remap = false) public class MixinInputHandler { @ModifyVariable(method = "nudgeSelection", at = @At(value = "HEAD"), ordinal = 0) diff --git a/src/main/java/com/plusls/MasaGadget/mixin/malilib/fastSwitchMasaConfigGui/MixinGuiConfigBase.java b/src/main/java/com/plusls/MasaGadget/mixin/malilib/fastSwitchMasaConfigGui/MixinGuiConfigBase.java index 74db77ab..cdc31029 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/malilib/fastSwitchMasaConfigGui/MixinGuiConfigBase.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/malilib/fastSwitchMasaConfigGui/MixinGuiConfigBase.java @@ -1,8 +1,11 @@ package com.plusls.MasaGadget.mixin.malilib.fastSwitchMasaConfigGui; +import com.plusls.MasaGadget.MasaGadgetMixinPlugin; import com.plusls.MasaGadget.config.Configs; import com.plusls.MasaGadget.gui.MyWidgetDropDownList; import com.plusls.MasaGadget.malilib.fastSwitchMasaConfigGui.MasaGuiUtil; +import com.plusls.MasaGadget.mixin.Dependencies; +import com.plusls.MasaGadget.mixin.Dependency; import com.terraformersmc.modmenu.api.ConfigScreenFactory; import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.gui.GuiConfigsBase; @@ -19,6 +22,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +@Dependencies(dependencyList = @Dependency(modId = MasaGadgetMixinPlugin.MODMENU_MOD_ID, version = "*")) @Mixin(value = GuiConfigsBase.class, remap = false) public abstract class MixinGuiConfigBase extends GuiListBase implements IKeybindConfigGui { diff --git a/src/main/java/com/plusls/MasaGadget/mixin/tweakeroo/inventoryPreviewSupportShulkerBoxItemEntity/MixinRenderUtils.java b/src/main/java/com/plusls/MasaGadget/mixin/tweakeroo/inventoryPreviewSupportShulkerBoxItemEntity/MixinRenderUtils.java index 315ce251..95baca94 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/tweakeroo/inventoryPreviewSupportShulkerBoxItemEntity/MixinRenderUtils.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/tweakeroo/inventoryPreviewSupportShulkerBoxItemEntity/MixinRenderUtils.java @@ -6,7 +6,6 @@ import com.plusls.MasaGadget.mixin.Dependency; import fi.dy.masa.tweakeroo.renderer.RenderUtils; import net.minecraft.block.ShulkerBoxBlock; -import net.minecraft.block.entity.ShulkerBoxBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity;