/
ShapedRecipesWrapper.java
49 lines (39 loc) · 1.14 KB
/
ShapedRecipesWrapper.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
package mezz.jei.plugins.vanilla.crafting;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import mezz.jei.plugins.vanilla.VanillaRecipeWrapper;
public class ShapedRecipesWrapper extends VanillaRecipeWrapper implements IShapedCraftingRecipeWrapper {
@Nonnull
private final ShapedRecipes recipe;
public ShapedRecipesWrapper(@Nonnull ShapedRecipes recipe) {
this.recipe = recipe;
for (ItemStack itemStack : this.recipe.recipeItems) {
if (itemStack != null && itemStack.stackSize != 1) {
itemStack.stackSize = 1;
}
}
}
@Nonnull
@Override
public List getInputs() {
return Arrays.asList(recipe.recipeItems);
}
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(recipe.getRecipeOutput());
}
@Override
public int getWidth() {
return recipe.recipeWidth;
}
@Override
public int getHeight() {
return recipe.recipeHeight;
}
}