Skip to main content

ItemsClientHost

Trait ItemsClientHost 

pub trait ItemsClientHost {
    // Provided methods
    fn give(&mut self, item: ItemKey, count: u32) -> Result<(), String> { ... }
    fn enchantments(&self) -> Vec<EnchantmentInfo> { ... }
    fn enchantment_min_cost(&self, id: &str, level: u32) -> Option<i32> { ... }
    fn enchantment_supports(&self, id: &str, item: ItemKey) -> bool { ... }
}
Expand description

The client host’s methods of the items area, implemented by the game and reached through crate::ClientHost.

Provided Methods§

fn give(&mut self, item: ItemKey, count: u32) -> Result<(), String>

Side: client. Creative mode only: gives the player count of item (minecraft:diamond) as taking it from the creative inventory does (ServerboundSetCreativeModeSlot): the selected slot first, then the hotbar, then the inventory. The count is cut to one stack.

fn enchantments(&self) -> Vec<EnchantmentInfo>

Side: client. Registered enchantments, in registry order.

fn enchantment_min_cost(&self, id: &str, level: u32) -> Option<i32>

Side: client. Enchantment.getMinCost(level): the enchanting power needed, or None for an unknown id.

fn enchantment_supports(&self, id: &str, item: ItemKey) -> bool

Side: client. Whether enchantment id can go on item (Enchantment.isSupportedItem).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§