Implemented Stonecutter (#4732)

This commit is contained in:
ipad54
2022-05-17 18:01:03 +03:00
committed by GitHub
parent 8b8560a701
commit 1e59679ec2
12 changed files with 182 additions and 8 deletions

View File

@@ -43,12 +43,19 @@ final class CraftingManagerFromDataHelper{
$itemDeserializerFunc = \Closure::fromCallable([Item::class, 'jsonDeserialize']);
foreach($recipes["shapeless"] as $recipe){
if($recipe["block"] !== "crafting_table"){ //TODO: filter others out for now to avoid breaking economics
$recipeType = match($recipe["block"]){
"crafting_table" => ShapelessRecipeType::CRAFTING(),
"stonecutter" => ShapelessRecipeType::STONECUTTER(),
//TODO: Cartography Table
default => null
};
if($recipeType === null){
continue;
}
$result->registerShapelessRecipe(new ShapelessRecipe(
array_map($itemDeserializerFunc, $recipe["input"]),
array_map($itemDeserializerFunc, $recipe["output"])
array_map($itemDeserializerFunc, $recipe["output"]),
$recipeType
));
}
foreach($recipes["shaped"] as $recipe){