ghast-inventory 0.5.4

Inventory and container windows for the ghast Minecraft Java Edition client library: vanilla client-side click prediction, the window confirm protocol, hashed 26.1 clicks and lazy NBT / data-component item stacks (1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3)
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
//! The per-version table set of the modern (26.x) inventory.
//!
//! The click simulation, the component readers, the hash schemas and the menu logic exist once;
//! everything that differs between modern versions is a table chosen by [`Mv`]: item rows,
//! registry name tables, menu facts, the component kind <-> wire id maps, and the protocol's
//! slot reader. Every accessor is a `match` returning a `&'static` table (code addresses, no
//! pointer table: nothing to relocate at load time), so where the version is a constant (the
//! `window_items` loops) the match folds away.
//!
//! Components are handled as *kinds* ([`kind`]): the 26.1 type ids, then every kind a later
//! version added. A version's wire ids map to kinds by name, computed at compile time from the
//! generated name tables.
//!
//! Adding a version: its generated `items_<v>.rs` / `menus_<v>.rs` (see `examples/`), one
//! `Mv` variant and one arm per accessor below, and `Version` / `PACKET_IDS` rows.

use bytes::Bytes;
use ghast_protocol::DecodeError;
use ghast_protocol::codec::Reader;
use ghast_protocol::types::slot::v775::{ComponentPatch, ItemStack};

use crate::rules::Version;

/// Canonical component kinds (the 26.1 type ids, then later additions).
#[allow(dead_code)]
pub(crate) mod kind {
    include!("generated/component_kinds.rs");
}

#[cfg(feature = "v26_1")]
#[allow(dead_code)]
pub(crate) mod g261 {
    use crate::item26::{Equip, Row};
    include!("generated/items_26_1.rs");
}
#[cfg(feature = "v26_1")]
#[allow(dead_code)]
mod g261m {
    include!("generated/menus_26_1.rs");
}
#[cfg(feature = "v26_2")]
#[allow(dead_code)]
pub(crate) mod g262 {
    use crate::item26::{Equip, Row};
    include!("generated/items_26_2.rs");
}
#[cfg(feature = "v26_2")]
#[allow(dead_code)]
mod g262m {
    include!("generated/menus_26_2.rs");
}
#[cfg(feature = "v26_3")]
#[allow(dead_code)]
pub(crate) mod g263 {
    use crate::item26::{Equip, Row};
    include!("generated/items_26_3.rs");
}
#[cfg(feature = "v26_3")]
#[allow(dead_code)]
mod g263m {
    include!("generated/menus_26_3.rs");
}

