From 82dab9d1bde633fd70f87868e861b13234c78ce2 Mon Sep 17 00:00:00 2001 From: Dragon2488 Date: Sun, 18 Sep 2016 13:04:39 +0700 Subject: [PATCH] JEI recipes overlapping fix. --- src/main/java/gregtech/jei/JEICompat.java | 28 +++++++++++++++++++ .../java/gregtech/jei/JEIGregtechRecipe.java | 2 -- .../jei/JEIGregtehRecipeCategory.java | 13 +++++++-- src/main/java/gregtech/jei/JEI_GT_Plugin.java | 11 +++++--- 4 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 src/main/java/gregtech/jei/JEICompat.java diff --git a/src/main/java/gregtech/jei/JEICompat.java b/src/main/java/gregtech/jei/JEICompat.java new file mode 100644 index 00000000..54dbc7db --- /dev/null +++ b/src/main/java/gregtech/jei/JEICompat.java @@ -0,0 +1,28 @@ +package gregtech.jei; + +import mezz.jei.api.IJeiHelpers; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.Loader; + +public class JEICompat { + + + public static void hideItem(ItemStack stack) { + if(Loader.isModLoaded("JustEnoughItems")) { + try { + hideItemUnsafe(stack); + } catch (Exception exception) { + System.out.println("Can't blacklist " + stack + " in JEI!"); + exception.printStackTrace(); + } + } + } + + public static void hideItemUnsafe(ItemStack stack) { + IJeiHelpers helpers = JEI_GT_Plugin.getJeiHelpers(); + if(helpers != null) { + helpers.getItemBlacklist().addItemToBlacklist(stack); + } + } + +} diff --git a/src/main/java/gregtech/jei/JEIGregtechRecipe.java b/src/main/java/gregtech/jei/JEIGregtechRecipe.java index 42f58e8a..e8d6aba8 100644 --- a/src/main/java/gregtech/jei/JEIGregtechRecipe.java +++ b/src/main/java/gregtech/jei/JEIGregtechRecipe.java @@ -1,6 +1,5 @@ package gregtech.jei; -import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import mezz.jei.Internal; @@ -8,7 +7,6 @@ import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.ITooltipCallback; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/jei/JEIGregtehRecipeCategory.java b/src/main/java/gregtech/jei/JEIGregtehRecipeCategory.java index 635297e8..5abdd95f 100644 --- a/src/main/java/gregtech/jei/JEIGregtehRecipeCategory.java +++ b/src/main/java/gregtech/jei/JEIGregtehRecipeCategory.java @@ -6,6 +6,7 @@ import mezz.jei.Internal; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.gui.DrawableResource; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -39,9 +40,15 @@ public class JEIGregtehRecipeCategory implements IRecipeCategory