Legacy & New JEI capability

This commit is contained in:
Dragon2488 2016-10-01 11:20:56 +07:00
parent 6bacb14144
commit d88748aa93
3 changed files with 26 additions and 5 deletions

View file

@ -7,6 +7,7 @@ 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.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@ -15,9 +16,7 @@ import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.*;
public class JEIGregtechRecipe implements IRecipeWrapper {
@ -606,12 +605,21 @@ public class JEIGregtechRecipe implements IRecipeWrapper {
}
@Override
public List getInputs() {
public void getIngredients(IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, getInputs());
ingredients.setInputs(FluidStack.class, getFluidInputs());
ingredients.setOutputs(ItemStack.class, getOutputs());
ingredients.setOutputs(FluidStack.class, getFluidOutputs());
}
@Override
public List<ItemStack> getInputs() {
return Arrays.asList(mRecipe.mInputs);
}
@Override
public List getOutputs() {
public List<ItemStack> getOutputs() {
return Arrays.asList(mRecipe.mOutputs);
}

View file

@ -5,6 +5,7 @@ import gregtech.api.util.GT_Recipe;
import mezz.jei.Internal;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.gui.DrawableResource;
import net.minecraft.client.Minecraft;
@ -62,4 +63,9 @@ public class JEIGregtehRecipeCategory implements IRecipeCategory<JEIGregtechReci
recipeWrapper.init(recipeLayout);
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, JEIGregtechRecipe recipeWrapper, IIngredients ingredients) {
recipeWrapper.init(recipeLayout);
}
}

View file

@ -2,6 +2,7 @@ package gregtech.jei;
import gregtech.api.util.GT_Recipe;
import mezz.jei.api.*;
import mezz.jei.api.ingredients.IModIngredientRegistration;
import javax.annotation.Nonnull;
import java.util.stream.Collectors;
@ -11,6 +12,12 @@ public class JEI_GT_Plugin implements IModPlugin {
private static IJeiHelpers jeiHelpers;
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {}
@Override
public void registerIngredients(IModIngredientRegistration registry) {}
@Override
public void register(@Nonnull IModRegistry registry) {
jeiHelpers = registry.getJeiHelpers();