Class CustomClickActionEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.player.CustomClickActionEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class CustomClickActionEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.ICancellableEvent

Fired when a component's custom click action is triggered by a player. This may be due to clicking a sign, or a component in a dialog box or screen.

If an event handler receives this and performs its own custom action, that event handler must cancel this event.

During the configuration phase, the player is not yet in the world, so getProfile() must be used to obtain sender context.

This event is fired only on the logical server.

This event is cancelable. If canceled, vanilla's processing of the custom click payload is skipped.

  • Field Details

  • Constructor Details

  • Method Details

    • getPlayer

      public @Nullable ServerPlayer getPlayer()
      Returns the player who clicked this custom click event, or null if it was received during configuration.
      Returns:
      the player who clicked this custom click event, or null if it was received during configuration
    • getProfile

      public com.mojang.authlib.GameProfile getProfile()
      Returns the profile of the player that sent this custom click action.
      Returns:
      the profile of the player that sent this custom click action
    • getIdentifier

      public Identifier getIdentifier()
      Returns the custom click event's identifier.
      Returns:
      the custom click event's identifier
    • getPayload

      public @Nullable Tag getPayload()
      Returns the custom click event's payload.
      Returns:
      the custom click event's payload