mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-25 12:23:48 +00:00
Updated BedrockData submodule, new recipes.json format
This commit is contained in:
parent
f0a0c9a85f
commit
1f5e0bc96d
@ -54,39 +54,34 @@ class CraftingManager{
|
|||||||
$recipes = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "recipes.json"), true);
|
$recipes = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "recipes.json"), true);
|
||||||
|
|
||||||
$itemDeserializerFunc = \Closure::fromCallable([Item::class, 'jsonDeserialize']);
|
$itemDeserializerFunc = \Closure::fromCallable([Item::class, 'jsonDeserialize']);
|
||||||
foreach($recipes as $recipe){
|
|
||||||
switch($recipe["type"]){
|
foreach($recipes["shapeless"] as $recipe){
|
||||||
case "shapeless":
|
if($recipe["block"] !== "crafting_table"){ //TODO: filter others out for now to avoid breaking economics
|
||||||
if($recipe["block"] !== "crafting_table"){ //TODO: filter others out for now to avoid breaking economics
|
continue;
|
||||||
break;
|
|
||||||
}
|
|
||||||
$this->registerShapelessRecipe(new ShapelessRecipe(
|
|
||||||
array_map($itemDeserializerFunc, $recipe["input"]),
|
|
||||||
array_map($itemDeserializerFunc, $recipe["output"])
|
|
||||||
));
|
|
||||||
break;
|
|
||||||
case "shaped":
|
|
||||||
if($recipe["block"] !== "crafting_table"){ //TODO: filter others out for now to avoid breaking economics
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$this->registerShapedRecipe(new ShapedRecipe(
|
|
||||||
$recipe["shape"],
|
|
||||||
array_map($itemDeserializerFunc, $recipe["input"]),
|
|
||||||
array_map($itemDeserializerFunc, $recipe["output"])
|
|
||||||
));
|
|
||||||
break;
|
|
||||||
case "smelting":
|
|
||||||
if($recipe["block"] !== "furnace"){ //TODO: filter others out for now to avoid breaking economics
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$this->registerFurnaceRecipe(new FurnaceRecipe(
|
|
||||||
Item::jsonDeserialize($recipe["output"]),
|
|
||||||
Item::jsonDeserialize($recipe["input"]))
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
$this->registerShapelessRecipe(new ShapelessRecipe(
|
||||||
|
array_map($itemDeserializerFunc, $recipe["input"]),
|
||||||
|
array_map($itemDeserializerFunc, $recipe["output"])
|
||||||
|
));
|
||||||
|
}
|
||||||
|
foreach($recipes["shaped"] as $recipe){
|
||||||
|
if($recipe["block"] !== "crafting_table"){ //TODO: filter others out for now to avoid breaking economics
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->registerShapedRecipe(new ShapedRecipe(
|
||||||
|
$recipe["shape"],
|
||||||
|
array_map($itemDeserializerFunc, $recipe["input"]),
|
||||||
|
array_map($itemDeserializerFunc, $recipe["output"])
|
||||||
|
));
|
||||||
|
}
|
||||||
|
foreach($recipes["smelting"] as $recipe){
|
||||||
|
if($recipe["block"] !== "furnace"){ //TODO: filter others out for now to avoid breaking economics
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->registerFurnaceRecipe(new FurnaceRecipe(
|
||||||
|
Item::jsonDeserialize($recipe["output"]),
|
||||||
|
Item::jsonDeserialize($recipe["input"]))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->buildCraftingDataCache();
|
$this->buildCraftingDataCache();
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 43edcfde6b9611b7c7d643be52332707cc10cd1b
|
Subproject commit 767676e2b97843072220bad719c076b169c28fd3
|
Loading…
x
Reference in New Issue
Block a user