ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java

92 lines
2.8 KiB
Java
Raw Normal View History

2016-01-05 04:47:35 +01:00
/*
2016-05-16 22:52:27 +02:00
* This file ("LensConversionRecipe.java") is part of the Actually Additions mod for Minecraft.
2016-01-05 04:47:35 +01:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2016-01-05 04:47:35 +01:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-05-16 22:52:27 +02:00
* © 2015-2016 Ellpeck Ellpeck
2016-01-05 04:47:35 +01:00
*/
package de.ellpeck.actuallyadditions.api.recipe;
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
2016-01-05 04:47:35 +01:00
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
2016-05-14 13:51:18 +02:00
public class LensConversionRecipe{
2016-01-05 04:47:35 +01:00
public int energyUse;
public LensConversion type;
2016-01-05 04:47:35 +01:00
private String input;
private String output;
private ItemStack inputStack;
private ItemStack outputStack;
public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
2016-01-05 04:47:35 +01:00
this.inputStack = input;
this.outputStack = output;
this.energyUse = energyUse;
this.type = type;
2016-01-05 04:47:35 +01:00
}
public LensConversionRecipe(String input, String output, int energyUse, LensConversion type){
2016-01-05 04:47:35 +01:00
this.input = input;
this.output = output;
this.energyUse = energyUse;
this.type = type;
2016-01-05 04:47:35 +01:00
}
public List<ItemStack> getOutputs(){
if(this.outputStack != null){
return Collections.singletonList(this.outputStack.copy());
}
if(this.output == null || this.output.isEmpty()){
return null;
}
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
2016-01-05 04:47:35 +01:00
if(stacks != null && !stacks.isEmpty()){
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
for(ItemStack stack : stacks){
if(stack != null){
ItemStack stackCopy = stack.copy();
stackCopy.stackSize = 1;
stacksCopy.add(stackCopy);
}
}
return stacksCopy;
}
return null;
}
public List<ItemStack> getInputs(){
if(this.inputStack != null){
return Collections.singletonList(this.inputStack.copy());
}
if(this.input == null || this.input.isEmpty()){
return null;
}
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
2016-01-05 04:47:35 +01:00
if(stacks != null && !stacks.isEmpty()){
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
for(ItemStack stack : stacks){
if(stack != null){
ItemStack stackCopy = stack.copy();
stackCopy.stackSize = 1;
stacksCopy.add(stackCopy);
}
}
return stacksCopy;
}
return null;
}
}