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\level\generator\object;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\Wood;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
@ -60,7 +61,7 @@ class SpruceTree extends Tree{
continue;
}
if(!Block::$solid[$level->getBlockIdAt($xx, $yyy, $zz)]){
if(!BlockFactory::$solid[$level->getBlockIdAt($xx, $yyy, $zz)]){
$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);
$level->setBlockDataAt($xx, $yyy, $zz, $this->type);
}

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\level\generator\object;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\block\Sapling;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
@ -107,7 +108,7 @@ abstract class Tree{
if($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0)){
continue;
}
if(!Block::$solid[$level->getBlockIdAt($xx, $yy, $zz)]){
if(!BlockFactory::$solid[$level->getBlockIdAt($xx, $yy, $zz)]){
$level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);
$level->setBlockDataAt($xx, $yy, $zz, $this->type);
}