1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{bindings::*, std_types::c_int};

/// Gets the block at the nth index in the current hotbar.
pub fn Inventory_Get(idx: c_int) -> BlockID {
    unsafe { Inventory.Table[(Inventory.Offset + idx) as usize] }
}

/// Sets the block at the nth index in the current hotbar.
pub fn Inventory_Set(idx: c_int, block: BlockID) {
    unsafe {
        Inventory.Table[(Inventory.Offset + idx) as usize] = block;
    }
}

/// Gets the currently selected block.
pub fn Inventory_SelectedBlock() -> BlockID {
    unsafe { Inventory_Get(Inventory.SelectedIndex) }
}