pocketmine\item\Item::addCreativeItem PHP Method

addCreativeItem() public static method

public static addCreativeItem ( Item $item )
$item Item
    public static function addCreativeItem(Item $item)
    {
        //Doing it this way allows adding enchanted items to inventory, like enchanted books
        Item::$creative[] = $item;
    }

Usage Example

 public function onEnable()
 {
     //アイテムの追加
     Item::$list[self::ITEM_FLOWER_POT] = ItemFlowerPot::class;
     //ブロックの追加
     $this->registerBlock(self::BLOCK_FLOWER_POT, BlockFlowerPot::class);
     //ブロックタイルエンティティの追加
     Tile::registerTile(FlowerPot::class);
     //アイテムをクリエイティブタブに追加
     Item::addCreativeItem(Item::get(self::ITEM_FLOWER_POT, 0));
     //一応レシピ追加
     Server::getInstance()->getCraftingManager()->registerRecipe((new ShapedRecipe(Item::get(MainClass::ITEM_FLOWER_POT, 0, 1), "X X", " X "))->setIngredient("X", Item::get(Item::BRICK, null)));
     //omake skull
     //アイテムの追加
     Item::$list[self::ITEM_SKULL] = ItemSkull::class;
     //ブロックの追加
     $this->registerBlock(self::BLOCK_SKULL, BlockSkull::class);
     //ブロックタイルエンティティの追加
     Tile::registerTile(Skull::class);
     //アイテムをクリエイティブタブに追加
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 0));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 1));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 2));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 3));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 4));
 }
All Usage Examples Of pocketmine\item\Item::addCreativeItem