update to JEI 3.11 (#757)

This commit is contained in:
way2muchnoise 2016-09-27 18:03:57 +02:00 committed by Modmuss50
parent 9310ffadc8
commit fb6feac92f
20 changed files with 330 additions and 107 deletions

View file

@ -8,6 +8,7 @@ import java.util.Set;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -66,6 +67,13 @@ public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecip
return new ArrayList<>(itemStackSet); return new ArrayList<>(itemStackSet);
} }
@Override
public void getIngredients(@Nonnull IIngredients ingredients)
{
ingredients.setInputLists(ItemStack.class, inputs);
ingredients.setOutputs(ItemStack.class, baseRecipe.getOutputs());
}
@Nonnull @Nonnull
@Override @Override
public List<List<ItemStack>> getInputs() public List<List<ItemStack>> getInputs()

View file

@ -10,6 +10,7 @@ import javax.annotation.Nullable;
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.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -59,6 +60,7 @@ public class RecipeUtil
fontRendererObj.drawString(processingTimeString2, x + 10, y, color); fontRendererObj.drawString(processingTimeString2, x + 10, y, color);
} }
@Deprecated
public static void setRecipeItems(@Nonnull IRecipeLayout recipeLayout, @Nonnull BaseRecipeWrapper<?> recipe, public static void setRecipeItems(@Nonnull IRecipeLayout recipeLayout, @Nonnull BaseRecipeWrapper<?> recipe,
@Nullable int[] itemInputSlots, @Nullable int[] itemOutputSlots, @Nullable int[] fluidInputSlots, @Nullable int[] itemInputSlots, @Nullable int[] itemOutputSlots, @Nullable int[] fluidInputSlots,
@Nullable int[] fluidOutputSlots) @Nullable int[] fluidOutputSlots)
@ -106,4 +108,52 @@ public class RecipeUtil
} }
} }
} }
public static void setRecipeItems(@Nonnull IRecipeLayout recipeLayout, @Nonnull IIngredients ingredients,
@Nullable int[] itemInputSlots, @Nullable int[] itemOutputSlots, @Nullable int[] fluidInputSlots,
@Nullable int[] fluidOutputSlots)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
if (itemInputSlots != null)
{
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
for (int i = 0; i < inputs.size() && i < itemInputSlots.length; i++)
{
int inputSlot = itemInputSlots[i];
guiItemStacks.set(inputSlot, inputs.get(i));
}
}
if (itemOutputSlots != null)
{
List<ItemStack> outputs = ingredients.getOutputs(ItemStack.class);
for (int i = 0; i < outputs.size() && i < itemOutputSlots.length; i++)
{
int outputSlot = itemOutputSlots[i];
guiItemStacks.set(outputSlot, outputs.get(i));
}
}
if (fluidInputSlots != null)
{
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
for (int i = 0; i < fluidInputs.size() && i < fluidInputSlots.length; i++)
{
int inputTank = fluidInputSlots[i];
guiFluidStacks.set(inputTank, fluidInputs.get(i));
}
}
if (fluidOutputSlots != null)
{
List<FluidStack> fluidOutputs = ingredients.getOutputs(FluidStack.class);
for (int i = 0; i < fluidOutputs.size() && i < fluidOutputSlots.length; i++)
{
int outputTank = fluidOutputSlots[i];
guiFluidStacks.set(outputTank, fluidOutputs.get(i));
}
}
}
} }

View file

