Skip to main content

ghast_inventory/inventory/
aliases.rs

1//! The 0.4.1 names of the modern API (`_26_1` aliases of the `_modern` methods), kept for
2//! compatibility. Deprecated since 0.5.3: each one forwards to the `_modern` method of the same
3//! name, which works for every modern version.
4
5use super::*;
6
7/// The 0.4.1 names of the modern methods (26.1 was the only modern version then); each one is
8/// the `_modern` method of the same name and works for every modern version.
9#[cfg(modern)]
10impl Inventory {
11    /// Alias of [`Inventory::set_registries_modern`].
12    #[deprecated(since = "0.5.3", note = "use `set_registries_modern`")]
13    pub fn set_registries_26_1(&mut self, reg: crate::item26::HashRegistries) {
14        self.set_registries_modern(reg);
15    }
16    /// Alias of [`Inventory::registries_modern`].
17    #[deprecated(since = "0.5.3", note = "use `registries_modern`")]
18    #[must_use]
19    pub fn registries_26_1(&self) -> &crate::item26::HashRegistries {
20        self.registries_modern()
21    }
22    /// Alias of [`Inventory::enchantment_name_modern`].
23    #[deprecated(since = "0.5.3", note = "use `enchantment_name_modern`")]
24    #[must_use]
25    pub fn enchantment_name_26_1(&self, id: i32) -> Option<&str> {
26        self.enchantment_name_modern(id)
27    }
28    /// Alias of [`Inventory::set_creative_modern`].
29    #[deprecated(since = "0.5.3", note = "use `set_creative_modern`")]
30    pub fn set_creative_26_1(&mut self, creative: bool) {
31        self.set_creative_modern(creative);
32    }
33    /// Alias of [`Inventory::on_update_tags_modern`].
34    #[deprecated(since = "0.5.3", note = "use `on_update_tags_modern`")]
35    pub fn on_update_tags_26_1(&mut self, body: bytes::Bytes) {
36        self.on_update_tags_modern(body);
37    }
38    /// Alias of [`Inventory::on_registry_data_modern`].
39    #[deprecated(since = "0.5.3", note = "use `on_registry_data_modern`")]
40    pub fn on_registry_data_26_1(&mut self, body: bytes::Bytes) {
41        self.on_registry_data_modern(body);
42    }
43    /// Alias of [`Inventory::on_mount_screen_modern`].
44    #[deprecated(since = "0.5.3", note = "use `on_mount_screen_modern`")]
45    pub fn on_mount_screen_26_1(
46        &mut self,
47        window_id: i32,
48        columns: i32,
49        entity_type: i32,
50        can_saddle: bool,
51        can_body: bool,
52    ) {
53        self.on_mount_screen_modern(window_id, columns, entity_type, can_saddle, can_body);
54    }
55    /// Alias of [`Inventory::on_merchant_offers_modern`].
56    #[deprecated(since = "0.5.3", note = "use `on_merchant_offers_modern`")]
57    pub fn on_merchant_offers_26_1(&mut self, body: &bytes::Bytes) {
58        self.on_merchant_offers_modern(body);
59    }
60    /// Alias of [`Inventory::anvil_rename_modern`].
61    ///
62    /// # Errors
63    /// As [`Inventory::anvil_rename_modern`].
64    #[deprecated(since = "0.5.3", note = "use `anvil_rename_modern`")]
65    pub fn anvil_rename_26_1(&mut self, name: &str) -> Result<Option<Outgoing>, ClickError> {
66        self.anvil_rename_modern(name)
67    }
68    /// Alias of [`Inventory::trident_spin_attack_strength_modern`].
69    #[deprecated(since = "0.5.3", note = "use `trident_spin_attack_strength_modern`")]
70    pub fn trident_spin_attack_strength_26_1(&mut self, stack: &Stack) -> Option<f32> {
71        self.trident_spin_attack_strength_modern(stack)
72    }
73    /// Alias of [`Inventory::select_loom_pattern_modern`].
74    ///
75    /// # Errors
76    /// As [`Inventory::select_loom_pattern_modern`].
77    #[deprecated(since = "0.5.3", note = "use `select_loom_pattern_modern`")]
78    pub fn select_loom_pattern_26_1(&mut self, index: i32) -> Result<Option<Outgoing>, ClickError> {
79        self.select_loom_pattern_modern(index)
80    }
81    /// Alias of [`Inventory::select_trade_modern`].
82    ///
83    /// # Errors
84    /// As [`Inventory::select_trade_modern`].
85    #[deprecated(since = "0.5.3", note = "use `select_trade_modern`")]
86    pub fn select_trade_26_1(&mut self, index: i32) -> Result<Outgoing, ClickError> {
87        self.select_trade_modern(index)
88    }
89    /// Alias of [`Inventory::take_creative_echo_modern`].
90    #[deprecated(since = "0.5.3", note = "use `take_creative_echo_modern`")]
91    pub fn take_creative_echo_26_1(&mut self) -> Vec<CreativePacket> {
92        self.take_creative_echo_modern()
93    }
94    /// Alias of [`Inventory::creative_screen_modern`].
95    #[deprecated(since = "0.5.3", note = "use `creative_screen_modern`")]
96    #[must_use]
97    pub fn creative_screen_26_1(&self) -> bool {
98        self.creative_screen_modern()
99    }
100    /// Alias of [`Inventory::set_experience_level_modern`].
101    #[deprecated(since = "0.5.3", note = "use `set_experience_level_modern`")]
102    pub fn set_experience_level_26_1(&mut self, level: i32) {
103        self.set_experience_level_modern(level);
104    }
105    /// Alias of [`Inventory::on_recipes_modern`].
106    #[deprecated(since = "0.5.3", note = "use `on_recipes_modern`")]
107    pub fn on_recipes_26_1<'a>(
108        &mut self,
109        sets: impl IntoIterator<Item = (&'a str, &'a [i32])>,
110        stonecutter_inputs: Option<Vec<i32>>,
111    ) {
112        self.on_recipes_modern(sets, stonecutter_inputs);
113    }
114    /// Alias of [`Inventory::on_open_screen_modern`].
115    #[deprecated(since = "0.5.3", note = "use `on_open_screen_modern`")]
116    pub fn on_open_screen_26_1(&mut self, id: i32, menu: i32, title: ByteString) {
117        self.on_open_screen_modern(id, menu, title);
118    }
119}
120
121/// The 0.4.1 names of the modern slot packets (they exist in every build, like 0.4.1's).
122impl Inventory {
123    /// Alias of [`Inventory::on_window_items_modern`].
124    #[deprecated(since = "0.5.3", note = "use `on_window_items_modern`")]
125    pub fn on_window_items_26_1(
126        &mut self,
127        window_id: i32,
128        state_id: i32,
129        items: impl IntoIterator<Item = Option<Stack>>,
130        carried: Option<Stack>,
131    ) {
132        self.on_window_items_modern(window_id, state_id, items, carried);
133    }
134    /// Alias of [`Inventory::on_set_slot_modern`].
135    #[deprecated(since = "0.5.3", note = "use `on_set_slot_modern`")]
136    pub fn on_set_slot_26_1(
137        &mut self,
138        window_id: i32,
139        state_id: i32,
140        slot: i16,
141        item: Option<Stack>,
142    ) {
143        self.on_set_slot_modern(window_id, state_id, slot, item);
144    }
145}
146
147impl Window {
148    /// Alias of [`Window::menu_modern`].
149    #[deprecated(since = "0.5.3", note = "use `menu_modern`")]
150    #[must_use]
151    pub fn menu_26_1(&self) -> Option<i32> {
152        self.menu_modern()
153    }
154}