RecipeUnlocking 5.47.0
How a recipe appears in the client's recipe book: its priority (lower values are preferred when several recipes make the same item) and what unlocks it for a player (see \pocketmine\player\RecipeBook).
Recipes without this data (e.g. registered by plugins) are always unlocked.
Constants
CONTEXT_ALWAYS_UNLOCKED
php
public const CONTEXT_ALWAYS_UNLOCKED = 1CONTEXT_NONE
php
public const CONTEXT_NONE = 0Unlocked when the player obtains any of the unlocking ingredients (never if there are none).
CONTEXT_PLAYER_HAS_MANY_ITEMS
php
public const CONTEXT_PLAYER_HAS_MANY_ITEMS = 3Unlocked when the player's inventory has items in at least self::MANY_ITEMS_SLOTS slots.
CONTEXT_PLAYER_IN_WATER
php
public const CONTEXT_PLAYER_IN_WATER = 2DEFAULT_PRIORITY
php
public const DEFAULT_PRIORITY = 50Priority the client gets for recipes without unlocking data.
MANY_ITEMS_SLOTS
php
public const MANY_ITEMS_SLOTS = 10BDS 1.26.52 unlocks the chest recipe when the 10th inventory slot gets an item (640 dirt or 10 different items).
Methods
__construct()
php
public function __construct(int $priority, int $context, array $unlockingIngredients = [])getContext()
php
public function getContext() : intgetPriority()
php
public function getPriority() : intgetUnlockingIngredients()
php
public function getUnlockingIngredients() : array