PotionBrewPre
Link to potionbrewpre
This event is fired directly before vanilla brewing takes place, and, if canceled
, will prevent brewing from taking place. If cancelled but the items are modified, then the PotionBrewPostEvent will be automatically fired. This allows for a simulacrum of "modded" brewing.
Event Class
Link to event-class
You will need to cast the event in the function header as this class:
crafttweaker.event.PotionBrewPreEvent
You can, of course, also import the class before and use that name then.
Event interface extensions
Link to event-interface-extensions
PotionBrewPre Events implement the following interfaces and are able to call all of their methods/getters/setters as well:
ZenGetters/ZenSetters/ZenMethods from extension
Link to zengetterszensetterszenmethods-from-extension
The following information can be retrieved/set during the event:
ZenGetter | ZenSetter | Type |
---|---|---|
ZenGetter length | ZenSetter | Type int |
ZenGetter canceled | ZenSetter canceled | Type bool |
ZenMethods
event.cancel();
Method, returns void (nothing). Can cancel the event and stop something from happeningevent.getItem(int)
returns IItemStack on the given index in the crafting station. Will return an empty IItemStack if the specified index is greater thanlength
.event.setItem(int, IItemStack)
Replaces or sets IItemStack on given index. If the index is greater than the length of the item array, nothing will happen.
Note
Link to note
This event is fired right as the calculations for the recipe are taking place, when the "timer" reaches "maximum progress".