Skip to main content

RecipesClientHost

Trait RecipesClientHost 

pub trait RecipesClientHost {
    // Provided methods
    fn panel_items(&mut self, mod_id: &str, items: Vec<Stack>) { ... }
    fn place_recipe(&mut self, book_id: i32, all: bool) -> Result<(), String> { ... }
    fn transfer_recipe(&mut self, book_id: i32) { ... }
    fn transfer_recipe_check(
        &mut self,
        book_id: i32,
    ) -> Option<RecipeTransferCheck> { ... }
}
Expand description

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

Provided Methods§

fn panel_items(&mut self, mod_id: &str, items: Vec<Stack>)

Side: client. Shows the panel beside container screens with these items (at most 8192), as the game’s own slots in pages, with a search box; the player’s clicks, searches and keys over items come back as native_panel_event. The panel is the last mod’s to show one; empty items and no recipe page take yours away.

fn place_recipe(&mut self, book_id: i32, all: bool) -> Result<(), String>

Side: client. Places a recipe in the open screen’s grid as a click in the recipe book does (ServerboundPlaceRecipePacket): the inventory’s grid or a crafting table’s. all places as many as the items allow, as with Shift. Refused while no such screen is open and for a recipe the player’s book doesn’t hold; one missing items shows as a ghost.

fn transfer_recipe(&mut self, book_id: i32)

Side: client. Move available ingredients for a viewer recipe into the open crafting grid, without requiring the recipe to be learned. The screen shows any refusal.

fn transfer_recipe_check(&mut self, book_id: i32) -> Option<RecipeTransferCheck>

Side: client. What transfer_recipe(book_id) would do now, worked out by the server without moving anything: the player’s inventory, the grid and every container a mod lends the grid’s recipes (a crafting station’s chests, which the client can’t see) counted. For a viewer’s “+”, to mark the inputs it lacks. The first call for a recipe asks and returns None; the answer comes a moment later and is kept for that recipe while the menu, the inventory and the grid stay as they were; while it is still wanted it is asked again every two seconds, at most fifteen times for one state of the menu. None outside a screen that takes transfer_recipe and on a server that doesn’t answer it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§