Block: Replace Color and WoodType magic numbers with type-safe objects

this provides automatic type safety without the need for magic number value checking everywhere.
This commit is contained in:
Dylan K. Taylor
2019-02-12 13:52:59 +00:00
parent 18440f612f
commit 7b3993730a
25 changed files with 422 additions and 250 deletions

View File

@ -25,7 +25,7 @@ namespace pocketmine\level\generator\object;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\Wood;
use pocketmine\block\utils\TreeType;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
@ -34,7 +34,7 @@ class BirchTree extends Tree{
protected $superBirch = false;
public function __construct(bool $superBirch = false){
parent::__construct(BlockFactory::get(Block::LOG, Wood::BIRCH), BlockFactory::get(Block::LEAVES, Wood::BIRCH));
parent::__construct(BlockFactory::get(Block::LOG, TreeType::$BIRCH->getMagicNumber()), BlockFactory::get(Block::LEAVES, TreeType::$BIRCH->getMagicNumber()));
$this->superBirch = $superBirch;
}