Class PotionBrewEvent.Pre
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.brewing.PotionBrewEvent
net.neoforged.neoforge.event.brewing.PotionBrewEvent.Pre
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
PotionBrewEvent
public static class PotionBrewEvent.Pre
extends PotionBrewEvent
implements net.neoforged.bus.api.ICancellableEvent
This event is fired before vanilla brewing in a brewing stand takes place.
This allows mods to cancel the vanilla brewing and apply their own custom logic by canceling this event and using setItem(int, ItemStack)
to make any necessary changes to the inventory.
This event is cancellable. If this event is canceled, vanilla brewing is skipped, the
brewing stand brew level event is not fired (which means the brewing sound effect is not played), the
changes made to the brewing stand's inventory through setItem(int, ItemStack) are applied, and the PotionBrewEvent.Post event is fired automatically.
This event is fired on the game event bus, ont the logical server.
-
Nested Class Summary
Nested classes/interfaces inherited from class PotionBrewEvent
PotionBrewEvent.Post, PotionBrewEvent.Pre -
Field Summary
Fields inherited from class PotionBrewEvent
stacks -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class PotionBrewEvent
getItem, getLengthMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Constructor Details
-
Pre
-
-
Method Details
-
setItem
Sets the stored item stack at the given index in the brewing stand's inventory. Changes made through this method are only applied if the event is cancelled.- Parameters:
index- the slot indexstack- the item stack- Throws:
IndexOutOfBoundsException- if the index is negative, or equal or greater than the size of the inventory
-