mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Working crafting :woohoo:
This commit is contained in:
@ -45,6 +45,12 @@ class CraftingManager{
|
||||
*/
|
||||
protected $shapelessRecipes = [];
|
||||
|
||||
/**
|
||||
* @var CraftingRecipe[]
|
||||
* @phpstan-var array<int, CraftingRecipe>
|
||||
*/
|
||||
private array $craftingRecipeIndex = [];
|
||||
|
||||
/**
|
||||
* @var FurnaceRecipeManager[]
|
||||
* @phpstan-var array<int, FurnaceRecipeManager>
|
||||
@ -153,6 +159,14 @@ class CraftingManager{
|
||||
return $this->shapedRecipes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CraftingRecipe[]
|
||||
* @phpstan-return array<int, CraftingRecipe>
|
||||
*/
|
||||
public function getCraftingRecipeIndex() : array{
|
||||
return $this->craftingRecipeIndex;
|
||||
}
|
||||
|
||||
public function getFurnaceRecipeManager(FurnaceType $furnaceType) : FurnaceRecipeManager{
|
||||
return $this->furnaceRecipeManagers[$furnaceType->id()];
|
||||
}
|
||||
@ -175,6 +189,7 @@ class CraftingManager{
|
||||
|
||||
public function registerShapedRecipe(ShapedRecipe $recipe) : void{
|
||||
$this->shapedRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
|
||||
$this->craftingRecipeIndex[] = $recipe;
|
||||
|
||||
foreach($this->recipeRegisteredCallbacks as $callback){
|
||||
$callback();
|
||||
@ -183,6 +198,7 @@ class CraftingManager{
|
||||
|
||||
public function registerShapelessRecipe(ShapelessRecipe $recipe) : void{
|
||||
$this->shapelessRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
|
||||
$this->craftingRecipeIndex[] = $recipe;
|
||||
|
||||
foreach($this->recipeRegisteredCallbacks as $callback){
|
||||
$callback();
|
||||
|
Reference in New Issue
Block a user