mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
26 lines
564 B
Rust
26 lines
564 B
Rust
use crate::entity::player::Player;
|
|
use pumpkin_macros::{Event, cancellable};
|
|
use std::sync::Arc;
|
|
|
|
/// An event that occurs when a player crafts an item.
|
|
#[cancellable]
|
|
#[derive(Event, Clone)]
|
|
pub struct CraftItemEvent {
|
|
/// The player crafting the item.
|
|
pub player: Arc<Player>,
|
|
|
|
/// The recipe identifier.
|
|
pub recipe_id: String,
|
|
}
|
|
|
|
impl CraftItemEvent {
|
|
#[must_use]
|
|
pub const fn new(player: Arc<Player>, recipe_id: String) -> Self {
|
|
Self {
|
|
player,
|
|
recipe_id,
|
|
cancelled: false,
|
|
}
|
|
}
|
|
}
|