// The menu fact bits are the same in every version's table (one generator).
#[cfg(feature = "v26_1")]
pub(crate) use g261m::{
    BANNER, BEACON_PAYMENT, BREWING_FUEL, BREWING_INGREDIENT, FITS_CONTAINER, FUEL, HAS_DYE,
    HAS_PATTERNS, LOOM_DYE_TAG, LOOM_PATTERN_TAG,
};
#[cfg(all(not(feature = "v26_1"), feature = "v26_2"))]
pub(crate) use g262m::{
    BANNER, BEACON_PAYMENT, BREWING_FUEL, BREWING_INGREDIENT, FITS_CONTAINER, FUEL, HAS_DYE,
    HAS_PATTERNS, LOOM_DYE_TAG, LOOM_PATTERN_TAG,
};
#[cfg(not(any(feature = "v26_1", feature = "v26_2")))]
pub(crate) use g263m::{
    BANNER, BEACON_PAYMENT, BREWING_FUEL, BREWING_INGREDIENT, FITS_CONTAINER, FUEL, HAS_DYE,
    HAS_PATTERNS, LOOM_DYE_TAG, LOOM_PATTERN_TAG,
};
#[cfg(all(feature = "v26_1", feature = "v26_2"))]
const _: () = assert!(
    g261m::FUEL == g262m::FUEL
        && g261m::BREWING_INGREDIENT == g262m::BREWING_INGREDIENT
        && g261m::BREWING_FUEL == g262m::BREWING_FUEL
        && g261m::BEACON_PAYMENT == g262m::BEACON_PAYMENT
        && g261m::LOOM_DYE_TAG == g262m::LOOM_DYE_TAG
        && g261m::LOOM_PATTERN_TAG == g262m::LOOM_PATTERN_TAG
        && g261m::BANNER == g262m::BANNER
        && g261m::FITS_CONTAINER == g262m::FITS_CONTAINER
        && g261m::HAS_DYE == g262m::HAS_DYE
        && g261m::HAS_PATTERNS == g262m::HAS_PATTERNS
);
#[cfg(all(feature = "v26_1", feature = "v26_3"))]
const _: () = assert!(
    g261m::FUEL == g263m::FUEL
        && g261m::BREWING_INGREDIENT == g263m::BREWING_INGREDIENT
        && g261m::BREWING_FUEL == g263m::BREWING_FUEL
        && g261m::BEACON_PAYMENT == g263m::BEACON_PAYMENT
        && g261m::LOOM_DYE_TAG == g263m::LOOM_DYE_TAG
        && g261m::LOOM_PATTERN_TAG == g263m::LOOM_PATTERN_TAG
        && g261m::BANNER == g263m::BANNER
        && g261m::FITS_CONTAINER == g263m::FITS_CONTAINER
        && g261m::HAS_DYE == g263m::HAS_DYE
        && g261m::HAS_PATTERNS == g263m::HAS_PATTERNS
);
#[cfg(all(feature = "v26_2", feature = "v26_3"))]
const _: () = assert!(g262m::FUEL == g263m::FUEL && g262m::HAS_PATTERNS == g263m::HAS_PATTERNS);

/// A modern version: which table set the shared code reads.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) enum Mv {
    /// 26.1 (protocol 775).
    #[cfg(feature = "v26_1")]
    V26_1,
    /// 26.2 (protocol 776).
    #[cfg(feature = "v26_2")]
    V26_2,
    /// 26.3 (protocol 777).
    #[cfg(feature = "v26_3")]
    V26_3,
}

/// A generated registry name table (`*_TEXT` + `*_ENDS`).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Names {
    Component,
    Menu,
    Potion,
    Attribute,
    SoundEvent,
    VillagerType,
    MobEffect,
    EntityType,
    BlockEntityType,
}

macro_rules! names_of {
    ($g:ident, $n:expr) => {
        match $n {
            Names::Component => ($g::COMPONENT_NAMES_TEXT, &$g::COMPONENT_NAMES_ENDS[..]),
            Names::Menu => ($g::MENUS_TEXT, &$g::MENUS_ENDS[..]),
            Names::Potion => ($g::POTIONS_TEXT, &$g::POTIONS_ENDS[..]),
            Names::Attribute => ($g::ATTRIBUTES_TEXT, &$g::ATTRIBUTES_ENDS[..]),
            Names::SoundEvent => ($g::SOUND_EVENTS_TEXT, &$g::SOUND_EVENTS_ENDS[..]),
            Names::VillagerType => ($g::VILLAGER_TYPES_TEXT, &$g::VILLAGER_TYPES_ENDS[..]),
            Names::MobEffect => ($g::MOB_EFFECTS_TEXT, &$g::MOB_EFFECTS_ENDS[..]),
            Names::EntityType => ($g::ENTITY_TYPES_TEXT, &$g::ENTITY_TYPES_ENDS[..]),
            Names::BlockEntityType => (
                $g::BLOCK_ENTITY_TYPES_TEXT,
                &$g::BLOCK_ENTITY_TYPES_ENDS[..],
            ),
        }
    };
}

impl Mv {
    /// Some enabled modern version (a placeholder where the version cannot matter).
    #[cfg(feature = "v26_1")]
    pub(crate) const ANY: Mv = Mv::V26_1;
    /// Some enabled modern version (a placeholder where the version cannot matter).
    #[cfg(all(not(feature = "v26_1"), feature = "v26_2"))]
    pub(crate) const ANY: Mv = Mv::V26_2;
    /// Some enabled modern version (a placeholder where the version cannot matter).
    #[cfg(not(any(feature = "v26_1", feature = "v26_2")))]
    pub(crate) const ANY: Mv = Mv::V26_3;

