mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Move block registration to its own class
This commit is contained in:
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\generator;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\SimpleChunkManager;
|
||||
@ -47,7 +47,7 @@ class GeneratorRegisterTask extends AsyncTask{
|
||||
}
|
||||
|
||||
public function onRun(){
|
||||
Block::init();
|
||||
BlockFactory::init();
|
||||
Biome::init();
|
||||
$manager = new SimpleChunkManager($this->seed, $this->worldHeight);
|
||||
$this->saveToThreadStore("generation.level{$this->levelId}.manager", $manager);
|
||||
|
@ -24,16 +24,17 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\generator\normal\biome;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
|
||||
abstract class GrassyBiome extends NormalBiome{
|
||||
|
||||
public function __construct(){
|
||||
$this->setGroundCover([
|
||||
Block::get(Block::GRASS, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::GRASS, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
]);
|
||||
}
|
||||
}
|
@ -24,16 +24,17 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\generator\normal\biome;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
|
||||
abstract class SandyBiome extends NormalBiome{
|
||||
|
||||
public function __construct(){
|
||||
$this->setGroundCover([
|
||||
Block::get(Block::SAND, 0),
|
||||
Block::get(Block::SAND, 0),
|
||||
Block::get(Block::SANDSTONE, 0),
|
||||
Block::get(Block::SANDSTONE, 0),
|
||||
Block::get(Block::SANDSTONE, 0)
|
||||
BlockFactory::get(Block::SAND, 0),
|
||||
BlockFactory::get(Block::SAND, 0),
|
||||
BlockFactory::get(Block::SANDSTONE, 0),
|
||||
BlockFactory::get(Block::SANDSTONE, 0),
|
||||
BlockFactory::get(Block::SANDSTONE, 0)
|
||||
]);
|
||||
}
|
||||
}
|
@ -24,16 +24,17 @@ declare(strict_types=1);
|
||||
namespace pocketmine\level\generator\normal\biome;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
|
||||
abstract class SnowyBiome extends NormalBiome{
|
||||
|
||||
public function __construct(){
|
||||
$this->setGroundCover([
|
||||
Block::get(Block::SNOW_LAYER, 0),
|
||||
Block::get(Block::GRASS, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
Block::get(Block::DIRT, 0),
|
||||
Block::get(Block::DIRT, 0)
|
||||
BlockFactory::get(Block::SNOW_LAYER, 0),
|
||||
BlockFactory::get(Block::GRASS, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::DIRT, 0),
|
||||
BlockFactory::get(Block::DIRT, 0)
|
||||
]);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\generator\populator;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\utils\Random;
|
||||
@ -44,7 +44,7 @@ class GroundCover extends Populator{
|
||||
|
||||
$column = $chunk->getBlockIdColumn($x, $z);
|
||||
for($y = 127; $y > 0; --$y){
|
||||
if($column{$y} !== "\x00" and !Block::get(ord($column{$y}))->isTransparent()){
|
||||
if($column{$y} !== "\x00" and !BlockFactory::get(ord($column{$y}))->isTransparent()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user