Inheritance: extends DataPacket
Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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;
 }