Expand description
A declarative builder for assembling MenuBehaviors.
use steel_registry::{vanilla_items, vanilla_menu_types};
use steel_core::{inventory::menu::kinds::BasicKind, player::player_inventory::PlayerInventory};
use steel_core::inventory::prelude::*;
fn example(container_id: u8, inventory: Shared<PlayerInventory>) -> Menu {
let mut builder = MenuBuilder::new(&vanilla_menu_types::GENERIC_9X1, container_id);
let items = vec![ItemStack::new(&vanilla_items::FLINT_AND_STEEL); 9];
let container = SimpleContainer::from_items(items).into_shared();
let section = builder.section_all(container);
let player = builder.player_inventory(&inventory);
let level_cost = builder.data_slot(0);
builder.route(section, player.all(), FillDirection::Backward);
builder.route(player.all(), section, FillDirection::Forward);
builder.build(BasicKind)
}Structs§
- Container
Slots - The not-yet-carved slots of a container being split across multiple sections.
- Data
Slot - A data slot handle created by the
MenuBuilder::data_slot, to use for easy access instead of a bare index. - Menu
Builder - Builds a Menu.
- Menu
Instance 🔒Id - Identity of one built menu.
- Player
Inventory Sections - The sections that cover the player’s inventory.
- Route 🔒
- A shift clicking Route that goes from a single Range to a Vec of Ranges.
- Section
- A handle to a contiguous range of slots added to a
MenuBuilder.
Enums§
- Fake
Result Remainder Policy - What to do with fake result output that cannot fit during a shift-click.
- Fill
Direction - The direction in which a slot range is walked when distributing items.
- Section
Kind - How a section lowers container indices into menu slots.
Traits§
- Into
Sections - Converts different types into an Iterator of sections so they can be passed into
MenuBuilder::route - Section
Source - A supplier for ranges of slots in a
ContainerRef. Allowing either making the whole Container aSectionor splitting one Container into multiple Sections.
Functions§
- deny_
all_ 🔒rules - Rules that reject both placement and pickup, shared process-wide.
- deny_
place_ 🔒rules - Rules that reject placement and allow pickup, shared process-wide.
Type Aliases§
- Slot
Factory - Produces the slot for one container index of a section.