pocketmine\tile\Tile::registerTile PHP Method

registerTile() public static method

public static registerTile ( $className ) : boolean
$className
return boolean
    public static function registerTile($className)
    {
        $class = new \ReflectionClass($className);
        if (is_a($className, Tile::class, true) and !$class->isAbstract()) {
            self::$knownTiles[$class->getShortName()] = $className;
            self::$shortNames[$className] = $class->getShortName();
            return true;
        }
        return false;
    }

Usage Example

コード例 #1
0
 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\tile\Tile::registerTile