public function sendEnchantmentList() { $pk = new CraftingDataPacket(); if ($this->entries != null and $this->levels != null) { $list = new EnchantmentList(count($this->entries)); for ($i = 0; $i < count($this->entries); $i++) { $list->setSlot($i, $this->entries[$i]); } $pk->addEnchantList($list); } Server::getInstance()->broadcastPacket($this->getViewers(), $pk); }
public function sendRecipeList(Player $p) { $pk = new CraftingDataPacket(); $pk->cleanRecipes = true; foreach ($this->getCraftingManager()->getRecipes() as $recipe) { if ($recipe instanceof ShapedRecipe) { $pk->addShapedRecipe($recipe); } elseif ($recipe instanceof ShapelessRecipe) { $pk->addShapelessRecipe($recipe); } } foreach ($this->getCraftingManager()->getFurnaceRecipes() as $recipe) { $pk->addFurnaceRecipe($recipe); } $p->dataPacket($pk); }
public function generateRecipeList() { $pk = new CraftingDataPacket(); $pk->cleanRecipes = true; foreach ($this->getCraftingManager()->getRecipes() as $recipe) { if ($recipe instanceof ShapedRecipe) { $pk->addShapedRecipe($recipe); } elseif ($recipe instanceof ShapelessRecipe) { $pk->addShapelessRecipe($recipe); } } foreach ($this->getCraftingManager()->getFurnaceRecipes() as $recipe) { $pk->addFurnaceRecipe($recipe); } $pk->encode(); $pk->isEncoded = true; $this->recipeList = $pk; }