    /// The table set of a version (`None` for the legacy versions and disabled features).
    #[inline]
    pub(crate) const fn of(v: Version) -> Option<Mv> {
        match v {
            #[cfg(feature = "v26_1")]
            Version::V26_1 => Some(Mv::V26_1),
            #[cfg(feature = "v26_2")]
            Version::V26_2 => Some(Mv::V26_2),
            #[cfg(feature = "v26_3")]
            Version::V26_3 => Some(Mv::V26_3),
            _ => None,
        }
    }

    /// Item rows by registry id.
    #[inline]
    pub(crate) fn item_rows(self) -> &'static [crate::item26::Row] {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => &g261::ITEM_ROWS,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => &g262::ITEM_ROWS,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => &g263::ITEM_ROWS,
        }
    }

    /// The strings of the item rows.
    #[inline]
    pub(crate) fn item_text(self) -> &'static str {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => g261::ITEM_TEXT,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => g262::ITEM_TEXT,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => g263::ITEM_TEXT,
        }
    }

    /// A registry name table.
    #[inline]
    pub(crate) fn names(self, n: Names) -> (&'static str, &'static [u32]) {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => names_of!(g261, n),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => names_of!(g262, n),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => names_of!(g263, n),
        }
    }

    /// Name `i` of a registry name table.
    pub(crate) fn name(self, n: Names, i: usize) -> Option<&'static str> {
        let (text, ends) = self.names(n);
        crate::item26::nth(text, ends, i)
    }

    /// The id of `name` in a registry name table.
    pub(crate) fn position(self, n: Names, name: &str) -> Option<usize> {
        let (text, ends) = self.names(n);
        crate::item26::position(text, ends, name)
    }

    /// Menu slot facts by item id.
    #[inline]
    pub(crate) fn menu_facts(self) -> &'static [u16] {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => &g261m::MENU_FACTS,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => &g262m::MENU_FACTS,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => &g263m::MENU_FACTS,
        }
    }

    /// `(item, remainder item, count)` of the items with a crafting remainder, by item id.
    #[inline]
    pub(crate) fn remainders(self) -> &'static [(i32, i32, i32)] {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => &g261m::REMAINDERS,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => &g262m::REMAINDERS,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => &g263m::REMAINDERS,
        }
    }

    /// The wire id of component kind `k` (an unknown kind maps to -1, which no patch holds).
    #[inline]
    pub(crate) fn wire(self, k: i32) -> i32 {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => k,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => usize::try_from(k)
                .ok()
                .and_then(|k| WIRE_OF_KIND_262.get(k))
                .map_or(-1, |&w| if w == NONE { -1 } else { i32::from(w) }),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => usize::try_from(k)
                .ok()
                .and_then(|k| WIRE_OF_KIND_263.get(k))
                .map_or(-1, |&w| if w == NONE { -1 } else { i32::from(w) }),
        }
    }

    /// The kind of wire component id `t` (-1 when out of range).
    #[inline]
    pub(crate) fn kind(self, t: i32) -> i32 {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => t,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => usize::try_from(t)
                .ok()
                .and_then(|t| KIND_OF_WIRE_262.get(t))
                .map_or(-1, |&k| i32::from(k)),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => usize::try_from(t)
                .ok()
                .and_then(|t| KIND_OF_WIRE_263.get(t))
                .map_or(-1, |&k| i32::from(k)),
        }
    }

    /// The name of block registry id `i`.
    pub(crate) fn block_name(self, i: u16) -> Option<&'static str> {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => ghast_data::v26_1::Block::from_id(i).map(|b| b.name()),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => ghast_data::v26_2::Block::from_id(i).map(|b| b.name()),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => ghast_data::v26_3::Block::from_id(i).map(|b| b.name()),
        }
    }

    /// `ItemStack.OPTIONAL_STREAM_CODEC` with a structural component skip.
    #[inline]
    pub(crate) fn read_stack(self, r: &mut Reader<'_>) -> Result<Option<ItemStack>, DecodeError> {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => ItemStack::read(r),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => ItemStack::read_776(r),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => ItemStack::read_777(r),
        }
    }

    /// Skips one `type id + value` component (`DataComponentPatch` entry layout).
    pub(crate) fn skip_component(self, r: &mut Reader<'_>) -> Result<(), DecodeError> {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => ghast_protocol::defs::p775::types::SlotComponent::skip(r),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => ghast_protocol::defs::p776::types::SlotComponent::skip(r),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => ghast_protocol::defs::p777::types::SlotComponent::skip(r),
        }
    }

    /// A component patch body (`added` values, `removed` types) with a structural skip.
    pub(crate) fn read_patch(
        self,
        r: &mut Reader<'_>,
        added: i32,
        removed: i32,
    ) -> Result<ComponentPatch, DecodeError> {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => ComponentPatch::read(r, added, removed),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => ComponentPatch::read_776(r, added, removed),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => ComponentPatch::read_777(r, added, removed),
        }
    }

    /// A patch from wire ids and value bytes.
    pub(crate) fn patch_from_parts(
        self,
        added: &[(i32, &[u8])],
        removed: &[i32],
    ) -> ComponentPatch {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => ComponentPatch::from_parts(added, removed),
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => ComponentPatch::from_parts_776(added, removed),
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => ComponentPatch::from_parts_777(added, removed),
        }
    }

    /// 26.3 or later (the component codecs 26.3 changed).
    #[inline]
    pub(crate) const fn since_26_3(self) -> bool {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => false,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => false,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => true,
        }
    }

    /// Whether the furnace / brewing stand slot rules are data-driven (26.3: fuel and brewing
    /// fuel are components, the brewing slots read recipe property sets and a tag).
    #[inline]
    pub(crate) const fn data_brewing(self) -> bool {
        self.since_26_3()
    }

    /// Whether the merchant result slot only allows a pickup while the active offer is still
    /// paid for by the payment slots (either order); 26.1 / 26.2 allow any pickup.
    #[inline]
    pub(crate) const fn trade_pickup_checks_payment(self) -> bool {
        self.since_26_3()
    }

    /// Whether an arm swing sends a packet (`swing`); 26.3 swings client-side only.
    #[inline]
    pub(crate) const fn swing_packet(self) -> bool {
        match self {
            #[cfg(feature = "v26_1")]
            Mv::V26_1 => true,
            #[cfg(feature = "v26_2")]
            Mv::V26_2 => true,
            #[cfg(feature = "v26_3")]
            Mv::V26_3 => false,
        }
    }

    /// The value of component kind `k` in a patch.
    #[inline]
    pub(crate) fn get(self, p: &ComponentPatch, k: i32) -> Option<Bytes> {
        p.get(self.wire(k))
    }
}