@ -8,6 +8,7 @@ import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.gui.IDrawableStatic;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -16,7 +17,7 @@ import techreborn.client.gui.GuiAlloySmelter;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class AlloySmelterRecipeCategory extends BlankRecipeCategory public class AlloySmelterRecipeCategory extends BlankRecipeCategory<AlloySmelterRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 }; private static final int[] OUTPUT_SLOTS = { 2 };
@ -62,17 +63,24 @@ public class AlloySmelterRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AlloySmelterRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0); guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18); guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
if (recipeWrapper instanceof AlloySmelterRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
AlloySmelterRecipeWrapper recipe = (AlloySmelterRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AlloySmelterRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -8,6 +8,7 @@ import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.gui.IDrawableStatic;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -16,7 +17,7 @@ import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class AssemblingMachineRecipeCategory extends BlankRecipeCategory public class AssemblingMachineRecipeCategory extends BlankRecipeCategory<AssemblingMachineRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 }; private static final int[] OUTPUT_SLOTS = { 2 };
@ -62,17 +63,24 @@ public class AssemblingMachineRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AssemblingMachineRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0); guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18); guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
if (recipeWrapper instanceof AssemblingMachineRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
AssemblingMachineRecipeWrapper recipe = (AssemblingMachineRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AssemblingMachineRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiBlastFurnace;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class BlastFurnaceRecipeCategory extends BlankRecipeCategory public class BlastFurnaceRecipeCategory extends BlankRecipeCategory<BlastFurnaceRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3 }; private static final int[] OUTPUT_SLOTS = { 2, 3 };
@ -49,7 +50,7 @@ public class BlastFurnaceRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BlastFurnaceRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
@ -57,10 +58,18 @@ public class BlastFurnaceRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 10); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 10);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 78, 10); guiItemStacks.init(OUTPUT_SLOTS[1], false, 78, 10);
if (recipeWrapper instanceof BlastFurnaceRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
BlastFurnaceRecipeWrapper recipe = (BlastFurnaceRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BlastFurnaceRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 18);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 10);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 78, 10);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiCentrifuge;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class CentrifugeRecipeCategory extends BlankRecipeCategory public class CentrifugeRecipeCategory extends BlankRecipeCategory<CentrifugeRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 }; private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
@ -49,7 +50,7 @@ public class CentrifugeRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CentrifugeRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 30); guiItemStacks.init(INPUT_SLOTS[0], true, 30, 30);
@ -60,10 +61,21 @@ public class CentrifugeRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[2], false, 30, 60); guiItemStacks.init(OUTPUT_SLOTS[2], false, 30, 60);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 0, 30); guiItemStacks.init(OUTPUT_SLOTS[3], false, 0, 30);
if (recipeWrapper instanceof CentrifugeRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
CentrifugeRecipeWrapper recipe = (CentrifugeRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CentrifugeRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 30);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 30, 0);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 60, 30);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 30, 60);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 0, 30);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiChemicalReactor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class ChemicalReactorRecipeCategory extends BlankRecipeCategory public class ChemicalReactorRecipeCategory extends BlankRecipeCategory<ChemicalReactorRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 }; private static final int[] OUTPUT_SLOTS = { 2 };
@ -49,7 +50,7 @@ public class ChemicalReactorRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ChemicalReactorRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
@ -57,10 +58,18 @@ public class ChemicalReactorRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[0], false, 10, 30); guiItemStacks.init(OUTPUT_SLOTS[0], false, 10, 30);
if (recipeWrapper instanceof ChemicalReactorRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
ChemicalReactorRecipeWrapper recipe = (ChemicalReactorRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ChemicalReactorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 20, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 10, 30);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiCompressor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class CompressorRecipeCategory extends BlankRecipeCategory public class CompressorRecipeCategory extends BlankRecipeCategory<CompressorRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0 }; private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 }; private static final int[] OUTPUT_SLOTS = { 1 };
@ -49,17 +50,24 @@ public class CompressorRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CompressorRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
if (recipeWrapper instanceof CompressorRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
CompressorRecipeWrapper recipe = (CompressorRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CompressorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiExtractor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class ExtractorRecipeCategory extends BlankRecipeCategory public class ExtractorRecipeCategory extends BlankRecipeCategory<ExtractorRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0 }; private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 }; private static final int[] OUTPUT_SLOTS = { 1 };
@ -49,17 +50,24 @@ public class ExtractorRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ExtractorRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
if (recipeWrapper instanceof ExtractorRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
ExtractorRecipeWrapper recipe = (ExtractorRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ExtractorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,13 +6,15 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiFusionReactor; import techreborn.client.gui.GuiFusionReactor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
public class FusionReactorRecipeCategory extends BlankRecipeCategory public class FusionReactorRecipeCategory extends BlankRecipeCategory<FusionReactorRecipeWrapper>
{ {
private static final int inputSlotTop = 0; private static final int inputSlotTop = 0;
@ -52,20 +54,29 @@ public class FusionReactorRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FusionReactorRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(inputSlotTop, true, 21, 0); itemStacks.init(inputSlotTop, true, 21, 0);
itemStacks.init(inputSlotBottom, true, 21, 36); itemStacks.init(inputSlotBottom, true, 21, 36);
itemStacks.init(outputSlot, false, 81, 18); itemStacks.init(outputSlot, false, 81, 18);
if (recipeWrapper instanceof FusionReactorRecipeWrapper) itemStacks.set(inputSlotTop, recipeWrapper.getTopInput());
{ itemStacks.set(inputSlotBottom, recipeWrapper.getBottomInput());
FusionReactorRecipeWrapper fusionRecipe = (FusionReactorRecipeWrapper) recipeWrapper; itemStacks.set(outputSlot, recipeWrapper.getOutputs());
itemStacks.set(inputSlotTop, fusionRecipe.getTopInput()); }
itemStacks.set(inputSlotBottom, fusionRecipe.getBottomInput());
itemStacks.set(outputSlot, fusionRecipe.getOutputs()); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FusionReactorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(inputSlotTop, true, 21, 0);
itemStacks.init(inputSlotBottom, true, 21, 36);
itemStacks.init(outputSlot, false, 81, 18);
itemStacks.set(inputSlotTop, recipeWrapper.getTopInput());
itemStacks.set(inputSlotBottom, recipeWrapper.getBottomInput());
itemStacks.set(outputSlot, ingredients.getOutputs(ItemStack.class));
} }
} }

