Skip to content

MultiCraftingRecipe 5.47.0 ​

abstract class · pocketmine\crafting\MultiCraftingRecipe · source

Implements CraftingRecipe

A crafting table recipe whose logic is hardcoded in the Bedrock client (a "multi recipe", BedrockData special_hardcoded.json). Only its UUID and network ID are sent to the client; the result depends on what is in the crafting grid, so the server computes it from the grid as well.

Each non-empty grid slot is consumed once per repetition, so the ingredients of a craft are the grid contents themselves (MultiCraftingRecipe::getIngredientListFor()).

Register implementations with CraftingManager::registerSpecialCraftingRecipe().

Methods ​

computeResults() protected ​

php
abstract protected function computeResults(\pocketmine\crafting\CraftingGrid $grid) : ?array

Returns the results of crafting with the given grid contents, or null if the grid doesn't match this recipe.

getIngredientListFor() ​

php
public function getIngredientListFor(\pocketmine\crafting\CraftingGrid $grid) : array

Returns the ingredients consumed by one craft with the given grid contents: one of each non-empty slot.

getMultiRecipeUuid() ​

php
abstract public function getMultiRecipeUuid() : string

Returns the UUID the client knows this hardcoded recipe by.

getResultsFor() ​

php
public function getResultsFor(\pocketmine\crafting\CraftingGrid $grid) : array

matchesCraftingGrid() ​

php
public function matchesCraftingGrid(\pocketmine\crafting\CraftingGrid $grid) : bool

onCraftExecuted() ​

php
public function onCraftExecuted(array $outputs, ?\pocketmine\player\Player $player = null) : void

Called once a craft with this recipe went through, for results that need more than the items themselves (e.g. the data of a new map). $player is the crafting player, or null when a crafter block crafted.

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