// ------------------------------------------------------------------ kind <-> wire maps

const NONE: u8 = u8::MAX;

const fn same(text: &[u8], start: usize, end: usize, name: &[u8]) -> bool {
    if end - start != name.len() {
        return false;
    }
    let mut i = 0;
    while i < name.len() {
        if text[start + i] != name[i] {
            return false;
        }
        i += 1;
    }
    true
}

/// The kind of each wire id of a version's component name table; fails the build when a name
/// is not a known kind (append it to `generated/component_kinds.rs`).
#[allow(dead_code)]
const fn kinds_of<const N: usize>(text: &str, ends: &[u32; N]) -> [u8; N] {
    assert!(kind::KINDS < NONE as usize);
    let text = text.as_bytes();
    let mut out = [NONE; N];
    let mut i = 0;
    while i < N {
        let start = if i == 0 { 0 } else { ends[i - 1] as usize };
        let end = ends[i] as usize;
        let mut k = 0;
        while k < kind::KINDS {
            if same(text, start, end, kind::KIND_NAMES[k].as_bytes()) {
                out[i] = k as u8;
                break;
            }
            k += 1;
        }
        assert!(
            out[i] != NONE,
            "a component name is missing from component_kinds.rs"
        );
        i += 1;
    }
    out
}

/// The inverse of [`kinds_of`]: the wire id of each kind ([`NONE`] when the version lacks it).
#[allow(dead_code)]
const fn wires_of<const N: usize>(kinds: &[u8; N]) -> [u8; kind::KINDS] {
    let mut out = [NONE; kind::KINDS];
    let mut i = 0;
    while i < N {
        out[kinds[i] as usize] = i as u8;
        i += 1;
    }
    out
}