View file

@ -6,6 +6,7 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -21,6 +22,13 @@ public class FusionReactorRecipeWrapper extends BlankRecipeWrapper
this.baseRecipe = baseRecipe; this.baseRecipe = baseRecipe;
} }
@Override
public void getIngredients(@Nonnull IIngredients ingredients)
{
ingredients.setOutputs(ItemStack.class, Arrays.asList(baseRecipe.getTopInput(), baseRecipe.getBottomInput()));
ingredients.setInput(ItemStack.class, baseRecipe.getOutput());
}
@Override @Override
@Nonnull @Nonnull
public List<ItemStack> getInputs() public List<ItemStack> getInputs()

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiGrinder;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class GrinderRecipeCategory extends BlankRecipeCategory public class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0 }; private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 }; private static final int[] OUTPUT_SLOTS = { 1 };
@ -49,17 +50,24 @@ public class GrinderRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull GrinderRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
if (recipeWrapper instanceof GrinderRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
GrinderRecipeWrapper recipe = (GrinderRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull GrinderRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -8,6 +8,7 @@ import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.gui.IDrawableStatic;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -16,7 +17,7 @@ import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<ImplosionCompressorRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3 }; private static final int[] OUTPUT_SLOTS = { 2, 3 };
@ -62,7 +63,7 @@ public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ImplosionCompressorRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 20, 0); guiItemStacks.init(INPUT_SLOTS[0], true, 20, 0);
@ -71,10 +72,19 @@ public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[0], false, 76, 9); guiItemStacks.init(OUTPUT_SLOTS[0], false, 76, 9);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 9); guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 9);
if (recipeWrapper instanceof ImplosionCompressorRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
ImplosionCompressorRecipeWrapper recipe = (ImplosionCompressorRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ImplosionCompressorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 20, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 20, 18);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 76, 9);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 9);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiIndustrialElectrolyzer;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class IndustrialElectrolyzerRecipeCategory extends BlankRecipeCategory public class IndustrialElectrolyzerRecipeCategory extends BlankRecipeCategory<IndustrialElectrolyzerRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 }; private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
@ -49,7 +50,7 @@ public class IndustrialElectrolyzerRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IndustrialElectrolyzerRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 32); guiItemStacks.init(INPUT_SLOTS[0], true, 30, 32);
@ -59,10 +60,20 @@ public class IndustrialElectrolyzerRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[2], false, 40, 0); guiItemStacks.init(OUTPUT_SLOTS[2], false, 40, 0);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 60, 0); guiItemStacks.init(OUTPUT_SLOTS[3], false, 60, 0);
if (recipeWrapper instanceof IndustrialElectrolyzerRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
IndustrialElectrolyzerRecipeWrapper recipe = (IndustrialElectrolyzerRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IndustrialElectrolyzerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 32);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 32);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 0, 0);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 20, 0);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 40, 0);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 60, 0);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -7,6 +7,7 @@ import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -16,7 +17,7 @@ import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
import techreborn.tiles.multiblock.TileIndustrialGrinder; import techreborn.tiles.multiblock.TileIndustrialGrinder;
public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory<IndustrialGrinderRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 }; private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
@ -64,7 +65,7 @@ public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IndustrialGrinderRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 24, 10); guiItemStacks.init(INPUT_SLOTS[0], true, 24, 10);
@ -78,10 +79,24 @@ public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
guiFluidStacks.init(INPUT_TANKS[0], true, 4, 4, 12, 47, TileIndustrialGrinder.TANK_CAPACITY, true, tankOverlay); guiFluidStacks.init(INPUT_TANKS[0], true, 4, 4, 12, 47, TileIndustrialGrinder.TANK_CAPACITY, true, tankOverlay);
if (recipeWrapper instanceof IndustrialGrinderRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null);
{ }
IndustrialGrinderRecipeWrapper recipe = (IndustrialGrinderRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IndustrialGrinderRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 24, 10);
guiItemStacks.init(INPUT_SLOTS[1], true, 24, 28);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 19);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 87, 19);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 105, 19);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 123, 19);
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
guiFluidStacks.init(INPUT_TANKS[0], true, 4, 4, 12, 47, TileIndustrialGrinder.TANK_CAPACITY, true, tankOverlay);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null);
} }
} }

