pub struct CraftingRecipeMatchedEvent {
pub grid: [Option<i32>; 9],
pub grid_size: u8,
pub result: Slot,
}Expand description
A recipe was matched against the current crafting grid contents.
Fired at Process + Post stages on the game bus after the
server has resolved a matching recipe for the grid. Plugins can
mutate result at the Process stage (priority-ordered) to:
- augment the result (bonus count, custom NBT, applied enchantments)
- deny the craft by setting
resulttoSlot::empty()— the player will see no result appear in slot 0
After dispatch the server reads back event.result and writes it
to the player’s CraftingGrid.output, then syncs slot 0 to the
client. Post listeners observe the final (post-mutation) result.
Fields§
§grid: [Option<i32>; 9]Item IDs in the 9 grid slots that produced the match
(None for empty slots).
grid_size: u8Grid dimension: 2 for inventory crafting, 3 for crafting table.
result: SlotThe crafting result. Mutable at Process — plugins layer
modifications by handler priority. Setting this to
Slot::empty() hides the result from the player.
Trait Implementations§
Source§impl Clone for CraftingRecipeMatchedEvent
impl Clone for CraftingRecipeMatchedEvent
Source§fn clone(&self) -> CraftingRecipeMatchedEvent
fn clone(&self) -> CraftingRecipeMatchedEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CraftingRecipeMatchedEvent
impl Debug for CraftingRecipeMatchedEvent
Source§impl Event for CraftingRecipeMatchedEvent
impl Event for CraftingRecipeMatchedEvent
Source§fn is_cancelled(&self) -> bool
fn is_cancelled(&self) -> bool
Whether this event has been cancelled by a Validate handler.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Upcasts to
&mut dyn Any for mutable type-erased dispatch.Auto Trait Implementations§
impl Freeze for CraftingRecipeMatchedEvent
impl RefUnwindSafe for CraftingRecipeMatchedEvent
impl Send for CraftingRecipeMatchedEvent
impl Sync for CraftingRecipeMatchedEvent
impl Unpin for CraftingRecipeMatchedEvent
impl UnsafeUnpin for CraftingRecipeMatchedEvent
impl UnwindSafe for CraftingRecipeMatchedEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more