ghast-client 0.2.1

Headless Minecraft Java Edition client for the ghast library: connection, login, fixed 50 ms tick loop and a version-agnostic bot API (1.8.9 and 1.16.5)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
//! The version-agnostic layer: what the client core receives from and sends to the server,
//! independent of the protocol version.
//!
//! Each supported version (see [`crate::version`]) maps its generated packets to [`Inbound`]
//! and [`Outbound`] values. Only the packets the core or the behaviour needs are mapped; the
//! rest is dropped by the frame decoder's filter before it is decoded.

use bytes::Bytes;
use ghast_protocol::types::ByteString;
use uuid::Uuid;

/// A position or direction in world space.
#[derive(Debug, Clone, Copy, Default, PartialEq)]
pub struct Vec3 {
    /// East (+) / west (−).
    pub x: f64,
    /// Up (+) / down (−).
    pub y: f64,
    /// South (+) / north (−).
    pub z: f64,
}

impl Vec3 {
    /// A vector from its components.
    #[must_use]
    pub const fn new(x: f64, y: f64, z: f64) -> Self {
        Vec3 { x, y, z }
    }
}

/// The player's pose: feet position, look, motion and movement flags.
///
/// `yaw` / `pitch` are degrees in vanilla's convention (yaw is an unbounded `f32` like the
/// client's `Entity.yaw`; 0 = south, 90 = west; pitch 90 = straight down).
#[derive(Debug, Clone, Copy, Default, PartialEq)]
pub struct Pose {
    /// Feet position (bounding box minimum Y).
    pub pos: Vec3,
    /// Yaw in degrees.
    pub yaw: f32,
    /// Pitch in degrees.
    pub pitch: f32,
    /// Motion per tick.
    pub motion: Vec3,
    /// On ground as the client computes it (and sends it).
    pub on_ground: bool,
    /// Creative / ability flight.
    pub flying: bool,
    /// Sneaking (as sent with `entity_action`).
    pub sneaking: bool,
    /// Sprinting (as sent with `entity_action`).
    pub sprinting: bool,
}

impl Pose {
    /// Eye position: feet + 1.62 (1.54 while sneaking in 1.8; 1.16.5 uses a crouching pose
    /// with eyes at 1.27, see [`crate::GameVersion::sneak_eye_height`]).
    #[must_use]
    pub fn eyes(&self, eye_height: f64) -> Vec3 {
        Vec3::new(self.pos.x, self.pos.y + eye_height, self.pos.z)
    }
}

/// Movement keys held for the next movement step (the keyboard state in vanilla).
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct Controls {
    /// Walk forward (W).
    pub forward: bool,
    /// Walk backward (S).
    pub back: bool,
    /// Strafe left (A).
    pub left: bool,
    /// Strafe right (D).
    pub right: bool,
    /// Jump (space).
    pub jump: bool,
    /// Sneak (shift).
    pub sneak: bool,
    /// Sprint key (ctrl).
    pub sprint: bool,
}

impl Controls {
    /// No key held.
    pub const NONE: Controls = Controls {
        forward: false,
        back: false,
        left: false,
        right: false,
        jump: false,
        sneak: false,
        sprint: false,
    };
}

/// Where a chat message is shown.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ChatPosition {
    /// A player chat message.
    Chat,
    /// A system message (command feedback, server announcements).
    System,
    /// The action bar above the hotbar.
    ActionBar,
    /// A value this client does not know.
    Other(i8),
}

impl ChatPosition {
    /// From the wire byte (same values in every supported version).
    #[must_use]
    pub fn from_wire(v: i8) -> Self {
        match v {
            0 => Self::Chat,
            1 => Self::System,
            2 => Self::ActionBar,
            v => Self::Other(v),
        }
    }
}

/// A chat message from the server. The text stays raw JSON until asked for.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct ChatMessage {
    /// The chat component as the server sent it (JSON).
    pub json: ByteString,
    /// Where it is shown.
    pub position: ChatPosition,
    /// Sender UUID (1.16+; `None` on 1.8 and for system messages with the nil UUID).
    pub sender: Option<Uuid>,
}