View file

@ -9,14 +9,16 @@ import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.gui.IDrawableStatic;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
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.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiRollingMachine; import techreborn.client.gui.GuiRollingMachine;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
public class RollingMachineRecipeCategory extends BlankRecipeCategory public class RollingMachineRecipeCategory extends BlankRecipeCategory<RollingMachineRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; private static final int[] INPUT_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private static final int[] OUTPUT_SLOTS = { 10 }; private static final int[] OUTPUT_SLOTS = { 10 };
@ -65,7 +67,7 @@ public class RollingMachineRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RollingMachineRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
for (int l = 0; l < 3; l++) for (int l = 0; l < 3; l++)
@ -79,11 +81,26 @@ public class RollingMachineRecipeCategory extends BlankRecipeCategory
guiItemStacks.init(OUTPUT_SLOTS[0], false, 94, 18); guiItemStacks.init(OUTPUT_SLOTS[0], false, 94, 18);
if (recipeWrapper instanceof RollingMachineRecipeWrapper) craftingGridHelper.setInput(guiItemStacks, recipeWrapper.getInputs());
craftingGridHelper.setOutput(guiItemStacks, recipeWrapper.getOutputs());
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RollingMachineRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
for (int l = 0; l < 3; l++)
{ {
RollingMachineRecipeWrapper recipe = (RollingMachineRecipeWrapper) recipeWrapper; for (int k1 = 0; k1 < 3; k1++)
craftingGridHelper.setInput(guiItemStacks, recipe.getInputs()); {
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); int i = k1 + l * 3;
guiItemStacks.init(INPUT_SLOTS[i], true, k1 * 18, l * 18);
}
} }
guiItemStacks.init(OUTPUT_SLOTS[0], false, 94, 18);
craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class));
craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class));
} }
} }

View file

@ -7,6 +7,7 @@ import javax.annotation.Nullable;
import mezz.jei.api.IGuiHelper; import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers; import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapedOreRecipeWrapper; import mezz.jei.plugins.vanilla.crafting.ShapedOreRecipeWrapper;
@ -57,6 +58,12 @@ public class RollingMachineRecipeWrapper extends BlankRecipeWrapper implements I
return new RollingMachineRecipeWrapper(recipeWrapper); return new RollingMachineRecipeWrapper(recipeWrapper);
} }
@Override
public void getIngredients(@Nonnull IIngredients ingredients)
{
baseRecipe.getIngredients(ingredients);
}
@Override @Override
@Nonnull @Nonnull
public List getInputs() public List getInputs()

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiCompressor;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class ScrapboxRecipeCategory extends BlankRecipeCategory public class ScrapboxRecipeCategory extends BlankRecipeCategory<ScrapboxRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0 }; private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 }; private static final int[] OUTPUT_SLOTS = { 1 };
@ -49,17 +50,24 @@ public class ScrapboxRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ScrapboxRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
if (recipeWrapper instanceof ScrapboxRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
ScrapboxRecipeWrapper recipe = (ScrapboxRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull ScrapboxRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@ -13,7 +14,7 @@ import techreborn.client.gui.GuiVacuumFreezer;
import techreborn.compat.jei.RecipeCategoryUids; import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil; import techreborn.compat.jei.RecipeUtil;
public class VacuumFreezerRecipeCategory extends BlankRecipeCategory public class VacuumFreezerRecipeCategory extends BlankRecipeCategory<VacuumFreezerRecipeWrapper>
{ {
private static final int[] INPUT_SLOTS = { 0 }; private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 }; private static final int[] OUTPUT_SLOTS = { 1 };
@ -49,17 +50,24 @@ public class VacuumFreezerRecipeCategory extends BlankRecipeCategory
} }
@Override @Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull VacuumFreezerRecipeWrapper recipeWrapper)
{ {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3); guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4); guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
if (recipeWrapper instanceof VacuumFreezerRecipeWrapper) RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
{ }
VacuumFreezerRecipeWrapper recipe = (VacuumFreezerRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null); @Override
} public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull VacuumFreezerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
} }
} }

View file

@ -7,7 +7,7 @@ public class ModInfo implements IModInfo
public static final String MOD_NAME = "TechReborn"; public static final String MOD_NAME = "TechReborn";
public static final String MOD_ID = "techreborn"; public static final String MOD_ID = "techreborn";
public static final String MOD_VERSION = "@MODVERSION@"; public static final String MOD_VERSION = "@MODVERSION@";
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[2.14,);after:IC2"; public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[3.11,);after:IC2";
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy"; public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy"; public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory"; public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";