yog_event/container.rs
1//! Containers opened and closed.
2
3use yog_data::Schema;
4
5pub mod machine;
6
7/// Fired when a player opens a container screen.
8///
9/// - `Pre` — return `false` to prevent the screen from opening.
10/// - `Post` — screen opened; `container_type` is set.
11#[derive(Debug, Clone, Schema)]
12pub struct Open {
13 pub player_name: String,
14 pub player_uuid: String,
15 /// Screen handler registry id, e.g. `"minecraft:chest"`.
16 /// Empty string for screens not in the registry (e.g. the player inventory).
17 pub container_type: String,
18 pub dimension: String,
19}
20
21/// Fired when a player closes a container screen (Post only).
22#[derive(Debug, Clone, Schema)]
23pub struct Close {
24 pub player_name: String,
25 pub player_uuid: String,
26 pub dimension: String,
27}