impl ChatMessage {
    /// The message as plain text, with legacy `§` formatting codes kept.
    #[must_use]
    pub fn text(&self) -> String {
        ghast_protocol::chat::to_plain_text(&self.json)
    }

    /// The message as plain text without `§` formatting codes.
    #[must_use]
    pub fn plain(&self) -> String {
        ghast_protocol::chat::strip_formatting(&self.text())
    }
}

/// Converts a chat component (JSON) to plain text without formatting codes.
#[must_use]
pub fn chat_to_plain(json: &str) -> String {
    ghast_protocol::chat::strip_formatting(&ghast_protocol::chat::to_plain_text(json))
}

/// Game mode.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum GameMode {
    /// Survival.
    #[default]
    Survival,
    /// Creative.
    Creative,
    /// Adventure.
    Adventure,
    /// Spectator.
    Spectator,
    /// A value this client does not know.
    Other(u8),
}

impl GameMode {
    /// From the wire value (the hardcore bit 0x08 of 1.8 is ignored).
    #[must_use]
    pub fn from_wire(v: u8) -> Self {
        match v & 0x07 {
            0 => Self::Survival,
            1 => Self::Creative,
            2 => Self::Adventure,
            3 => Self::Spectator,
            _ => Self::Other(v),
        }
    }
}

/// Player abilities (`abilities` packet).
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub struct Abilities {
    /// Raw flags: 1 invulnerable, 2 flying, 4 may fly, 8 creative (instant break).
    pub flags: i8,
    /// Flying speed (0.05 by default).
    pub flying_speed: f32,
    /// Walking speed (0.1 by default).
    pub walking_speed: f32,
}

impl Default for Abilities {
    fn default() -> Self {
        Abilities {
            flags: 0,
            flying_speed: 0.05,
            walking_speed: 0.1,
        }
    }
}

impl Abilities {
    /// The server allows flight.
    #[must_use]
    pub fn may_fly(&self) -> bool {
        self.flags & 4 != 0
    }

    /// The server says the player is flying.
    #[must_use]
    pub fn flying(&self) -> bool {
        self.flags & 2 != 0
    }
}

/// Health, food and saturation (`update_health`).
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub struct Health {
    /// Health points (20 = full; ≤ 0 = dead).
    pub health: f32,
    /// Food level 0 … 20.
    pub food: i32,
    /// Food saturation.
    pub saturation: f32,
}

impl Default for Health {
    fn default() -> Self {
        Health {
            health: 20.0,
            food: 20,
            saturation: 5.0,
        }
    }
}

/// Relative-teleport flag bits of the server's position packet.
pub mod teleport_flags {
    /// X is relative.
    pub const X: i8 = 0x01;
    /// Y is relative.
    pub const Y: i8 = 0x02;
    /// Z is relative.
    pub const Z: i8 = 0x04;
    /// Yaw is relative.
    pub const YAW: i8 = 0x08;
    /// Pitch is relative.
    pub const PITCH: i8 = 0x10;
}

/// A server teleport (position packet), before it is applied to the pose.
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub struct Teleport {
    /// X (absolute or relative, see `flags`).
    pub x: f64,
    /// Y.
    pub y: f64,
    /// Z.
    pub z: f64,
    /// Yaw.
    pub yaw: f32,
    /// Pitch.
    pub pitch: f32,
    /// [`teleport_flags`] bits.
    pub flags: i8,
    /// Teleport id to confirm (1.9+).
    pub teleport_id: Option<i32>,
}

/// Login-state packets from the server, common to every version.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum LoginInbound {
    /// The server refused the login (chat JSON).
    Disconnect(ByteString),
    /// Online mode: the server asks for encryption.
    EncryptionRequest {
        /// Server id (usually empty) for the session hash.
        server_id: ByteString,
        /// The server's RSA public key (DER).
        public_key: Bytes,
        /// Token to encrypt and send back.
        verify_token: Bytes,
    },
    /// Compression starts with the next packet.
    Compress(i32),
    /// Login finished; the connection is in the play state.
    Success {
        /// The player's UUID as the server assigned it.
        uuid: Option<Uuid>,
        /// The player's name.
        username: ByteString,
    },
    /// A login plugin request (1.13+): answered with "not understood".
    PluginRequest {
        /// Message id to answer.
        message_id: i32,
        /// Channel name.
        channel: ByteString,
    },
}

