Skip to content

RecipeUnlocking 5.47.0 ​

final class · pocketmine\crafting\RecipeUnlocking · source

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 = 1

CONTEXT_NONE ​

php
public const CONTEXT_NONE = 0

Unlocked 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 = 3

Unlocked 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 = 2

DEFAULT_PRIORITY ​

php
public const DEFAULT_PRIORITY = 50

Priority the client gets for recipes without unlocking data.

MANY_ITEMS_SLOTS ​

php
public const MANY_ITEMS_SLOTS = 10

BDS 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() : int

getPriority() ​

php
public function getPriority() : int

getUnlockingIngredients() ​

php
public function getUnlockingIngredients() : array

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.