diff --git a/build.gradle b/build.gradle index bc6d75ba..03e3c0e7 100644 --- a/build.gradle +++ b/build.gradle @@ -184,6 +184,7 @@ dependencies { compileOnly 'curse.maven:mrtjpcore-229002:2735197' compileOnly 'curse.maven:netherchest-268888:2655413' compileOnly 'curse.maven:netherrocks-226140:2628297' + compileOnly 'curse.maven:patchouli-306770:3162874' compileOnly 'curse.maven:plustic-376903:4703532' compileOnly 'curse.maven:projectredbase-228702:2745545' compileOnly 'curse.maven:projectredworld-229049:2745551' diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookCraftMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookCraftMixin.java index 4b5f5f56..fbe89b39 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookCraftMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookCraftMixin.java @@ -3,13 +3,16 @@ import net.minecraft.client.gui.GuiButtonImage; import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Loader; import mod.acgaming.universaltweaks.UniversalTweaks; import mod.acgaming.universaltweaks.config.UTConfigGeneral; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import vazkii.patchouli.common.base.PatchouliConfig; @Mixin(GuiCrafting.class) public class UTRecipeBookCraftMixin @@ -20,6 +23,11 @@ public class UTRecipeBookCraftMixin @Redirect(method = "initGui", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/inventory/GuiCrafting;recipeButton:Lnet/minecraft/client/gui/GuiButtonImage;", ordinal = 0)) public void utHideRecipeBook(GuiCrafting instance, GuiButtonImage value) { + if (!UTConfigTweaks.MISC.utRecipeBookToggle || (Loader.isModLoaded("patchouli") && !PatchouliConfig.inventoryButtonBook.isEmpty())) + { + this.recipeButton = value; + return; + } if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTRecipeBookCraft ::: Initialize GUI"); this.recipeButton = new GuiButtonImage(10, 0, 0, 0, 0, 0, 0, 0, new ResourceLocation("textures/gui/container/crafting_table.png")); } diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookGUIMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookGUIMixin.java index 529c37ff..c008b84a 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookGUIMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookGUIMixin.java @@ -3,6 +3,8 @@ import net.minecraft.client.gui.recipebook.GuiRecipeBook; import net.minecraft.inventory.InventoryCrafting; +import net.minecraftforge.fml.common.Loader; + import mod.acgaming.universaltweaks.UniversalTweaks; import mod.acgaming.universaltweaks.config.UTConfigGeneral; import mod.acgaming.universaltweaks.config.UTConfigTweaks; @@ -11,6 +13,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import vazkii.patchouli.common.base.PatchouliConfig; @Mixin(GuiRecipeBook.class) public abstract class UTRecipeBookGUIMixin @@ -18,7 +21,7 @@ public abstract class UTRecipeBookGUIMixin @Inject(method = "initVisuals", at = @At(value = "TAIL")) public void utHideRecipeBook(boolean p_193014_1_, InventoryCrafting p_193014_2_, CallbackInfo ci) { - if (!UTConfigTweaks.MISC.utRecipeBookToggle) return; + if (!UTConfigTweaks.MISC.utRecipeBookToggle || (Loader.isModLoaded("patchouli") && !PatchouliConfig.inventoryButtonBook.isEmpty())) return; if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTRecipeBookGUI ::: Initialize visuals"); setVisible(false); } diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookInvMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookInvMixin.java index 86e60de7..a34aeb60 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookInvMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/recipebook/mixin/UTRecipeBookInvMixin.java @@ -3,13 +3,16 @@ import net.minecraft.client.gui.GuiButtonImage; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Loader; import mod.acgaming.universaltweaks.UniversalTweaks; import mod.acgaming.universaltweaks.config.UTConfigGeneral; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import vazkii.patchouli.common.base.PatchouliConfig; @Mixin(GuiInventory.class) public class UTRecipeBookInvMixin @@ -20,6 +23,11 @@ public class UTRecipeBookInvMixin @Redirect(method = "initGui", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/inventory/GuiInventory;recipeButton:Lnet/minecraft/client/gui/GuiButtonImage;", ordinal = 0)) public void utHideRecipeBook(GuiInventory instance, GuiButtonImage value) { + if (!UTConfigTweaks.MISC.utRecipeBookToggle || (Loader.isModLoaded("patchouli") && !PatchouliConfig.inventoryButtonBook.isEmpty())) + { + this.recipeButton = value; + return; + } if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTRecipeBookInv ::: Initialize GUI"); this.recipeButton = new GuiButtonImage(10, 0, 0, 0, 0, 0, 0, 0, new ResourceLocation("textures/gui/container/inventory.png")); }