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
use std::ops::{Deref, DerefMut};

use slot_lib::Slot;

use super::Display;

/// An enum of the different available display types
#[repr(u8)]
pub enum DisplayType {
    /// No display type
    None = 0,
    /// In third person in the left hand
    ThirdPersonLeftHand = 1,
    /// In third person in the right hand
    ThirdPersonRightHand = 2,
    /// In first person in the left hand
    FirstPersonLeftHand = 3,
    /// In first person in the right hand
    FirstPersonRightHand = 4,
    /// An the head
    Head = 5,
    /// In the gui
    Gui = 6,
    /// At the ground
    Ground = 7,
    /// Fixed at one place
    Fixed = 8,
}
/// An instance of an item display
pub struct ItemDisplay {
    display: Display,
    /// Slot data of the displayed item
    pub slot: Slot,
    /// display type
    pub display_type: DisplayType,
}
impl Deref for ItemDisplay {
    type Target = Display;

    fn deref(&self) -> &Self::Target {
        &self.display
    }
}
impl DerefMut for ItemDisplay {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.display
    }
}
impl Default for ItemDisplay {
    fn default() -> Self {
        Self {
            display: Display::default(),
            slot: Slot::Empty,
            display_type: DisplayType::None,
        }
    }
}