Class endstone::PlayerBucketEvent¶
ClassList > endstone > PlayerBucketEvent
Provides common data for events involving a player's bucket interaction.
#include <endstone/event/player/player_bucket_event.h>
Inherits the following classes: endstone::Cancellable
Inherited by the following classes: endstone::PlayerBucketEmptyEvent, endstone::PlayerBucketFillEvent
Public Functions¶
| Type | Name |
|---|---|
| PlayerBucketEvent (const NotNull< Player > & player, const Nullable< Block > & block, const NotNull< Block > & block_clicked, BlockFace block_face, const ItemType & bucket, std::optional< ItemStack > item_stack, EquipmentSlot hand) |
|
| const Nullable< Block > & | getBlock () const Gets the block involved in this event. |
| const NotNull< Block > & | getBlockClicked () const Gets the block clicked by the player. |
| BlockFace | getBlockFace () const Gets the face on the clicked block. |
| const ItemType & | getBucket () const Gets the bucket used in this event. |
| EquipmentSlot | getHand () const Gets the hand used in this event. |
| const std::optional< ItemStack > & | getItemStack () const Gets the resulting item in the player's hand. |
| void | setItemStack (std::optional< ItemStack > item_stack) Sets the resulting item in the player's hand. |
| ~PlayerBucketEvent () override |
Public Functions inherited from endstone::Cancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () Cancel this event. |
| virtual bool | isCancelled () override const Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) override Sets the cancellation state of this event. |
Public Functions inherited from endstone::ICancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () = 0 Cancels this event. |
| virtual bool | isCancelled () const = 0 Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) = 0 Sets the cancellation state of this event. |
| virtual | ~ICancellable () = default |
Public Functions Documentation¶
function PlayerBucketEvent¶
inline endstone::PlayerBucketEvent::PlayerBucketEvent (
const NotNull < Player > & player,
const Nullable < Block > & block,
const NotNull < Block > & block_clicked,
BlockFace block_face,
const ItemType & bucket,
std::optional< ItemStack > item_stack,
EquipmentSlot hand
)
function getBlock¶
Gets the block involved in this event.
Returns:
the block involved in this event, or a null handle if unavailable
function getBlockClicked¶
Gets the block clicked by the player.
Returns:
the clicked block
function getBlockFace¶
Gets the face on the clicked block.
Returns:
the clicked block face
function getBucket¶
Gets the bucket used in this event.
Returns:
the bucket item type
function getHand¶
Gets the hand used in this event.
Note:
This is always EquipmentSlot::Hand, because Bedrock does not report which hand was used for this interaction.
Returns:
the hand
function getItemStack¶
Gets the resulting item in the player's hand.
Returns:
the resulting item stack, or std::nullopt if unavailable
function setItemStack¶
Sets the resulting item in the player's hand.
Parameters:
item_stackthe item stack to write back after the event, or std::nullopt
function ~PlayerBucketEvent¶
The documentation for this class was generated from the following file include/endstone/event/player/player_bucket_event.h