/// Static information from the join game packet.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct JoinGame {
    /// The player's entity id.
    pub entity_id: i32,
    /// Game mode.
    pub game_mode: GameMode,
    /// Dimension: the 1.8 id (−1 nether, 0 overworld, 1 end) as a string, or the 1.16 world
    /// name (e.g. `minecraft:overworld`).
    pub dimension: String,
    /// Hardcore world.
    pub hardcore: bool,
    /// 1.16: the dimension codec and dimension type NBT, kept raw (not parsed).
    pub dimension_nbt: Option<(ghast_protocol::nbt::RawNbt, ghast_protocol::nbt::RawNbt)>,
    /// 1.16: the respawn screen is shown (false = immediate respawn gamerule).
    pub respawn_screen: bool,
}

/// Clientbound play packets the core understands, common to every version.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Inbound {
    /// Keep-alive to echo.
    KeepAlive(i64),
    /// Join game (also sent again on a proxy server switch).
    JoinGame(JoinGame),
    /// Respawn / dimension change.
    Respawn {
        /// Dimension key (see [`JoinGame::dimension`]).
        dimension: String,
        /// Game mode after the respawn.
        game_mode: GameMode,
    },
    /// Server teleport / position correction.
    Teleport(Teleport),
    /// Chat message.
    Chat(ChatMessage),
    /// The server ends the session (chat JSON).
    Disconnect(ByteString),
    /// Health, food and saturation.
    Health(Health),
    /// Abilities.
    Abilities(Abilities),
    /// The server selects a hotbar slot.
    HeldSlot(i8),
    /// Game state change (`reason`, `value`), e.g. reason 3 = game mode.
    GameState {
        /// Reason id (same numbering in all supported versions).
        reason: u8,
        /// Value.
        value: f32,
    },
    /// Window confirm transaction.
    Transaction {
        /// Window id.
        window_id: i8,
        /// Action number.
        action: i16,
        /// Accepted.
        accepted: bool,
    },
    /// A window opened.
    OpenWindow(i32),
    /// The open window was closed by the server.
    CloseWindow(i32),
    /// Compression threshold change in the play state (1.8).
    SetCompression(i32),
    /// Entity velocity (blocks per tick; the wire's 1/8000 units converted).
    Velocity {
        /// The entity.
        entity_id: i32,
        /// Motion per tick.
        motion: Vec3,
    },
    /// The player motion an explosion adds.
    ExplosionPush(Vec3),
    /// Movement speed attribute of an entity (entity properties packet).
    MovementSpeed {
        /// The entity.
        entity_id: i32,
        /// Base value.
        base: f64,
        /// Modifiers `(uuid, amount, operation)` in packet order.
        modifiers: Vec<(Uuid, f64, i8)>,
    },
    /// A status effect was applied to an entity.
    Effect {
        /// The entity.
        entity_id: i32,
        /// Effect id.
        id: i8,
        /// Amplifier (level − 1).
        amplifier: i8,
    },
    /// A status effect ended.
    EffectRemoved {
        /// The entity.
        entity_id: i32,
        /// Effect id.
        id: i8,
    },
    /// Entity status (e.g. 9 = our item use finished).
    EntityStatus {
        /// The entity.
        entity_id: i32,
        /// Status id.
        status: i8,
    },
    /// An entity (the player, if it is our id) died (1.16 `combat_event` "entity dead").
    Died {
        /// The dead player's entity id.
        entity_id: i32,
    },
}

/// Sneak / sprint `entity_action` values.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum EntityAction {
    /// Start sneaking.
    StartSneaking,
    /// Stop sneaking.
    StopSneaking,
    /// Start sprinting.
    StartSprinting,
    /// Stop sprinting.
    StopSprinting,
}

