Update JEI integration

This commit is contained in:
mezz committed 2016-09-27 02:53:06 -07:00
1 parent 3be3ecfc8a
commit ac48b4b5c6
28 files changed
+309 -389

No files matched your search

+14 -15
View File
@@ -12,20 +12,6 @@ package forestry;
import java.io.File;
import forestry.plugins.compat.PluginIC2;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.core.EventHandlerCore;
import forestry.core.climate.ClimateEventHandler;
@@ -40,6 +26,19 @@ import forestry.core.network.PacketHandler;
import forestry.core.proxy.Proxies;
import forestry.core.worldgen.WorldGenerator;
import forestry.plugins.PluginManager;
import forestry.plugins.compat.PluginIC2;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
/**
* Forestry Minecraft Mod
@@ -53,7 +52,7 @@ import forestry.plugins.PluginManager;
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
acceptedMinecraftVersions = "[1.10]",
dependencies = "required-after:Forge@[12.18.1.2080,);"
+ "after:JEI@[3.8.0,);"
+ "after:JEI@[3.11.2.278,);"
+ "after:" + PluginIC2.modId + ";")
public class Forestry {
@@ -8,7 +8,6 @@ package forestry.api.recipes;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public interface ICarpenterRecipe extends IForestryRecipe {
@@ -5,6 +5,9 @@
******************************************************************************/
package forestry.api.recipes;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
/**
@@ -30,4 +33,7 @@ public interface IDescriptiveRecipe extends IRecipe {
*/
Object[] getIngredients();
@Nonnull
@Override
ItemStack getRecipeOutput();
}
@@ -1,5 +1,8 @@
package forestry.core.utils;
import java.util.ArrayList;
import java.util.List;
import mezz.jei.api.IModRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@@ -8,9 +11,12 @@ import net.minecraftforge.oredict.OreDictionary;
public class JeiUtil {
public static void addDescription(IModRegistry registry, String itemKey, Item... items) {
List<ItemStack> itemStacks = new ArrayList<>();
for (Item item : items) {
addDescription(registry, item, itemKey);
itemStacks.add(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
}
registry.addDescription(itemStacks, "for.jei.description." + itemKey);
}
public static void addDescription(IModRegistry registry, Block... blocks) {
@@ -10,15 +10,17 @@
******************************************************************************/
package forestry.factory.recipes;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import forestry.api.recipes.ISqueezerRecipe;
import net.minecraft.item.ItemStack;
public interface ISqueezerContainerRecipe {
ItemStack getEmptyContainer();
int getProcessingTime();
@Nullable
ItemStack getRemnants();
float getRemnantsChance();
@@ -10,22 +10,23 @@
******************************************************************************/
package forestry.factory.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import javax.annotation.Nullable;
import forestry.api.recipes.ISqueezerRecipe;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
private final ItemStack emptyContainer;
private final int processingTime;
@Nullable
private final ItemStack remnants;
private final float remnantsChance;
public SqueezerContainerRecipe(ItemStack emptyContainer, int processingTime, ItemStack remnants, float remnantsChance) {
public SqueezerContainerRecipe(ItemStack emptyContainer, int processingTime, @Nullable ItemStack remnants, float remnantsChance) {
this.emptyContainer = emptyContainer;
this.processingTime = processingTime;
this.remnants = remnants;
@@ -42,6 +43,7 @@ public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
return processingTime;
}
@Nullable
@Override
public ItemStack getRemnants() {
return remnants;
@@ -2,7 +2,7 @@ package forestry.factory.recipes.jei;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.*;
import java.awt.Rectangle;
import java.util.List;
import forestry.core.gui.GuiForestry;
@@ -58,9 +58,11 @@ import net.minecraft.item.ItemStack;
@JEIPlugin
public class FactoryJeiPlugin extends BlankModPlugin {
public static IJeiHelpers jeiHelpers;
@Override
public void register(@Nonnull IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
jeiHelpers = registry.getJeiHelpers();
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
registry.addRecipeCategories(
@@ -2,13 +2,9 @@ package forestry.factory.recipes.jei.bottler;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
@@ -16,9 +12,11 @@ import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class BottlerRecipeCategory extends ForestryRecipeCategory {
public class BottlerRecipeCategory extends ForestryRecipeCategory<BottlerRecipeWrapper> {
private static final int emptySlot = 0;
private static final int outputSlot = 1;
@@ -50,7 +48,7 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BottlerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -58,11 +56,9 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory {
guiItemStacks.init(outputSlot, false, 63, 38);
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
guiItemStacks.setFromRecipe(emptySlot, recipeWrapper.getInputs());
guiItemStacks.setFromRecipe(outputSlot, recipeWrapper.getOutputs());
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
guiItemStacks.set(ingredients);
guiFluidStacks.set(ingredients);
}
}
@@ -2,14 +2,12 @@ package forestry.factory.recipes.jei.bottler;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import forestry.factory.recipes.BottlerRecipe;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class BottlerRecipeWrapper extends ForestryRecipeWrapper<BottlerRecipe> {
@@ -17,22 +15,13 @@ public class BottlerRecipeWrapper extends ForestryRecipeWrapper<BottlerRecipe> {
super(recipe);
}
@Nonnull
@Override
public List<FluidStack> getFluidInputs() {
return Collections.singletonList(getRecipe().input);
}
public void getIngredients(@Nonnull IIngredients ingredients) {
BottlerRecipe recipe = getRecipe();
@Nonnull
@Override
public List<ItemStack> getInputs() {
return Collections.singletonList(getRecipe().empty);
}
ingredients.setInputs(ItemStack.class, Collections.singletonList(recipe.empty));
ingredients.setInputs(FluidStack.class, Collections.singletonList(recipe.input));
@Nonnull
@Override
public List getOutputs() {
return Collections.singletonList(getRecipe().filled);
ingredients.setOutput(ItemStack.class, recipe.filled);
}
}
@@ -1,17 +1,15 @@
package forestry.factory.recipes.jei.carpenter;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import forestry.api.recipes.ICarpenterRecipe;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import forestry.factory.recipes.jei.FactoryJeiPlugin;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable;
@@ -20,9 +18,14 @@ import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IStackHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class CarpenterRecipeCategory extends ForestryRecipeCategory {
public class CarpenterRecipeCategory extends ForestryRecipeCategory<CarpenterRecipeWrapper> {
private static final int boxSlot = 0;
private static final int craftOutputSlot = 1;
@@ -59,7 +62,7 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CarpenterRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -75,17 +78,27 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
}
guiFluidStacks.init(inputTank, true, 141, 1, 16, 58, 10000, false, tankOverlay);
CarpenterRecipeWrapper wrapper = (CarpenterRecipeWrapper) recipeWrapper;
guiItemStacks.set(boxSlot, wrapper.getRecipe().getBox());
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
List<Object> inputs = new ArrayList<>();
Collections.addAll(inputs, wrapper.getRecipe().getCraftingGridRecipe().getIngredients());
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getCraftingGridRecipe().getWidth(), wrapper.getRecipe().getCraftingGridRecipe().getHeight());
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
ICarpenterRecipe recipe = recipeWrapper.getRecipe();
ItemStack box = recipe.getBox();
if (box != null) {
guiItemStacks.set(boxSlot, box);
}
List<ItemStack> outputs = ingredients.getOutputs(ItemStack.class);
craftingGridHelper.setOutput(guiItemStacks, outputs);
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
List<Object> inputs = Arrays.asList(craftingGridRecipe.getIngredients());
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
List<List<ItemStack>> craftInputs = stackHelper.expandRecipeItemStackInputs(inputs);
craftingGridHelper.setInputStacks(guiItemStacks, craftInputs, craftingGridRecipe.getWidth(), craftingGridRecipe.getHeight());
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
if (!fluidInputs.isEmpty()) {
guiFluidStacks.set(inputTank, fluidInputs.get(0));
}
}
}
@@ -1,16 +1,18 @@
package forestry.factory.recipes.jei.carpenter;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.recipes.ICarpenterRecipe;
import forestry.api.recipes.IDescriptiveRecipe;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import forestry.factory.recipes.jei.FactoryJeiPlugin;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IStackHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterRecipe> {
@@ -18,25 +20,26 @@ public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterReci
super(recipe);
}
@Nonnull
@Override
public List getInputs() {
List<Object> inputs = new ArrayList<>();
Collections.addAll(inputs, getRecipe().getCraftingGridRecipe().getIngredients());
inputs.add(getRecipe().getBox());
return inputs;
}
public void getIngredients(@Nonnull IIngredients ingredients) {
ICarpenterRecipe recipe = getRecipe();
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
Object[] inputs = craftingGridRecipe.getIngredients();
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
@Nonnull
@Override
public List<FluidStack> getFluidInputs() {
return Collections.singletonList(getRecipe().getFluidResource());
}
List<List<ItemStack>> inputStacks = stackHelper.expandRecipeItemStackInputs(Arrays.asList(inputs));
ItemStack box = recipe.getBox();
if (box != null) {
inputStacks.add(Collections.singletonList(box));
}
ingredients.setInputLists(ItemStack.class, inputStacks);
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(getRecipe().getCraftingGridRecipe().getRecipeOutput());
}
FluidStack fluidResource = recipe.getFluidResource();
if (fluidResource != null) {
ingredients.setInputs(FluidStack.class, Collections.singletonList(fluidResource));
}
ItemStack recipeOutput = craftingGridRecipe.getRecipeOutput();
ingredients.setOutput(ItemStack.class, recipeOutput);
}
}
@@ -2,29 +2,28 @@ package forestry.factory.recipes.jei.centrifuge;
import javax.annotation.Nonnull;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.recipes.jei.ForestryTooltipCallback;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
public class CentrifugeRecipeCategory extends ForestryRecipeCategory<CentrifugeRecipeWrapper> {
private static final int[][] OUTPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
@@ -62,14 +61,16 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CentrifugeRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(inputSlot, true, 4, 18);
guiItemStacks.setFromRecipe(inputSlot, recipeWrapper.getInputs());
CentrifugeRecipeWrapper centrifugeWrapper = (CentrifugeRecipeWrapper) recipeWrapper;
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
guiItemStacks.set(inputSlot, inputs.get(0));
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
setResults(tooltip, centrifugeWrapper.getRecipe().getAllProducts(), guiItemStacks);
Map<ItemStack, Float> products = recipeWrapper.getRecipe().getAllProducts();
setResults(tooltip, products, guiItemStacks);
guiItemStacks.addTooltipCallback(tooltip);
}
@@ -1,11 +1,14 @@
package forestry.factory.recipes.jei.centrifuge;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import forestry.api.recipes.ICentrifugeRecipe;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
public class CentrifugeRecipeWrapper extends ForestryRecipeWrapper<ICentrifugeRecipe> {
@@ -13,16 +16,13 @@ public class CentrifugeRecipeWrapper extends ForestryRecipeWrapper<ICentrifugeRe
super(recipe);
}
@Nonnull
@Override
public List getInputs() {
return Collections.singletonList(getRecipe().getInput());
}
public void getIngredients(@Nonnull IIngredients ingredients) {
ICentrifugeRecipe recipe = getRecipe();
@Nonnull
@Override
public List getOutputs() {
return Collections.singletonList(getRecipe().getAllProducts().keySet());
}
ingredients.setInputs(ItemStack.class, Collections.singletonList(recipe.getInput()));
Set<ItemStack> outputs = recipe.getAllProducts().keySet();
ingredients.setOutputs(ItemStack.class, new ArrayList<>(outputs));
}
}
@@ -2,30 +2,28 @@ package forestry.factory.recipes.jei.fabricator;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import forestry.api.recipes.IFabricatorRecipe;
import forestry.api.recipes.IFabricatorSmeltingRecipe;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
public class FabricatorRecipeCategory extends ForestryRecipeCategory {
public class FabricatorRecipeCategory extends ForestryRecipeCategory<FabricatorRecipeWrapper> {
private static final int planSlot = 0;
private static final int smeltingInputSlot = 1;
@@ -51,7 +49,7 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FabricatorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -69,25 +67,33 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
}
guiFluidStacks.init(inputTank, true, 6, 32, 16, 16, 2000, false, null);
FabricatorRecipeWrapper wrapper = (FabricatorRecipeWrapper) recipeWrapper;
guiItemStacks.set(planSlot, wrapper.getRecipe().getPlan());
IFabricatorRecipe recipe = recipeWrapper.getRecipe();
ItemStack plan = recipe.getPlan();
if (plan != null) {
guiItemStacks.set(planSlot, plan);
}
List<ItemStack> smeltingInput = new ArrayList<>();
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(wrapper.getRecipe().getLiquid().getFluid())) {
Fluid recipeFluid = recipe.getLiquid().getFluid();
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(recipeFluid)) {
smeltingInput.add(s.getResource());
}
if (!smeltingInput.isEmpty()) {
guiItemStacks.set(smeltingInputSlot, smeltingInput);
}
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
List<Object> inputs = new ArrayList<>();
Collections.addAll(inputs, wrapper.getRecipe().getIngredients());
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getWidth(), wrapper.getRecipe().getHeight());
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
List<ItemStack> itemOutputs = ingredients.getOutputs(ItemStack.class);
craftingGridHelper.setOutput(guiItemStacks, itemOutputs);
List<List<ItemStack>> itemStackInputs = ingredients.getInputs(ItemStack.class);
craftingGridHelper.setInputStacks(guiItemStacks, itemStackInputs, recipe.getWidth(), recipe.getHeight());
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
if (!fluidInputs.isEmpty()) {
guiFluidStacks.set(inputTank, fluidInputs.get(0));
}
}
private static Map<Fluid, List<IFabricatorSmeltingRecipe>> getSmeltingInputs() {
@@ -1,16 +1,17 @@
package forestry.factory.recipes.jei.fabricator;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.recipes.IFabricatorRecipe;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import forestry.factory.recipes.jei.FactoryJeiPlugin;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IStackHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRecipe> {
@@ -18,25 +19,17 @@ public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRe
super(recipe);
}
@Nonnull
@Override
public List getInputs() {
List<Object> inputs = new ArrayList<>();
Collections.addAll(inputs, getRecipe().getIngredients());
inputs.add(getRecipe().getPlan());
return inputs;
}
public void getIngredients(@Nonnull IIngredients ingredients) {
IFabricatorRecipe recipe = getRecipe();
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
@Nonnull
@Override
public List<FluidStack> getFluidInputs() {
return Collections.singletonList(getRecipe().getLiquid());
}
Object[] itemInputs = recipe.getIngredients();
List<List<ItemStack>> itemStackInputs = stackHelper.expandRecipeItemStackInputs(Arrays.asList(itemInputs));
ingredients.setInputLists(ItemStack.class, itemStackInputs);
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(getRecipe().getRecipeOutput());
}
ingredients.setInputs(FluidStack.class, Collections.singletonList(getRecipe().getLiquid()));
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput());
}
}
@@ -1,19 +1,10 @@
package forestry.factory.recipes.jei.fermenter;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import forestry.api.fuels.FermenterFuel;
import forestry.api.fuels.FuelManager;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
@@ -21,6 +12,9 @@ import mezz.jei.api.gui.IDrawableStatic;
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 net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRecipeWrapper> {
@@ -61,7 +55,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRec
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -70,16 +64,9 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRec
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 3000, false, tankOverlay);
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 3000, false, tankOverlay);
guiItemStacks.set(resourceSlot, recipeWrapper.getFermentable());
List<ItemStack> fuels = new ArrayList<>();
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
fuels.add(fuel.getItem());
}
guiItemStacks.set(fuelSlot, fuels);
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
guiItemStacks.set(ingredients);
guiFluidStacks.set(ingredients);
}
}
@@ -2,18 +2,18 @@ package forestry.factory.recipes.jei.fermenter;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.fuels.FermenterFuel;
import forestry.api.fuels.FuelManager;
import forestry.api.recipes.IFermenterRecipe;
import forestry.api.recipes.IVariableFermentable;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterRecipe> {
@@ -25,39 +25,32 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterReci
this.fermentable = fermentable;
}
@Nonnull
@Override
public List getInputs() {
List<ItemStack> inputs = new ArrayList<>();
public void getIngredients(@Nonnull IIngredients ingredients) {
List<ItemStack> fuelInputs = new ArrayList<>();
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
inputs.add(fuel.getItem());
fuelInputs.add(fuel.getItem());
}
inputs.add(fermentable);
return inputs;
ingredients.setInputLists(ItemStack.class, Arrays.asList(
Collections.singletonList(fermentable),
fuelInputs
));
FluidStack fluidInput = getRecipe().getFluidResource().copy();
fluidInput.amount = getRecipe().getFermentationValue();
ingredients.setInput(FluidStack.class, fluidInput);
int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
if (fermentable.getItem() instanceof IVariableFermentable) {
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
}
FluidStack fluidOutput = new FluidStack(getRecipe().getOutput(), amount);
ingredients.setOutput(FluidStack.class, fluidOutput);
}
@Nonnull
public ItemStack getFermentable() {
return fermentable;
}
@Nonnull
@Override
public List<FluidStack> getFluidInputs() {
FluidStack input = getRecipe().getFluidResource().copy();
input.amount = getRecipe().getFermentationValue();
return Collections.singletonList(input);
}
@Nonnull
@Override
public List<FluidStack> getFluidOutputs() {
int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
if (fermentable.getItem() instanceof IVariableFermentable) {
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
}
FluidStack output = new FluidStack(getRecipe().getOutput(), amount);
return Collections.singletonList(output);
}
}
@@ -2,15 +2,9 @@ package forestry.factory.recipes.jei.moistener;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidRegistry;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
@@ -18,9 +12,11 @@ import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class MoistenerRecipeCategory extends ForestryRecipeCategory {
public class MoistenerRecipeCategory extends ForestryRecipeCategory<MoistenerRecipeWrapper> {
private static final int resourceSlot = 0;
private static final int productSlot = 1;
@@ -60,7 +56,7 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull MoistenerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
@@ -71,16 +67,9 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
guiItemStacks.init(fuelProductSlot, false, 89, 21);
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
MoistenerRecipeWrapper wrapper = (MoistenerRecipeWrapper) recipeWrapper;
guiItemStacks.set(resourceSlot, wrapper.getRecipe().getResource());
guiItemStacks.set(fuelItemSlot, wrapper.getFuel().getItem());
guiItemStacks.set(productSlot, wrapper.getRecipe().getProduct());
guiItemStacks.set(fuelProductSlot, wrapper.getFuel().getProduct());
guiFluidStacks.set(inputTank, FluidRegistry.getFluidStack("water", 10000));
guiItemStacks.set(ingredients);
guiFluidStacks.set(ingredients);
}
}
@@ -4,11 +4,13 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import forestry.api.fuels.MoistenerFuel;
import forestry.api.recipes.IMoistenerRecipe;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerRecipe> {
@@ -20,26 +22,27 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
this.fuel = fuel;
}
@Nonnull
@Override
public List<ItemStack> getInputs() {
List<ItemStack> inputs = new ArrayList<>();
inputs.add(getRecipe().getResource());
if (fuel.getItem() != null) {
inputs.add(fuel.getItem());
}
return inputs;
}
public void getIngredients(@Nonnull IIngredients ingredients) {
IMoistenerRecipe recipe = getRecipe();
@Nonnull
@Override
public List<ItemStack> getOutputs() {
List<ItemStack> outputs = new ArrayList<>();
outputs.add(getRecipe().getProduct());
if (fuel.getProduct() != null) {
outputs.add(fuel.getProduct());
List<ItemStack> itemStackInputs = new ArrayList<>();
itemStackInputs.add(recipe.getResource());
ItemStack fuelItem = fuel.getItem();
if (fuelItem != null) {
itemStackInputs.add(fuelItem);
}
return outputs;
ingredients.setInputs(ItemStack.class, itemStackInputs);
List<ItemStack> itemStackOutputs = new ArrayList<>();
itemStackOutputs.add(recipe.getProduct());
ItemStack fuelProduct = fuel.getProduct();
if (fuelProduct != null) {
itemStackOutputs.add(fuelProduct);
}
ingredients.setOutputs(ItemStack.class, itemStackOutputs);
ingredients.setInput(FluidStack.class, new FluidStack(FluidRegistry.WATER, recipe.getTimePerItem() / 4));
}
@Nonnull
@@ -1,21 +1,17 @@
package forestry.factory.recipes.jei.rainmaker;
import javax.annotation.Nonnull;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
public class RainmakerRecipeCategory extends ForestryRecipeCategory {
public class RainmakerRecipeCategory extends ForestryRecipeCategory<RainmakerRecipeWrapper> {
private static final int SLOT_INPUT_INDEX = 0;
private final IDrawable slot;
@@ -37,13 +33,9 @@ public class RainmakerRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RainmakerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(SLOT_INPUT_INDEX, true, 0, 0);
if (recipeWrapper instanceof RainmakerRecipeWrapper) {
RainmakerRecipeWrapper rainmakerRecipeWrapper = (RainmakerRecipeWrapper) recipeWrapper;
List<ItemStack> input = rainmakerRecipeWrapper.getInputs().get(SLOT_INPUT_INDEX);
guiItemStacks.set(SLOT_INPUT_INDEX, input);
}
guiItemStacks.set(ingredients);
}
}
@@ -3,15 +3,13 @@ package forestry.factory.recipes.jei.rainmaker;
import javax.annotation.Nonnull;
import java.awt.Color;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import forestry.api.fuels.RainSubstrate;
import forestry.core.utils.Translator;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
@Nonnull
@@ -21,10 +19,9 @@ public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
this.substrate = substrate;
}
@Nonnull
@Override
public List<List<ItemStack>> getInputs() {
return Collections.singletonList(Collections.singletonList(substrate.getItem()));
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Collections.singletonList(substrate.getItem()));
}
@Override
@@ -1,11 +1,6 @@
package forestry.factory.recipes.jei.squeezer;
import javax.annotation.Nonnull;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
@@ -14,18 +9,6 @@ public abstract class AbstractSqueezerRecipeWrapper<R> extends ForestryRecipeWra
super(recipe);
}
@Nonnull
@Override
public abstract List<ItemStack> getInputs();
@Nonnull
@Override
public abstract List<FluidStack> getFluidOutputs();
@Nonnull
@Override
public abstract List<ItemStack> getOutputs();
/**
* @return Chance remnants will be produced by a single recipe cycle, from 0 to 1.
*/
@@ -2,14 +2,12 @@ package forestry.factory.recipes.jei.squeezer;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import forestry.factory.recipes.ISqueezerContainerRecipe;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
public class SqueezerContainerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueezerContainerRecipe> {
@@ -21,22 +19,19 @@ public class SqueezerContainerRecipeWrapper extends AbstractSqueezerRecipeWrappe
this.filledContainer = filledContainer;
}
@Nonnull
@Override
public List<ItemStack> getInputs() {
return Collections.singletonList(filledContainer);
}
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Collections.singletonList(filledContainer));
@Nonnull
@Override
public List<FluidStack> getFluidOutputs() {
return Collections.singletonList(FluidContainerRegistry.getFluidForFilledItem(filledContainer));
}
ItemStack remnants = getRecipe().getRemnants();
if (remnants != null) {
ingredients.setOutput(ItemStack.class, remnants);
}
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(getRecipe().getRemnants());
FluidStack fluidContained = FluidUtil.getFluidContained(filledContainer);
if (fluidContained != null) {
ingredients.setOutput(FluidStack.class, fluidContained);
}
}
@Override
@@ -1,17 +1,11 @@
package forestry.factory.recipes.jei.squeezer;
import javax.annotation.Nonnull;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.recipes.jei.ForestryTooltipCallback;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
@@ -19,9 +13,11 @@ import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class SqueezerRecipeCategory extends ForestryRecipeCategory {
public class SqueezerRecipeCategory extends ForestryRecipeCategory<AbstractSqueezerRecipeWrapper> {
private static final int[][] INPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
@@ -56,33 +52,22 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AbstractSqueezerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
AbstractSqueezerRecipeWrapper<?> wrapper = (AbstractSqueezerRecipeWrapper) recipeWrapper;
float chance = wrapper.getRemnantsChance();
guiFluidStacks.init(outputTank, false, 113, 2, 16, 58, 10000, false, tankOverlay);
guiFluidStacks.set(outputTank, wrapper.getFluidOutputs());
guiItemStacks.init(craftOutputSlot, false, 87, 43);
guiItemStacks.set(craftOutputSlot, wrapper.getOutputs());
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
tooltip.addChanceTooltip(craftOutputSlot, chance);
setIngredients(guiItemStacks, wrapper.getInputs());
guiItemStacks.addTooltipCallback(tooltip);
}
private static void setIngredients(@Nonnull IGuiItemStackGroup guiItemStacks, @Nonnull List<ItemStack> inputs) {
int i = 0;
for (ItemStack stack : inputs) {
for (int i = 0; i < INPUTS.length; i++) {
guiItemStacks.init(craftInputSlot + i, true, 7 + INPUTS[i][0] * 18, 4 + INPUTS[i][1] * 18);
guiItemStacks.set(craftInputSlot + i, stack);
i++;
}
}
guiItemStacks.init(craftOutputSlot, false, 87, 43);
guiFluidStacks.init(outputTank, false, 113, 2, 16, 58, 10000, false, tankOverlay);
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
float chance = recipeWrapper.getRemnantsChance();
tooltip.addChanceTooltip(craftOutputSlot, chance);
guiItemStacks.addTooltipCallback(tooltip);
guiItemStacks.set(ingredients);
guiFluidStacks.set(ingredients);
}
}
@@ -1,41 +1,30 @@
package forestry.factory.recipes.jei.squeezer;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import java.util.Arrays;
import forestry.api.recipes.ISqueezerRecipe;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class SqueezerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueezerRecipe> {
public SqueezerRecipeWrapper(@Nonnull ISqueezerRecipe recipe) {
super(recipe);
}
@Nonnull
@Override
public List<ItemStack> getInputs() {
List<ItemStack> inputs = new ArrayList<>();
Collections.addAll(inputs, getRecipe().getResources());
return inputs;
}
@Nonnull
@Override
public List<FluidStack> getFluidOutputs() {
return Collections.singletonList(getRecipe().getFluidOutput());
}
@Nonnull
@Override
public List<ItemStack> getOutputs() {
public void getIngredients(@Nonnull IIngredients ingredients) {
ItemStack[] resources = getRecipe().getResources();
ingredients.setInputs(ItemStack.class, Arrays.asList(resources));
ItemStack remnants = getRecipe().getRemnants();
return remnants == null ? Collections.emptyList() : Collections.singletonList(remnants);
if (remnants != null) {
ingredients.setOutput(ItemStack.class, remnants);
}
ingredients.setOutput(FluidStack.class, getRecipe().getFluidOutput());
}
@Override
@@ -2,20 +2,19 @@ package forestry.factory.recipes.jei.still;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import forestry.core.recipes.jei.ForestryRecipeCategory;
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
import forestry.core.render.ForestryResource;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiFluidStackGroup;
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.util.ResourceLocation;
public class StillRecipeCategory extends ForestryRecipeCategory {
@@ -49,14 +48,13 @@ public class StillRecipeCategory extends ForestryRecipeCategory {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 10000, false, tankOverlay);
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
guiFluidStacks.set(ingredients);
}
}
@@ -2,12 +2,11 @@ package forestry.factory.recipes.jei.still;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.recipes.IStillRecipe;
import forestry.core.recipes.jei.ForestryRecipeWrapper;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraftforge.fluids.FluidStack;
public class StillRecipeWrapper extends ForestryRecipeWrapper<IStillRecipe> {
@@ -15,16 +14,9 @@ public class StillRecipeWrapper extends ForestryRecipeWrapper<IStillRecipe> {
super(recipe);
}
@Nonnull
@Override
public List<FluidStack> getFluidInputs() {
return Collections.singletonList(getRecipe().getInput());
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputs(FluidStack.class, Collections.singletonList(getRecipe().getInput()));
ingredients.setOutput(FluidStack.class, getRecipe().getOutput());
}
@Nonnull
@Override
public List<FluidStack> getFluidOutputs() {
return Collections.singletonList(getRecipe().getOutput());
}
}