Initial fix to allow null itemstacks
This commit is contained in:
parent
56e41efd6b
commit
46ee2fc71d
4 changed files with 22 additions and 9 deletions
|
@ -1,5 +1,7 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -12,17 +12,25 @@ public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implem
|
|||
@Override
|
||||
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
||||
int offset = 4;
|
||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 34 - offset, 16 - offset);
|
||||
input.add(pStack);
|
||||
if(recipeType.getInputs().size() > 0) {
|
||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 34 - offset, 16 - offset);
|
||||
input.add(pStack);
|
||||
}
|
||||
|
||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 34 - offset, 34 - offset);
|
||||
input.add(pStack2);
|
||||
if(recipeType.getInputs().size() > 1){
|
||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 34 - offset, 34 - offset);
|
||||
input.add(pStack2);
|
||||
}
|
||||
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 86 - offset, 25 - offset);
|
||||
outputs.add(pStack3);
|
||||
if(recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 86 - offset, 25 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 104 - offset, 25 - offset);
|
||||
outputs.add(pStack4);
|
||||
if(recipeType.getOutputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 104 - offset, 25 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -201,7 +201,7 @@ public class ModRecipes {
|
|||
TechRebornAPI.addRollingMachinceRecipe(new ItemStack(Blocks.furnace, 4), "ccc", "c c", "ccc", 'c', Blocks.cobblestone);
|
||||
TechRebornAPI.registerBlastFurnaceRecipe(new BlastFurnaceRecipe(new ItemStack(Items.apple), new ItemStack(Items.ender_pearl), new ItemStack(Items.golden_apple), new ItemStack(Items.diamond), 120, 1000));
|
||||
|
||||
RecipeHanderer.addRecipe(new ImplosionCompressorRecipe(new ItemStack(Blocks.end_stone, 4), IC2Items.getItem("copperIngot"), new ItemStack(Items.brewing_stand), new ItemStack(Items.carrot), 120, 5));
|
||||
RecipeHanderer.addRecipe(new ImplosionCompressorRecipe(new ItemStack(Blocks.end_stone, 4), null, new ItemStack(Items.brewing_stand), new ItemStack(Items.carrot), 120, 5));
|
||||
|
||||
RecipeHanderer.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.coal), new ItemStack(Blocks.sand), new ItemStack(Items.diamond), 120, 5));
|
||||
RecipeHanderer.addRecipe(new AssemblingMachineRecipe(new ItemStack(Items.coal), new ItemStack(Blocks.sand), new ItemStack(Items.diamond), 120, 5));
|
||||
|
|
|
@ -113,6 +113,9 @@ public class ItemUtils {
|
|||
}
|
||||
|
||||
public static List<ItemStack> getStackWithAllOre(ItemStack stack){
|
||||
if(stack == null){
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
for (int oreID : OreDictionary.getOreIDs(stack)){
|
||||
for(ItemStack ore : OreDictionary.getOres(OreDictionary.getOreName(oreID))){
|
||||
|
|
Loading…
Add table
Reference in a new issue