/// The one movement packet of a tick.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum MovePacket {
    /// `flying` (C03): only on-ground.
    Flying {
        /// On ground.
        on_ground: bool,
    },
    /// `position` (C04).
    Position {
        /// Feet position.
        pos: Vec3,
        /// On ground.
        on_ground: bool,
    },
    /// `look` (C05).
    Look {
        /// Yaw.
        yaw: f32,
        /// Pitch.
        pitch: f32,
        /// On ground.
        on_ground: bool,
    },
    /// `position_look` (C06).
    PositionLook {
        /// Feet position.
        pos: Vec3,
        /// Yaw.
        yaw: f32,
        /// Pitch.
        pitch: f32,
        /// On ground.
        on_ground: bool,
    },
}

impl MovePacket {
    /// The 1.8 trace name (`C03` … `C06`).
    #[must_use]
    pub fn trace_id(&self) -> &'static str {
        match self {
            Self::Flying { .. } => "C03",
            Self::Position { .. } => "C04",
            Self::Look { .. } => "C05",
            Self::PositionLook { .. } => "C06",
        }
    }
}

/// Client settings (`settings` packet), sent right after join game like vanilla.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct ClientSettings {
    /// Locale, e.g. `en_US` (1.8) / `en_us` (1.16).
    pub locale: String,
    /// View distance in chunks.
    pub view_distance: i8,
    /// Chat visibility: 0 full, 1 commands only, 2 hidden.
    pub chat_mode: i8,
    /// Chat colours.
    pub chat_colors: bool,
    /// Displayed skin parts (bit mask; 0x7f = all).
    pub skin_parts: u8,
    /// Main hand (1.9+): 0 left, 1 right.
    pub main_hand: i32,
}

impl ClientSettings {
    /// The locale, e.g. `en_US` (1.8) / `en_us` (1.16).
    #[must_use]
    pub fn with_locale(mut self, locale: impl Into<String>) -> Self {
        self.locale = locale.into();
        self
    }

    /// The view distance in chunks.
    #[must_use]
    pub const fn with_view_distance(mut self, chunks: i8) -> Self {
        self.view_distance = chunks;
        self
    }

    /// Chat visibility: 0 full, 1 commands only, 2 hidden.
    #[must_use]
    pub const fn with_chat_mode(mut self, mode: i8) -> Self {
        self.chat_mode = mode;
        self
    }

    /// Chat colours.
    #[must_use]
    pub const fn with_chat_colors(mut self, on: bool) -> Self {
        self.chat_colors = on;
        self
    }

    /// Displayed skin parts (bit mask; 0x7f = all).
    #[must_use]
    pub const fn with_skin_parts(mut self, mask: u8) -> Self {
        self.skin_parts = mask;
        self
    }

    /// Main hand (1.9+): 0 left, 1 right.
    #[must_use]
    pub const fn with_main_hand(mut self, hand: i32) -> Self {
        self.main_hand = hand;
        self
    }
}

impl Default for ClientSettings {
    fn default() -> Self {
        ClientSettings {
            locale: "en_US".to_owned(),
            view_distance: 8,
            chat_mode: 0,
            chat_colors: true,
            skin_parts: 0x7f,
            main_hand: 1,
        }
    }
}

/// A block face, as in the dig / place packets.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Face {
    /// −Y (0).
    Down,
    /// +Y (1).
    Up,
    /// −Z (2).
    North,
    /// +Z (3).
    South,
    /// −X (4).
    West,
    /// +X (5).
    East,
}

impl Face {
    /// The wire value 0 … 5.
    #[must_use]
    pub const fn id(self) -> i8 {
        match self {
            Face::Down => 0,
            Face::Up => 1,
            Face::North => 2,
            Face::South => 3,
            Face::West => 4,
            Face::East => 5,
        }
    }

    /// From the wire value.
    #[must_use]
    pub const fn from_id(id: i8) -> Option<Face> {
        Some(match id {
            0 => Face::Down,
            1 => Face::Up,
            2 => Face::North,
            3 => Face::South,
            4 => Face::West,
            5 => Face::East,
            _ => return None,
        })
    }

