private static function writeFurnaceRecipe(FurnaceRecipe $recipe, BinaryStream $stream) { if ($recipe->getInput()->getDamage() !== 0) { //Data recipe $stream->putInt($recipe->getInput()->getId() << 16 | $recipe->getInput()->getDamage()); $stream->putSlot($recipe->getResult()); return CraftingDataPacket::ENTRY_FURNACE_DATA; } else { $stream->putInt($recipe->getInput()->getId()); $stream->putSlot($recipe->getResult()); return CraftingDataPacket::ENTRY_FURNACE; } }
/** * @param FurnaceRecipe $recipe */ public function registerFurnaceRecipe(FurnaceRecipe $recipe) { $input = $recipe->getInput(); $this->furnaceRecipes[$input->getId() . ":" . ($input->getDamage() === null ? "?" : $input->getDamage())] = $recipe; }