Added recipe init function
This commit is contained in:
parent
507e1ada0e
commit
c60d03428d
|
|
@ -0,0 +1,48 @@
|
||||||
|
package projectzombie.init;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import projectzombie.inventory.Crafting;
|
||||||
|
import projectzombie.inventory.recipe.Recipe;
|
||||||
|
import projectzombie.inventory.recipe.RecipeBasic;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class Recipies
|
||||||
|
{
|
||||||
|
public static ArrayList<Recipe> recipies;
|
||||||
|
|
||||||
|
public static Recipe[] getCraftableRecipies(Crafting tool)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
|
for(Recipe recipe : recipies) {
|
||||||
|
size += recipe.canCraft(tool) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int upto = 0;
|
||||||
|
Recipe[] craftable_recipies = new Recipe[size];
|
||||||
|
|
||||||
|
for(Recipe recipe : recipies)
|
||||||
|
{
|
||||||
|
if(recipe.canCraft(tool)) {
|
||||||
|
craftable_recipies[upto] = recipe;
|
||||||
|
upto += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return craftable_recipies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
recipies = new ArrayList<Recipe>();
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.FLINT, 2, (short)0),
|
||||||
|
new ItemStack(Items.PLANT_FIBRE, 5, (short)0),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.BASIC,
|
||||||
|
}, new ItemStack(Items.AMMO, 99, (short)0)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue