Fix #1562 Carpenter recipes not showing properly in JEI

This commit is contained in:
mezz committed 2017-01-07 01:10:16 -08:00
1 parent b5e24e84cb
commit a72971e042
3 files changed
+22 -12

No files matched your search

@@ -113,8 +113,8 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
}
}
input = NonNullList.withSize(9, NonNullList.create());
oreDicts = NonNullList.withSize(9, "");
input = NonNullList.withSize(shape.length(), NonNullList.create());
oreDicts = NonNullList.withSize(shape.length(), "");
int x = 0;
for (char chr : shape.toCharArray()) {
NonNullList<ItemStack> stacks = itemMap.get(chr);
@@ -82,7 +82,8 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory<CarpenterRec
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), craftingGridRecipe.getWidth(), craftingGridRecipe.getHeight());
List<List<ItemStack>> craftingInputs = recipeWrapper.getInputStacks();
craftingGridHelper.setInputs(guiItemStacks, craftingInputs, craftingGridRecipe.getWidth(), craftingGridRecipe.getHeight());
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
if (!fluidInputs.isEmpty()) {
@@ -13,30 +13,35 @@ import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.FluidStack;
public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterRecipe> {
private final List<List<ItemStack>> inputStacks;
public CarpenterRecipeWrapper(ICarpenterRecipe recipe) {
super(recipe);
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
NonNullList<NonNullList<ItemStack>> inputs = craftingGridRecipe.getIngredients();
this.inputStacks = new ArrayList<>();
for (List<ItemStack> stacks : inputs) {
List<ItemStack> copy = new ArrayList<>();
copy.addAll(stacks);
this.inputStacks.add(copy);
}
}
@Override
public void getIngredients(IIngredients ingredients) {
ICarpenterRecipe recipe = getRecipe();
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
NonNullList<NonNullList<ItemStack>> inputs = craftingGridRecipe.getIngredients();
List<List<ItemStack>> inputStacks = new ArrayList<>();
for (List<ItemStack> stacks : inputs) {
List<ItemStack> copy = new ArrayList<>();
copy.addAll(stacks);
if(!copy.isEmpty()){
inputStacks.add(copy);
}
}
ItemStack box = recipe.getBox();
if (!box.isEmpty()) {
inputStacks.add(Collections.singletonList(box));
}
inputStacks.addAll(getInputStacks());
ingredients.setInputLists(ItemStack.class, inputStacks);
FluidStack fluidResource = recipe.getFluidResource();
@@ -47,4 +52,8 @@ public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterReci
ItemStack recipeOutput = craftingGridRecipe.getRecipeOutput();
ingredients.setOutput(ItemStack.class, recipeOutput);
}
public List<List<ItemStack>> getInputStacks() {
return inputStacks;
}
}