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

@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\cache;
use pocketmine\crafting\CraftingManager;
use pocketmine\crafting\FurnaceType;
use pocketmine\crafting\ShapelessRecipeType;
use pocketmine\item\Item;
use pocketmine\network\mcpe\convert\ItemTranslator;
use pocketmine\network\mcpe\convert\TypeConverter;
@ -81,6 +82,11 @@ final class CraftingDataCache{
$recipesWithTypeIds = [];
foreach($manager->getShapelessRecipes() as $list){
foreach($list as $recipe){
$typeTag = match($recipe->getType()->id()){
ShapelessRecipeType::CRAFTING()->id() => CraftingRecipeBlockName::CRAFTING_TABLE,
ShapelessRecipeType::STONECUTTER()->id() => CraftingRecipeBlockName::STONECUTTER,
default => throw new AssumptionFailedError("Unreachable"),
};
$recipesWithTypeIds[] = new ProtocolShapelessRecipe(
CraftingDataPacket::ENTRY_SHAPELESS,
Binary::writeInt(++$counter),
@ -91,7 +97,7 @@ final class CraftingDataCache{
return $converter->coreItemStackToNet($item);
}, $recipe->getResults()),
$nullUUID,
CraftingRecipeBlockName::CRAFTING_TABLE,
$typeTag,
50,
$counter
);