public function putSlot(Item $item)
{
if ($item->getId() === 0) {
$this->putShort(0);
return;
}
$this->putShort($item->getId());
$this->putByte($item->getCount());
$this->putShort($item->getDamage() === null ? -1 : $item->getDamage());
$nbt = $item->getCompoundTag();
$this->putLShort(strlen($nbt));
$this->put($nbt);
}
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; } }