yog_event/client/input.rs
1//! What the player presses.
2
3use yog_data::Schema;
4
5/// Fired on every key press, release, or repeat (client-side).
6///
7/// Return `false` in the handler to prevent Minecraft from processing the key.
8#[derive(Debug, Clone, Schema)]
9pub struct Key {
10 /// GLFW key code (e.g. 69 = E). See `org.lwjgl.glfw.GLFW`.
11 pub key_code: i32,
12 pub scan_code: i32,
13 /// 0 = release, 1 = press, 2 = repeat.
14 pub action: i32,
15 /// Modifier bitmask: 1=Shift, 2=Ctrl, 4=Alt, 8=Super.
16 pub modifiers: i32,
17}
18
19/// A mod's key binding pressed; keyed by its id (`mymod:xray`).
20#[derive(Debug, Clone, Schema)]
21pub struct Binding {
22 pub id: String,
23}
24
25/// The mouse wheel turned in the world (no screen open). Before: a handler
26/// that cancels it keeps the game from changing the hotbar slot — a held
27/// item that's scrolled itself.
28#[derive(Debug, Clone, Schema)]
29pub struct Scroll {
30 /// Notches turned: up positive.
31 pub delta: f64,
32}