use of thaumcraft.api.crafting.InfusionRecipe in project PneumaticCraft by MineMaarten.
the class ThaumcraftApi method addInfusionCraftingRecipe.
/**
* @param research the research key required for this recipe to work. Leave blank if it will work without research
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
* instability effect each second while the crafting is in progress
* @param aspects the essentia cost per aspect.
* @param aspects input the central item to be infused
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
*
*/
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input, ItemStack[] recipe) {
if (!(result instanceof ItemStack || result instanceof Object[]))
return null;
InfusionRecipe r = new InfusionRecipe(research, result, instability, aspects, input, recipe);
craftingRecipes.add(r);
return r;
}
use of thaumcraft.api.crafting.InfusionRecipe in project ArsMagica2 by Mithion.
the class ThaumcraftApi method addInfusionCraftingRecipe.
/**
* @param research the research key required for this recipe to work. Leave blank if it will work without research
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
* instability effect each second while the crafting is in progress
* @param aspects the essentia cost per aspect.
* @param aspects input the central item to be infused
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
*
*/
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input, ItemStack[] recipe) {
if (!(result instanceof ItemStack || result instanceof Object[]))
return null;
InfusionRecipe r = new InfusionRecipe(research, result, instability, aspects, input, recipe);
craftingRecipes.add(r);
return r;
}
use of thaumcraft.api.crafting.InfusionRecipe in project Railcraft by Railcraft.
the class ThaumcraftApi method addInfusionCraftingRecipe.
/**
* @param research the research key required for this recipe to work. Leave blank if it will work without research
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
* If nbt it needs to be in the format Object[] {"nbttagname", NBT Tag Object} eg. new Object[] { "mask", new NBTTagInt(1) }
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
* instability effect each second while the crafting is in progress
* @param aspects the essentia cost per aspect.
* @param aspects input the central item to be infused. If string is passed it will look up oredictionary entries
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
* If string is passed it will look up oredictionary entries.
*/
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, Object input, Object[] recipe) {
if (!(result instanceof ItemStack || result instanceof Object[]))
return null;
InfusionRecipe r = new InfusionRecipe(research, result, instability, aspects, input, recipe);
craftingRecipes.add(r);
return r;
}
use of thaumcraft.api.crafting.InfusionRecipe in project Railcraft by Railcraft.
the class ThaumcraftApi method getCraftingRecipeKey.
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) {
int[] key = new int[] { Item.getIdFromItem(stack.getItem()), stack.getItemDamage() };
if (keyCache.containsKey(key)) {
if (keyCache.get(key) == null)
return null;
if (ResearchHelper.isResearchComplete(player.getName(), (String) (keyCache.get(key))[0]))
return keyCache.get(key);
else
return null;
}
for (ResearchCategoryList rcl : ResearchCategories.researchCategories.values()) {
for (ResearchItem ri : rcl.research.values()) {
if (ri.getPages() == null)
continue;
for (int a = 0; a < ri.getPages().length; a++) {
ResearchPage page = ri.getPages()[a];
if (page.recipe != null && page.recipe instanceof CrucibleRecipe[]) {
CrucibleRecipe[] crs = (CrucibleRecipe[]) page.recipe;
for (CrucibleRecipe cr : crs) {
if (cr.getRecipeOutput().isItemEqual(stack)) {
keyCache.put(key, new Object[] { ri.key, a });
if (ResearchHelper.isResearchComplete(player.getName(), ri.key))
return new Object[] { ri.key, a };
}
}
} else if (page.recipe != null && page.recipe instanceof InfusionRecipe[]) {
InfusionRecipe[] crs = (InfusionRecipe[]) page.recipe;
for (InfusionRecipe cr : crs) {
if (cr.getRecipeOutput() instanceof ItemStack && ((ItemStack) cr.getRecipeOutput()).isItemEqual(stack)) {
keyCache.put(key, new Object[] { ri.key, a });
if (ResearchHelper.isResearchComplete(player.getName(), ri.key))
return new Object[] { ri.key, a };
}
}
} else if (page.recipe != null && page.recipe instanceof IRecipe[]) {
IRecipe[] crs = (IRecipe[]) page.recipe;
for (IRecipe cr : crs) {
if (cr.getRecipeOutput().isItemEqual(stack)) {
keyCache.put(key, new Object[] { ri.key, a });
if (ResearchHelper.isResearchComplete(player.getName(), ri.key))
return new Object[] { ri.key, a };
}
}
} else if (page.recipeOutput != null && stack != null && (page.recipeOutput instanceof ItemStack && ((ItemStack) page.recipeOutput).isItemEqual(stack)) || (page.recipeOutput instanceof String && ThaumcraftApiHelper.containsMatch(true, new ItemStack[] { stack }, OreDictionary.getOres((String) page.recipeOutput)))) {
keyCache.put(key, new Object[] { ri.key, a });
if (ResearchHelper.isResearchComplete(player.getName(), ri.key))
return new Object[] { ri.key, a };
else
return null;
}
}
}
}
keyCache.put(key, null);
return null;
}
use of thaumcraft.api.crafting.InfusionRecipe in project Railcraft by Railcraft.
the class ThaumcraftApi method addInfusionCraftingRecipe.
/**
* @param research the research keys required for this recipe to work. Leave blank if it will work without research
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
* If nbt it needs to be in the format Object[] {"nbttagname", NBT Tag Object} eg. new Object[] { "mask", new NBTTagInt(1) }
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
* instability effect each second while the crafting is in progress
* @param aspects the essentia cost per aspect.
* @param aspects input the central item to be infused. If string is passed it will look up oredictionary entries
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
* If string is passed it will look up oredictionary entries.
*/
public static InfusionRecipe addInfusionCraftingRecipe(String[] research, Object result, int instability, AspectList aspects, Object input, Object[] recipe) {
if (!(result instanceof ItemStack || result instanceof Object[]))
return null;
InfusionRecipe r = new InfusionRecipe(research, result, instability, aspects, input, recipe);
craftingRecipes.add(r);
return r;
}
Aggregations