pub struct ContainerClosedEvent {
pub window_id: u8,
pub inventory_type: InventoryType,
pub backing: ContainerBacking,
pub reason: CloseReason,
pub viewer_count: u32,
pub crafting_grid_state: Option<[Slot; 9]>,
}Expand description
Fires BEFORE the OpenContainer component is removed from the player.
Non-cancellable. Fires during the Post stage.
Fields§
§window_id: u8Window ID that is being closed.
inventory_type: InventoryTypeThe inventory type.
backing: ContainerBackingHow the container was backed.
reason: CloseReasonWhy the container is closing.
viewer_count: u32Number of remaining viewers on the same block-backed container
excluding the closing player. 0 for Virtual backings.
Used by ContainerPlugin to broadcast the chest-lid close
animation with the right remaining-viewer count (action
param 0 closes the lid completely).
crafting_grid_state: Option<[Slot; 9]>Snapshot of the player’s CraftingGrid slots at the moment of
close, populated only when inventory_type == InventoryType::Crafting (3x3 crafting table). The server has
already reset the grid to 2x2 by the time this event fires —
plugins use the snapshot to spawn dropped items.
None for any non-crafting close.
Trait Implementations§
Source§impl Clone for ContainerClosedEvent
impl Clone for ContainerClosedEvent
Source§fn clone(&self) -> ContainerClosedEvent
fn clone(&self) -> ContainerClosedEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContainerClosedEvent
impl Debug for ContainerClosedEvent
Source§impl Event for ContainerClosedEvent
impl Event for ContainerClosedEvent
Source§fn is_cancelled(&self) -> bool
fn is_cancelled(&self) -> bool
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
&mut dyn Any for mutable type-erased dispatch.