    /// The neighbouring block in this direction.
    #[must_use]
    pub const fn offset(self, p: ghast_protocol::BlockPos) -> ghast_protocol::BlockPos {
        let (x, y, z) = match self {
            Face::Down => (0, -1, 0),
            Face::Up => (0, 1, 0),
            Face::North => (0, 0, -1),
            Face::South => (0, 0, 1),
            Face::West => (-1, 0, 0),
            Face::East => (1, 0, 0),
        };
        ghast_protocol::BlockPos::new(p.x + x, p.y + y, p.z + z)
    }
}

/// The `use_entity` action.
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum EntityUse {
    /// Right click (0).
    Interact,
    /// Left click (1).
    Attack,
    /// Right click at a point relative to the entity position (2).
    InteractAt(Vec3),
}

/// `block_dig` status values used by the client.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum DigStatus {
    /// Start destroying a block (0).
    Start,
    /// Abort destroying (1).
    Abort,
    /// Finish destroying (2).
    Finish,
    /// Release the used item: stop eating / blocking / drawing (5).
    ReleaseUseItem,
}

impl DigStatus {
    /// The wire value.
    #[must_use]
    pub const fn id(self) -> i32 {
        match self {
            DigStatus::Start => 0,
            DigStatus::Abort => 1,
            DigStatus::Finish => 2,
            DigStatus::ReleaseUseItem => 5,
        }
    }
}

/// Serverbound play packets the core writes, common to every version.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Outbound {
    /// Keep-alive answer.
    KeepAlive(i64),
    /// Teleport confirm (1.9+; never produced for 1.8).
    TeleportConfirm(i32),
    /// The movement packet.
    Move(MovePacket),
    /// Sneak / sprint change.
    EntityAction {
        /// Our entity id.
        entity_id: i32,
        /// The action.
        action: EntityAction,
    },
    /// Chat line or command (already truncated to the version's limit).
    Chat(String),
    /// Respawn request (client command "perform respawn").
    Respawn,
    /// Window confirm transaction answer.
    Transaction {
        /// Window id.
        window_id: i8,
        /// Action number.
        action: i16,
        /// Accepted.
        accepted: bool,
    },
    /// Abilities (sent when the client toggles flight).
    Abilities {
        /// Flags (1 invulnerable, 2 flying, 4 may fly, 8 creative).
        flags: i8,
        /// Flying speed.
        flying_speed: f32,
        /// Walking speed.
        walking_speed: f32,
    },
    /// Select a hotbar slot (0 … 8).
    HeldSlot(i16),
    /// Arm swing (main hand).
    Swing,
    /// `block_dig`.
    Dig {
        /// Status.
        status: DigStatus,
        /// Block.
        pos: ghast_protocol::BlockPos,
        /// Face.
        face: Face,
    },
    /// `block_place` on a block face (1.8 with the held stack; 1.16 main hand).
    Place {
        /// The block clicked.
        pos: ghast_protocol::BlockPos,
        /// The face clicked.
        face: Face,
        /// Hit point relative to the block (floats, 0 … 1).
        cursor: Vec3,
        /// The held stack (1.8 sends it; vanilla servers / Grim compare it with the hand).
        held: Option<ghast_inventory::Stack>,
        /// 1.9+: the off hand.
        off_hand: bool,
    },
    /// Use the held item (1.8 `block_place` at −1/−1/−1 face 255 with the held stack; 1.16
    /// `use_item`).
    UseItem {
        /// The held stack.
        held: Option<ghast_inventory::Stack>,
        /// 1.9+: the off hand.
        off_hand: bool,
    },
    /// 1.9+: off-hand arm swing.
    SwingOffHand,
    /// `use_entity`: attack or interact with an entity.
    UseEntity {
        /// The entity.
        target: i32,
        /// What to do.
        action: EntityUse,
        /// 1.9+: the off hand (interactions).
        off_hand: bool,
        /// 1.16: the sneak key is held.
        sneaking: bool,
    },
    /// Client settings.
    Settings(ClientSettings),
    /// A packet of the inventory (window click, confirm answer, close, open inventory).
    Inventory(ghast_inventory::Outgoing),
    /// The client brand plugin message (`MC|Brand` on 1.8, `minecraft:brand` on 1.13+).
    Brand(String),
}