ghast-inventory 0.5.6

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
//! The 0.4.1 names of the modern API (`_26_1` aliases of the `_modern` methods), kept for
//! compatibility. Deprecated since 0.5.3: each one forwards to the `_modern` method of the same
//! name, which works for every modern version.

use super::*;

/// The 0.4.1 names of the modern methods (26.1 was the only modern version then); each one is
/// the `_modern` method of the same name and works for every modern version.
#[cfg(modern)]
impl Inventory {
    /// Alias of [`Inventory::set_registries_modern`].
    #[deprecated(since = "0.5.3", note = "use `set_registries_modern`")]
    pub fn set_registries_26_1(&mut self, reg: crate::item26::HashRegistries) {
        self.set_registries_modern(reg);
    }
    /// Alias of [`Inventory::registries_modern`].
    #[deprecated(since = "0.5.3", note = "use `registries_modern`")]
    #[must_use]
    pub fn registries_26_1(&self) -> &crate::item26::HashRegistries {
        self.registries_modern()
    }
    /// Alias of [`Inventory::enchantment_name_modern`].
    #[deprecated(since = "0.5.3", note = "use `enchantment_name_modern`")]
    #[must_use]
    pub fn enchantment_name_26_1(&self, id: i32) -> Option<&str> {
        self.enchantment_name_modern(id)
    }
    /// Alias of [`Inventory::set_creative_modern`].
    #[deprecated(since = "0.5.3", note = "use `set_creative_modern`")]
    pub fn set_creative_26_1(&mut self, creative: bool) {
        self.set_creative_modern(creative);
    }
    /// Alias of [`Inventory::on_update_tags_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_update_tags_modern`")]
    pub fn on_update_tags_26_1(&mut self, body: bytes::Bytes) {
        self.on_update_tags_modern(body);
    }
    /// Alias of [`Inventory::on_registry_data_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_registry_data_modern`")]
    pub fn on_registry_data_26_1(&mut self, body: bytes::Bytes) {
        self.on_registry_data_modern(body);
    }
    /// Alias of [`Inventory::on_mount_screen_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_mount_screen_modern`")]
    pub fn on_mount_screen_26_1(
        &mut self,
        window_id: i32,
        columns: i32,
        entity_type: i32,
        can_saddle: bool,
        can_body: bool,
    ) {
        self.on_mount_screen_modern(window_id, columns, entity_type, can_saddle, can_body);
    }
    /// Alias of [`Inventory::on_merchant_offers_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_merchant_offers_modern`")]
    pub fn on_merchant_offers_26_1(&mut self, body: &bytes::Bytes) {
        self.on_merchant_offers_modern(body);
    }
    /// Alias of [`Inventory::anvil_rename_modern`].
    ///
    /// # Errors
    /// As [`Inventory::anvil_rename_modern`].
    #[deprecated(since = "0.5.3", note = "use `anvil_rename_modern`")]
    pub fn anvil_rename_26_1(&mut self, name: &str) -> Result<Option<Outgoing>, ClickError> {
        self.anvil_rename_modern(name)
    }
    /// Alias of [`Inventory::trident_spin_attack_strength_modern`].
    #[deprecated(since = "0.5.3", note = "use `trident_spin_attack_strength_modern`")]
    pub fn trident_spin_attack_strength_26_1(&mut self, stack: &Stack) -> Option<f32> {
        self.trident_spin_attack_strength_modern(stack)
    }
    /// Alias of [`Inventory::select_loom_pattern_modern`].
    ///
    /// # Errors
    /// As [`Inventory::select_loom_pattern_modern`].
    #[deprecated(since = "0.5.3", note = "use `select_loom_pattern_modern`")]
    pub fn select_loom_pattern_26_1(&mut self, index: i32) -> Result<Option<Outgoing>, ClickError> {
        self.select_loom_pattern_modern(index)
    }
    /// Alias of [`Inventory::select_trade_modern`].
    ///
    /// # Errors
    /// As [`Inventory::select_trade_modern`].
    #[deprecated(since = "0.5.3", note = "use `select_trade_modern`")]
    pub fn select_trade_26_1(&mut self, index: i32) -> Result<Outgoing, ClickError> {
        self.select_trade_modern(index)
    }
    /// Alias of [`Inventory::take_creative_echo_modern`].
    #[deprecated(since = "0.5.3", note = "use `take_creative_echo_modern`")]
    pub fn take_creative_echo_26_1(&mut self) -> Vec<CreativePacket> {
        self.take_creative_echo_modern()
    }
    /// Alias of [`Inventory::creative_screen_modern`].
    #[deprecated(since = "0.5.3", note = "use `creative_screen_modern`")]
    #[must_use]
    pub fn creative_screen_26_1(&self) -> bool {
        self.creative_screen_modern()
    }
    /// Alias of [`Inventory::set_experience_level_modern`].
    #[deprecated(since = "0.5.3", note = "use `set_experience_level_modern`")]
    pub fn set_experience_level_26_1(&mut self, level: i32) {
        self.set_experience_level_modern(level);
    }
    /// Alias of [`Inventory::on_recipes_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_recipes_modern`")]
    pub fn on_recipes_26_1<'a>(
        &mut self,
        sets: impl IntoIterator<Item = (&'a str, &'a [i32])>,
        stonecutter_inputs: Option<Vec<i32>>,
    ) {
        self.on_recipes_modern(sets, stonecutter_inputs);
    }
    /// Alias of [`Inventory::on_open_screen_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_open_screen_modern`")]
    pub fn on_open_screen_26_1(&mut self, id: i32, menu: i32, title: ByteString) {
        self.on_open_screen_modern(id, menu, title);
    }
}

/// The 0.4.1 names of the modern slot packets (they exist in every build, like 0.4.1's).
impl Inventory {
    /// Alias of [`Inventory::on_window_items_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_window_items_modern`")]
    pub fn on_window_items_26_1(
        &mut self,
        window_id: i32,
        state_id: i32,
        items: impl IntoIterator<Item = Option<Stack>>,
        carried: Option<Stack>,
    ) {
        self.on_window_items_modern(window_id, state_id, items, carried);
    }
    /// Alias of [`Inventory::on_set_slot_modern`].
    #[deprecated(since = "0.5.3", note = "use `on_set_slot_modern`")]
    pub fn on_set_slot_26_1(
        &mut self,
        window_id: i32,
        state_id: i32,
        slot: i16,
        item: Option<Stack>,
    ) {
        self.on_set_slot_modern(window_id, state_id, slot, item);
    }
}

impl Window {
    /// Alias of [`Window::menu_modern`].
    #[deprecated(since = "0.5.3", note = "use `menu_modern`")]
    #[must_use]
    pub fn menu_26_1(&self) -> Option<i32> {
        self.menu_modern()
    }
}