Is there a get an exsisting recipe?
Yarden-zamir opened this issue ยท 4 comments
Issue Description:
I want to make a function that receives three items and changes every occurrence of the second one with the third in the first's recipe.
function replaceInRecipe(recipe as IItemStack, from as IItemStack, to as IItemStack){}
is that possible in any way? it would make my life so much easier
You could try using recipes.getRecipesFor(IIngredient output);
That returns a List of IRecipe objects.
These objects have some getters to receive the used ingredients.
Heres a wiki entry for them
http://crafttwaeker-docu.readthedocs.io/en/latest/#Vanilla/Recipes/Crafting/ICraftingRecipe/
Also, note there's a PR currently that might add the functionality to replace certain ingredients in the future.
Thank you, that seems like exactly what i need. I'm gonna keep an eye out for that pr as well
It is, but what is not yet implemented is casting a List to an Array. Try removing as IRecipe[]
.
In a later CrT release lists will have the identifier [baseType]
but that is not yet released
Edit:
Also, it's called ICraftingRecipe
not IRecipe (and you need to import the class, of course)
It seems it's not implemented yet
function replaceInRecipe(recipe as IItemStack, from as IItemStack, to as IItemStack){
val inputRecipes = recipes.getRecipesFor(recipe) as IRecipe[];
for inRec in inputRecipes{
}
}
results in [CHAT] ERROR: [crafttweaker]: Error executing {[99:crafttweaker]: functions.zs}: Not yet implemented