From bbe271e8b28bf29ed50b560181a6fa67d1299ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AB=E3=82=83=E3=82=93=E3=81=A1=E3=82=83=E3=82=93?= Date: Sun, 5 Jan 2025 10:19:58 +0800 Subject: [PATCH] Fix mixin with latest tweakeroo (#150) Signed-off-by: Hendrix-Shen --- .../java/com/plusls/MasaGadget/game/Configs.java | 7 +++++-- .../MixinRenderUtils.java | 16 ++++++++++++---- .../MixinRenderUtils.java | 16 ++++++++++++---- .../MixinMixinRenderUtils.java | 5 ++++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/plusls/MasaGadget/game/Configs.java b/src/main/java/com/plusls/MasaGadget/game/Configs.java index 6d32408..9dfd855 100644 --- a/src/main/java/com/plusls/MasaGadget/game/Configs.java +++ b/src/main/java/com/plusls/MasaGadget/game/Configs.java @@ -273,13 +273,16 @@ public class Configs { @Config(category = ConfigCategory.TWEAKEROO) public static MagicConfigBoolean inventoryPreviewSyncDataClientOnly = Configs.cf.newConfigBoolean("inventoryPreviewSyncDataClientOnly", false); - @Dependencies(require = @Dependency(ModId.tweakeroo)) + @Dependencies( + require = @Dependency(ModId.tweakeroo), + conflict = @Dependency(value = ModId.minecraft, versionPredicates = ">=1.21-") + ) @Config(category = ConfigCategory.TWEAKEROO) public static MagicConfigBoolean inventoryPreviewUseCache = Configs.cf.newConfigBoolean("inventoryPreviewUseCache", false); @Dependencies(require = { @Dependency(ModId.tweakeroo), - @Dependency(ModId.tweakeroo) + @Dependency(ModId.itemscroller) }) @Config(category = ConfigCategory.TWEAKEROO) public static MagicConfigBoolean restockWithCrafting = Configs.cf.newConfigBoolean("restockWithCrafting", false); diff --git a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportPlayer/MixinRenderUtils.java b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportPlayer/MixinRenderUtils.java index b1c0bab..1896bff 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportPlayer/MixinRenderUtils.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportPlayer/MixinRenderUtils.java @@ -30,11 +30,19 @@ public abstract class MixinRenderUtils { //#if MC > 11904 //$$ @Unique - //$$ private static GuiGraphics masa_gadget$gui; + //$$ private static GuiGraphics masa_gadget$guiGraphics; //$$ //$$ @Inject(method = "renderInventoryOverlay", at = @At("HEAD")) - //$$ private static void intercept(Minecraft mc, GuiGraphics gui, CallbackInfo ci) { - //$$ MixinRenderUtils.masa_gadget$gui = gui; + //$$ private static void intercept( + //#if MC > 12006 + //$$ InventoryOverlay.Context context, + //#else + //$$ Minecraft mc, + //#endif + //$$ GuiGraphics guiGraphics, + //$$ CallbackInfo ci + //$$ ) { + //$$ MixinRenderUtils.masa_gadget$guiGraphics = guiGraphics; //$$ } //#endif @@ -78,7 +86,7 @@ private static Container modifyInv(Container inv) { 27, Minecraft.getInstance() //#if MC > 11904 - //$$ , masa_gadget$gui + //$$ , masa_gadget$guiGraphics //#endif ); fi.dy.masa.malilib.render.RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinRenderUtils.java b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinRenderUtils.java index 5119d87..5504a69 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinRenderUtils.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinRenderUtils.java @@ -34,11 +34,19 @@ public class MixinRenderUtils { //#if MC > 11904 //$$ @Unique - //$$ private static GuiGraphics masa_gadget_mod$gui; + //$$ private static GuiGraphics masa_gadget$guiGraphics; //$$ //$$ @Inject(method = "renderInventoryOverlay", at = @At("HEAD")) - //$$ private static void intercept(Minecraft mc, GuiGraphics gui, CallbackInfo ci) { - //$$ MixinRenderUtils.masa_gadget_mod$gui = gui; + //$$ private static void intercept( + //#if MC > 12006 + //$$ InventoryOverlay.Context context, + //#else + //$$ Minecraft mc, + //#endif + //$$ GuiGraphics guiGraphics, + //$$ CallbackInfo ci + //$$ ) { + //$$ MixinRenderUtils.masa_gadget$guiGraphics = guiGraphics; //$$ } //#endif @@ -110,7 +118,7 @@ private static Container renderTradeOfferList(Container inv) { MixinRenderUtils.masa_gadget$maxTradeOfferSize, Minecraft.getInstance() //#if MC > 11904 - //$$ , masa_gadget_mod$gui + //$$ , masa_gadget$guiGraphics //#endif ); fi.dy.masa.malilib.render.RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewUseCache/MixinMixinRenderUtils.java b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewUseCache/MixinMixinRenderUtils.java index 533b156..43d7b04 100644 --- a/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewUseCache/MixinMixinRenderUtils.java +++ b/src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/tweakeroo/inventoryPreviewUseCache/MixinMixinRenderUtils.java @@ -20,7 +20,10 @@ import top.hendrixshen.magiclib.api.dependency.annotation.Dependencies; import top.hendrixshen.magiclib.api.dependency.annotation.Dependency; -@Dependencies(require = @Dependency(ModId.tweakeroo)) +@Dependencies( + require = @Dependency(ModId.tweakeroo), + conflict = @Dependency(value = ModId.minecraft, versionPredicates = ">=1.21-") +) @Mixin(value = RenderUtils.class, remap = false) public class MixinMixinRenderUtils { @Redirect(