pocketmine\item\Item::initCreativeItems PHP Method

initCreativeItems() private static method

private static initCreativeItems ( $readFromJson = false )
    private static function initCreativeItems($readFromJson = false)
    {
        self::clearCreativeItems();
        if (!$readFromJson) {
            foreach (CreativeItems::ITEMS as $category) {
                foreach ($category as $itemData) {
                    if (!isset($itemData["meta"])) {
                        $itemData["meta"] = 0;
                    }
                    $item = Item::get($itemData["id"], @$itemData["meta"]);
                    if (isset($itemData["ench"])) {
                        //Support multiple enchantments. Unnecessary really but nice to have.
                        foreach ($itemData["ench"] as $ench) {
                            $item->addEnchantment(Enchantment::getEnchantment($ench["id"])->setLevel($ench["lvl"]));
                        }
                    }
                    self::addCreativeItem($item);
                }
            }
        } else {
            $creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []);
            foreach ($creativeItems->getAll() as $item) {
                self::addCreativeItem(Item::get($item["ID"], $item["Damage"]));
            }
        }
    }