Ejemplo n.º 1
0
 public function onEnable()
 {
     //flower pot
     //add item
     $this->registerItem(self::ITEM_FLOWER_POT, ItemFlowerPot::class);
     //add block
     $this->registerBlock(self::BLOCK_FLOWER_POT, BlockFlowerPot::class);
     //add block entity(tile)
     Tile::registerTile(FlowerPot::class);
     //add to creative item
     $this->addCreativeItem(Item::get(self::ITEM_FLOWER_POT, 0));
     //extra: skull
     //add item
     $this->registerItem(self::ITEM_SKULL, ItemSkull::class);
     //add block
     $this->registerBlock(self::BLOCK_SKULL, BlockSkull::class);
     //add block entity(tile)
     Tile::registerTile(Skull::class);
     //add to creative item
     $this->addCreativeItem(Item::get(self::ITEM_SKULL, 0));
     $this->addCreativeItem(Item::get(self::ITEM_SKULL, 1));
     $this->addCreativeItem(Item::get(self::ITEM_SKULL, 2));
     $this->addCreativeItem(Item::get(self::ITEM_SKULL, 3));
     $this->addCreativeItem(Item::get(self::ITEM_SKULL, 4));
     //extra: note block
     //add item(block)
     $this->registerItem(self::BLOCK_NOTE, BlockNote::class);
     //add block
     $this->registerBlock(self::BLOCK_NOTE, BlockNote::class);
     //add block entity(tile)
     Tile::registerTile(Note::class);
     //add creative item
     $this->addCreativeItem(Item::get(self::BLOCK_NOTE, 0));
     //extra: item frame
     //add block
     $this->registerBlock(self::BLOCK_ITEM_FRAME, BlockItemFrame::class);
     //add item
     $this->registerItem(self::ITEM_ITEM_FRAME, ItemItemFrame::class);
     //add block entity(tile)
     Tile::registerTile(ItemFrame::class);
     //add to creative item
     $this->addCreativeItem(Item::get(self::ITEM_ITEM_FRAME, 0));
     //add drop packet to network
     Server::getInstance()->getNetWork()->registerPacket(MainClass::PROTOCOL_ITEM_FRAME_DROP_ITEM_PACKET, ItemFrameDropPacket::class);
     //extra: Cauldron
     //add item
     $this->registerItem(self::ITEM_CAULDRON, ItemCauldron::class);
     //add block
     $this->registerBlock(self::BLOCK_CAULDRON, BlockCauldron::class);
     //add block entity(tile)
     Tile::registerTile(Cauldron::class);
     //add creative item
     $this->addCreativeItem(Item::get(self::ITEM_CAULDRON, 0));
     //init Color
     Color::init();
     //fix max stack
     $this->registerItem(Item::POTION, Potion::class);
     $this->registerItem(Item::SPLASH_POTION, SplashPotion::class);
     //Recipes
     $craftingManager = Server::getInstance()->getCraftingManager();
     //.FlowerPot
     $craftingManager->registerRecipe((new BigShapedRecipe(Item::get(MainClass::ITEM_FLOWER_POT, 0, 1), "B B", " B ", "   "))->setIngredient("B", Item::get(Item::BRICK, null, 1)));
     //.NoteBlock
     $craftingManager->registerRecipe((new BigShapedRecipe(Item::get(MainClass::BLOCK_NOTE, 0, 1), "PPP", "PRP", "PPP"))->setIngredient("P", Item::get(Item::PLANK, null, 1))->setIngredient("R", Item::get(Item::REDSTONE, null, 1)));
     //.ItemFrame
     $craftingManager->registerRecipe((new BigShapedRecipe(Item::get(MainClass::ITEM_ITEM_FRAME, 0, 1), "SSS", "SLS", "SSS"))->setIngredient("S", Item::get(Item::STICK, null, 1))->setIngredient("L", Item::get(Item::LEATHER, null, 1)));
     //.Cauldron
     $craftingManager->registerRecipe((new BigShapedRecipe(Item::get(MainClass::ITEM_CAULDRON, 0, 1), "I I", "I I", "III"))->setIngredient("I", Item::get(Item::IRON_INGOT, null, 1)));
     Server::getInstance()->getPluginManager()->registerEvents($this, $this);
 }