22declare(strict_types=1);
24namespace pocketmine\crafting;
31 protected array $furnaceRecipes = [];
37 private array $lookupCache = [];
40 private ObjectSet $recipeRegisteredCallbacks;
42 public function __construct(){
43 $this->recipeRegisteredCallbacks =
new ObjectSet();
50 return $this->recipeRegisteredCallbacks;
57 return $this->furnaceRecipes;
61 $this->furnaceRecipes[] = $recipe;
62 foreach($this->recipeRegisteredCallbacks as $callback){
67 public function match(Item $input) : ?FurnaceRecipe{
68 $index = $input->getStateId();
69 $simpleRecipe = $this->lookupCache[$index] ??
null;
70 if($simpleRecipe !==
null){
74 foreach($this->furnaceRecipes as $recipe){
75 if($recipe->getInput()->accepts($input)){
77 $this->lookupCache[$index] = $recipe;
getRecipeRegisteredCallbacks()