classicube_sys/inventory.rs
1use crate::{bindings::*, std_types::c_int};
2
3/// Gets the block at the nth index in the current hotbar.
4pub fn Inventory_Get(idx: c_int) -> BlockID {
5 unsafe { Inventory.Table[(Inventory.Offset + idx) as usize] }
6}
7
8/// Sets the block at the nth index in the current hotbar.
9pub fn Inventory_Set(idx: c_int, block: BlockID) {
10 unsafe {
11 Inventory.Table[(Inventory.Offset + idx) as usize] = block;
12 }
13}
14
15/// Gets the currently selected block.
16pub fn Inventory_SelectedBlock() -> BlockID {
17 unsafe { Inventory_Get(Inventory.SelectedIndex) }
18}