Fixed saw addition erroring

This commit is contained in:
Jared 2017-10-18 23:15:20 +02:00
parent 4f061aa2d1
commit e388b29edb

View file

@ -26,27 +26,24 @@ import java.util.Arrays;
@ModOnly("betterwithmods")
@ZenRegister
public class Saw {
@ZenMethod
public static void add(IItemStack[] output, @NotNull IIngredient input) {
for (IItemStack stack : input.getItems())
add(output, stack);
}
@ZenMethod
public static void add(IItemStack[] output, @NotNull IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output);
SawRecipe r = new SawRecipe(block, stack.getMetadata(), Arrays.asList(outputs));
ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Saw Recipe", SawManager.WOOD_SAW, Lists.newArrayList(r)));
for(IItemStack stacks : input.getItems()) {
ItemStack stack = InputHelper.toStack(stacks);
if(InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output);
SawRecipe r = new SawRecipe(block, stack.getMetadata(), Arrays.asList(outputs));
ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Saw Recipe", SawManager.WOOD_SAW, Lists.newArrayList(r)));
}
}
}
@ZenMethod
public static void remove(IItemStack input) {
ModTweaker.LATE_REMOVALS.add(new BMRemove("Remove Saw Recipe", SawManager.WOOD_SAW, InputHelper.toStack(input)));
}
}