/
ShapelessOreRecipeWrapper.java
52 lines (42 loc) · 1.46 KB
/
ShapelessOreRecipeWrapper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package mezz.jei.plugins.vanilla.crafting;
import java.util.Collections;
import java.util.List;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IStackHelper;
import mezz.jei.plugins.vanilla.VanillaPlugin;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class ShapelessOreRecipeWrapper extends AbstractShapelessRecipeWrapper {
private final ShapelessOreRecipe recipe;
public ShapelessOreRecipeWrapper(IGuiHelper guiHelper, ShapelessOreRecipe recipe) {
super(guiHelper);
this.recipe = recipe;
for (Object input : this.recipe.getInput()) {
if (input instanceof ItemStack) {
ItemStack itemStack = (ItemStack) input;
if (itemStack.stackSize != 1) {
itemStack.stackSize = 1;
}
}
}
}
@Override
public void getIngredients(IIngredients ingredients) {
IStackHelper stackHelper = VanillaPlugin.jeiHelpers.getStackHelper();
List<List<ItemStack>> inputs = stackHelper.expandRecipeItemStackInputs(recipe.getInput());
ingredients.setInputLists(ItemStack.class, inputs);
ItemStack recipeOutput = recipe.getRecipeOutput();
if (recipeOutput != null) {
ingredients.setOutput(ItemStack.class, recipeOutput);
}
}
@Override
public List getInputs() {
return recipe.getInput();
}
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(recipe.getRecipeOutput());
}
}