Class VanillaGameEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.VanillaGameEvent

public class VanillaGameEvent extends net.minecraftforge.eventbus.api.Event
VanillaGameEvent is fired on the server whenever one of Vanilla's GameEvents fire.

This allows for listening to Vanilla's events in a more structured and global way that is not tied to needing a block entity listener.

This event is fired on the MinecraftForge.EVENT_BUS.

Cancel this event to prevent Vanilla from posting the GameEvent to all nearby GameEventListeners.
  • Field Details

    • level

      private final Level level
    • vanillaEvent

      private final GameEvent vanillaEvent
    • position

      private final Vec3 position
    • context

      private final GameEvent.Context context
  • Constructor Details

  • Method Details

    • getLevel

      public Level getLevel()
      Returns:
      The level the Vanilla GameEvent occurred.
    • getCause

      @Nullable public @Nullable Entity getCause()
      Returns:
      The entity that was the source or "cause" of the GameEvent.
    • getVanillaEvent

      public GameEvent getVanillaEvent()
      Returns:
      The Vanilla event.
    • getEventPosition

      public Vec3 getEventPosition()
      Returns:
      The position the event took place at.
    • getContext

      public GameEvent.Context getContext()
      Returns:
      the context of the vanilla event