Views
Actions
Difference between revisions of "Potions/1.16"
(Copy Potions to MC1.16 archive) |
(Copy Potions to MC1.16 archive) |
||
| Line 1: | Line 1: | ||
| − | A <code>Potion</code> is simply a list of <code>Effect</code>s to be applied when used. Each <code>Potion</code> gets applied to every <code>Items#POTION</code>, <code>Items#SPLASH_POTION</code>, <code>Items#LINGERING_POTION</code>, and <code>Items#TIPPED_ARROW</code>. Like effects, potions need to be [[Registration | + | A <code>Potion</code> is simply a list of <code>Effect</code>s to be applied when used. Each <code>Potion</code> gets applied to every <code>Items#POTION</code>, <code>Items#SPLASH_POTION</code>, <code>Items#LINGERING_POTION</code>, and <code>Items#TIPPED_ARROW</code>. Like effects, potions need to be [[Registration/1.16|registered]]. |
== Creating a <code>Potion</code> == | == Creating a <code>Potion</code> == | ||
| Line 14: | Line 14: | ||
| − | [[Category:Game Effects/1.16]] | + | [[Category:Game Effects/1.16|Category:Game Effects]] |
Latest revision as of 04:14, 27 July 2021
A Potion is simply a list of Effects to be applied when used. Each Potion gets applied to every Items#POTION, Items#SPLASH_POTION, Items#LINGERING_POTION, and Items#TIPPED_ARROW. Like effects, potions need to be registered.
Creating a Potion
A Potion requires a passed in list of EffectInstances to apply to the player when the potion is "consumed". There is also a nullable parameter called baseName that can be set if you would like to use the same name for multiple potions (e.g. a SWIFTNESS and LONG_SWIFTNESS entry can be both swiftness potions).
Adding a Brewing Recipe
Brewing Recipes can be added using BrewingRecipeRegistry::addRecipe. The most common constructor takes in an Ingredient input, an Ingredient reactant, and an ItemStack output. This can be registered during FMLCommonSetupEvent.
Important
NBTIngredient instead.Alert
BrewingRecipeRegistry is not thread-safe. It should be called within enqueueWork in the specified parallel dispatch event.