Script API - v26.60.25
    Preparing search index...

    Class RecipeCraftingContextBeta

    Provides access to the slots and recipe of a players active crafting UI ie. stonecutter.

    export class RecipeCraftingContext {
    private constructor();
    readonly inputSlotCount: number;
    readonly isValid: boolean;
    readonly validRecipes: string[];
    getInputItem(slot: number): ItemStack | undefined;
    getOutputItem(): ItemStack | undefined;
    setInputItem(slot: number, item?: ItemStack): void;
    setSelectedRecipe(recipeId: string): void;
    }
    Index

    Constructors

    Properties

    inputSlotCount: number

    The amount of addressable input slots for getInputItem and setInputItem.

    This property can throw when used.

    minecraftcommon.EngineError

    This property can't be read in early-execution mode.

    isValid: boolean

    Whether this recipe crafting context is valid. Invalidates when the player closes the crafting UI or leaves.

    This property can't be read in early-execution mode.

    validRecipes: string[]

    The identifiers of the recipes that are valid for the current input items.

    This property can throw when used.

    minecraftcommon.EngineError

    This property can't be read in early-execution mode.

    Methods

    • Parameters

      • slot: number

        The zero-based input slot index.

      • Optionalitem: ItemStack

        The item stack to place in the slot, or undefined to clear the slot.

      Returns void

      Sets or clears an item in an input slot.

      no-restricted-execution - This function can't be called in restricted-execution mode.

      This function can't be called in early-execution mode.

    • Parameters

      • recipeId: string

        The identifier of a valid recipe to select.

      Returns void

      Selects a recipe for the current crafting operation.

      no-restricted-execution - This function can't be called in restricted-execution mode.

      This function can throw errors.

      minecraftcommon.EngineError

      InvalidRecipeError

      This function can't be called in early-execution mode.