jaredlll08 / ModTweaker

ModTweaker is an addon for CraftTweaker, which provides Integration for an amount of mods.
MIT License
68 stars 63 forks source link

Improve AlchemyTable potion handling, addPotionRecipe. #695

Closed noobanidus closed 5 years ago

noobanidus commented 5 years ago

The alchemy table recipes are actually split between two locations, including the registrar found in the API, and then the more "complex" recipes listed in the AlchemyTableRecipeRegistry.

This means it's impossible to remove the default potions using the current functions, and while it possible to manually add potions using NBT, it wouldn't be possible to use lengthening or power catalysts on them without manually adding recipes.

This commit modifies AlchemyTable.removeRecipe to, if it fails to remove a recipe from the main API registry, consult the AlchemyTableRecipeRegistry and remove from there if necessary.

It also adds a convenience function addPotionRecipe which allows the specification of inputs along with a potion effect, LP cost, tier requirement and tick time, and from this automatically adds potion recipes.

A side-effect of this process involves limiting the number of inputs for addPotionRecipe to 5, as the lengthening/empowering process requires all the original ingredients (with the base flask replaced by the actual potion flask) plus a catalyst.

As always, if there are any issues or coding/coding standard problems please let me know! I'm still relatively new at this.