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.

  • Constructor Details

  • Method Details

    • setItem

      public void setItem(int index, ItemStack stack)
      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 index
      stack - the item stack
      Throws:
      IndexOutOfBoundsException - if the index is negative, or equal or greater than the size of the inventory