Skip to main content

MenuPart

Trait MenuPart 

pub trait MenuPart:
    Send
    + Sync
    + 'static {
    // Provided method
    fn menu_slot_rules(
        &self,
        context: &dyn LoopContext,
        event: &mut MenuSlotRulesEvent<'_>,
    ) { ... }
}
Expand description

A mod menu type’s part.

Provided Methods§

fn menu_slot_rules( &self, context: &dyn LoopContext, event: &mut MenuSlotRulesEvent<'_>, )

Slot placement and stack limits for registered vanilla and mod menus; mounts use horizon:mount_inventory, while player inventory and the creative picker have no registered type. slot is the backing index, including player inventory slots. The slot’s own answers arrive first; the maximum is bounded to 1–99 and the item limit. Refusal also prevents quick-move top-ups. Runs in the restricted context on server and client prediction; answer from the stack and context alone, and fast. Side: both.

Trait Implementations§

§

impl Wire for Box<dyn MenuPart>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<Box<dyn MenuPart>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§