JEI recipes overlapping fix.
This commit is contained in:
parent
d94f16ea07
commit
82dab9d1bd
4 changed files with 45 additions and 9 deletions
28
src/main/java/gregtech/jei/JEICompat.java
Normal file
28
src/main/java/gregtech/jei/JEICompat.java
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package gregtech.jei;
|
package gregtech.jei;
|
||||||
|
|
||||||
import gregtech.api.util.GT_LanguageManager;
|
|
||||||
import gregtech.api.util.GT_Recipe;
|
import gregtech.api.util.GT_Recipe;
|
||||||
import gregtech.api.util.GT_Utility;
|
import gregtech.api.util.GT_Utility;
|
||||||
import mezz.jei.Internal;
|
import mezz.jei.Internal;
|
||||||
|
@ -8,7 +7,6 @@ import mezz.jei.api.IGuiHelper;
|
||||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.gui.ITooltipCallback;
|
|
||||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import mezz.jei.Internal;
|
||||||
import mezz.jei.api.gui.IDrawable;
|
import mezz.jei.api.gui.IDrawable;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
import mezz.jei.api.recipe.IRecipeCategory;
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
|
import mezz.jei.gui.DrawableResource;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
@ -39,9 +40,15 @@ public class JEIGregtehRecipeCategory implements IRecipeCategory<JEIGregtechReci
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IDrawable getBackground() {
|
public IDrawable getBackground() {
|
||||||
return Internal.getHelpers().getGuiHelper().createDrawable(
|
return new DrawableResource(new ResourceLocation(mRecipeMap.mNEIGUIPath),
|
||||||
new ResourceLocation(mRecipeMap.mNEIGUIPath),
|
1, 3, 174, 78, -7, 0, -0, 0) {
|
||||||
1, 3, 174, 78, -7, 0, -0, 0);
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return super.getHeight() + 50;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package gregtech.jei;
|
package gregtech.jei;
|
||||||
|
|
||||||
import gregtech.api.util.GT_Recipe;
|
import gregtech.api.util.GT_Recipe;
|
||||||
import mezz.jei.api.IJeiRuntime;
|
import mezz.jei.api.*;
|
||||||
import mezz.jei.api.IModPlugin;
|
|
||||||
import mezz.jei.api.IModRegistry;
|
|
||||||
import mezz.jei.api.JEIPlugin;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -12,8 +9,11 @@ import java.util.stream.Collectors;
|
||||||
@JEIPlugin
|
@JEIPlugin
|
||||||
public class JEI_GT_Plugin implements IModPlugin {
|
public class JEI_GT_Plugin implements IModPlugin {
|
||||||
|
|
||||||
|
private static IJeiHelpers jeiHelpers;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(@Nonnull IModRegistry registry) {
|
public void register(@Nonnull IModRegistry registry) {
|
||||||
|
jeiHelpers = registry.getJeiHelpers();
|
||||||
registry.addRecipeHandlers(new JEIGregtechRecipeHandler());
|
registry.addRecipeHandlers(new JEIGregtechRecipeHandler());
|
||||||
for(GT_Recipe.GT_Recipe_Map recipe_map : GT_Recipe.GT_Recipe_Map.sMappings) {
|
for(GT_Recipe.GT_Recipe_Map recipe_map : GT_Recipe.GT_Recipe_Map.sMappings) {
|
||||||
if(recipe_map.mNEIAllowed) {
|
if(recipe_map.mNEIAllowed) {
|
||||||
|
@ -28,4 +28,7 @@ public class JEI_GT_Plugin implements IModPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) {}
|
public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) {}
|
||||||
|
|
||||||
|
public static IJeiHelpers getJeiHelpers() {
|
||||||
|
return jeiHelpers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue