Move block registration to its own class

This commit is contained in:
Dylan K. Taylor
2017-08-20 18:05:01 +01:00
committed by GitHub
parent 9451dd361e
commit 02f42eba48
62 changed files with 560 additions and 482 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\Fire;
use pocketmine\block\Solid;
use pocketmine\level\Level;
@ -37,7 +38,7 @@ class FlintSteel extends Tool{
public function onActivate(Level $level, Player $player, Block $block, Block $target, int $face, Vector3 $facePos) : bool{
if($block->getId() === self::AIR and ($target instanceof Solid)){
$level->setBlock($block, Block::get(Block::FIRE), true);
$level->setBlock($block, BlockFactory::get(Block::FIRE), true);
if(($player->gamemode & 0x01) === 0 and $this->useOn($block)){
if($this->getDamage() >= $this->getMaxDurability()){
$player->getInventory()->setItemInHand(new Item(Item::AIR, 0, 0));