// 26.1 is the canonical numbering: its map must be the identity.
#[cfg(feature = "v26_1")]
const _: () = {
    let k = kinds_of(g261::COMPONENT_NAMES_TEXT, &g261::COMPONENT_NAMES_ENDS);
    let mut i = 0;
    while i < k.len() {
        assert!(
            k[i] as usize == i,
            "26.1 component ids are the canonical kinds"
        );
        i += 1;
    }
};

#[cfg(feature = "v26_2")]
static KIND_OF_WIRE_262: [u8; g262::COMPONENT_NAMES_ENDS.len()] =
    kinds_of(g262::COMPONENT_NAMES_TEXT, &g262::COMPONENT_NAMES_ENDS);
#[cfg(feature = "v26_2")]
static WIRE_OF_KIND_262: [u8; kind::KINDS] = wires_of(&KIND_OF_WIRE_262);

#[cfg(feature = "v26_3")]
static KIND_OF_WIRE_263: [u8; g263::COMPONENT_NAMES_ENDS.len()] =
    kinds_of(g263::COMPONENT_NAMES_TEXT, &g263::COMPONENT_NAMES_ENDS);
#[cfg(feature = "v26_3")]
static WIRE_OF_KIND_263: [u8; kind::KINDS] = wires_of(&KIND_OF_WIRE_263);

#[cfg(all(test, feature = "v26_2"))]
mod tests {
    use super::*;

    #[test]
    fn kinds_26_2() {
        // sulfur_cube_content was inserted at 78: later ids moved up by one
        assert_eq!(Mv::V26_2.wire(kind::SULFUR_CUBE_CONTENT), 78);
        assert_eq!(Mv::V26_2.kind(78), kind::SULFUR_CUBE_CONTENT);
        assert_eq!(Mv::V26_2.wire(kind::BEES), 77);
        assert_eq!(Mv::V26_2.wire(kind::LOCK), 79);
        assert_eq!(Mv::V26_2.wire(kind::SHULKER_COLOR), 110);
        for t in 0..111 {
            assert_eq!(Mv::V26_2.wire(Mv::V26_2.kind(t)), t);
            assert_eq!(
                Mv::V26_2.name(Names::Component, t as usize),
                Some(kind::KIND_NAMES[Mv::V26_2.kind(t) as usize])
            );
        }
        assert_eq!(Mv::V26_2.kind(111), -1);
    }
}

#[cfg(all(test, feature = "v26_3"))]
mod tests_26_3 {
    use super::*;

    #[test]
    fn kinds_26_3() {
        let n = Mv::V26_3.names(Names::Component).1.len();
        assert_eq!(n, 122);
        for t in 0..n as i32 {
            assert_eq!(Mv::V26_3.wire(Mv::V26_3.kind(t)), t);
            assert_eq!(
                Mv::V26_3.name(Names::Component, t as usize),
                Some(kind::KIND_NAMES[Mv::V26_3.kind(t) as usize])
            );
        }
        assert_eq!(Mv::V26_3.kind(n as i32), -1);
        // removed in 26.3
        assert_eq!(Mv::V26_3.wire(kind::SWING_ANIMATION), -1);
        assert_eq!(Mv::V26_3.wire(kind::MAP_COLOR), -1);
        assert!(Mv::V26_3.wire(kind::COOKING_FUEL) >= 0);
    }
}