2013-03-25 17:00:45 +01:00
|
|
|
package mekanism.common;
|
2013-03-20 16:14:26 +01:00
|
|
|
|
|
|
|
import mekanism.common.RecipeHandler.Recipe;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
|
|
|
|
|
|
public interface IFactory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Gets the recipe type this Smelting Factory currently has.
|
|
|
|
* @param itemStack - stack to check
|
|
|
|
* @return RecipeType ordinal
|
|
|
|
*/
|
|
|
|
public int getRecipeType(ItemStack itemStack);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the recipe type of this Smelting Factory to a new value.
|
|
|
|
* @param type - RecipeType ordinal
|
|
|
|
* @param itemStack - stack to set
|
|
|
|
*/
|
|
|
|
public void setRecipeType(int type, ItemStack itemStack);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not this item is a Smelting Factory.
|
|
|
|
* @param itemStack - stack to check
|
|
|
|
* @return if the item is a smelting factory
|
|
|
|
*/
|
|
|
|
public boolean isFactory(ItemStack itemStack);
|
|
|
|
|
|
|
|
public static enum RecipeType
|
|
|
|
{
|
2013-03-20 21:28:45 +01:00
|
|
|
SMELTING("Smelting", "Smelter.ogg"),
|
|
|
|
ENRICHING("Enriching", "Chamber.ogg"),
|
|
|
|
CRUSHING("Crushing", "Crusher.ogg");
|
2013-03-20 16:14:26 +01:00
|
|
|
|
|
|
|
private String name;
|
2013-03-20 21:28:45 +01:00
|
|
|
private String sound;
|
2013-03-20 16:14:26 +01:00
|
|
|
|
|
|
|
public ItemStack getCopiedOutput(ItemStack input, boolean stackDecrease)
|
|
|
|
{
|
|
|
|
if(this == SMELTING)
|
|
|
|
{
|
|
|
|
ItemStack toReturn = FurnaceRecipes.smelting().getSmeltingResult(input).copy();
|
|
|
|
|
|
|
|
if(stackDecrease)
|
|
|
|
{
|
|
|
|
input.stackSize--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return toReturn;
|
|
|
|
}
|
|
|
|
else if(this == ENRICHING)
|
|
|
|
{
|
|
|
|
return RecipeHandler.getOutput(input, stackDecrease, Recipe.ENRICHMENT_CHAMBER.get());
|
|
|
|
}
|
|
|
|
else if(this == CRUSHING)
|
|
|
|
{
|
|
|
|
return RecipeHandler.getOutput(input, stackDecrease, Recipe.CRUSHER.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2013-03-20 21:28:45 +01:00
|
|
|
public String getSound()
|
|
|
|
{
|
|
|
|
return sound;
|
|
|
|
}
|
|
|
|
|
|
|
|
private RecipeType(String s, String s1)
|
2013-03-20 16:14:26 +01:00
|
|
|
{
|
|
|
|
name = s;
|
2013-03-20 21:28:45 +01:00
|
|
|
sound = s1;
|
2013-03-20 16:14:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|