/
ShapedOreRecipeWrapper.java
53 lines (43 loc) · 1.44 KB
/
ShapedOreRecipeWrapper.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
53
package mezz.jei.plugins.vanilla.crafting;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import mezz.jei.plugins.vanilla.VanillaRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class ShapedOreRecipeWrapper extends VanillaRecipeWrapper implements IShapedCraftingRecipeWrapper {
private final ShapedOreRecipe recipe;
private final int width;
private final int height;
public ShapedOreRecipeWrapper(ShapedOreRecipe recipe) {
this.recipe = recipe;
for (Object input : this.recipe.getInput()) {
if (input instanceof ItemStack) {
ItemStack itemStack = (ItemStack) input;
if (itemStack.stackSize != 1) {
itemStack.stackSize = 1;
}
}
}
this.width = ObfuscationReflectionHelper.getPrivateValue(ShapedOreRecipe.class, this.recipe, "width");
this.height = ObfuscationReflectionHelper.getPrivateValue(ShapedOreRecipe.class, this.recipe, "height");
}
@Override
public List getInputs() {
return Arrays.asList(recipe.getInput());
}
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(recipe.getRecipeOutput());
}
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
}