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 Summary
FieldsModifier and TypeFieldDescriptionprivate final Identifierprivate final @Nullable ServerPlayerprivate final com.mojang.authlib.GameProfile -
Constructor Summary
ConstructorsConstructorDescriptionCustomClickActionEvent(@Nullable ServerPlayer player, com.mojang.authlib.GameProfile profile, Identifier identifier, @Nullable Tag payload) -
Method Summary
Modifier and TypeMethodDescriptionReturns the custom click event's identifier.Returns the custom click event's payload.Returns the player who clicked this custom click event, ornullif it was received during configuration.com.mojang.authlib.GameProfileReturns the profile of the player that sent this custom click action.Methods 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
-
Field Details
-
player
-
profile
private final com.mojang.authlib.GameProfile profile -
identifier
-
payload
-
-
Constructor Details
-
CustomClickActionEvent
@Internal public CustomClickActionEvent(@Nullable ServerPlayer player, com.mojang.authlib.GameProfile profile, Identifier identifier, @Nullable Tag payload)
-
-
Method Details
-
getPlayer
Returns the player who clicked this custom click event, ornullif it was received during configuration.- Returns:
- the player who clicked this custom click event, or
nullif 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
Returns the custom click event's identifier.- Returns:
- the custom click event's identifier
-
getPayload
-