mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Switch to BiomeRegistry
I accidentally committed this in c869a7f099
and didn't notice. I intended to use it and never noticed.
This commit is contained in:
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\world\generator;
|
||||
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\world\biome\Biome;
|
||||
use pocketmine\world\SimpleChunkManager;
|
||||
use pocketmine\world\World;
|
||||
use function igbinary_serialize;
|
||||
@ -60,7 +59,6 @@ class GeneratorRegisterTask extends AsyncTask{
|
||||
}
|
||||
|
||||
public function onRun() : void{
|
||||
Biome::init();
|
||||
$manager = new SimpleChunkManager($this->worldHeight);
|
||||
$this->worker->saveToThreadStore("generation.world{$this->worldId}.manager", $manager);
|
||||
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\world\generator\biome;
|
||||
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\world\biome\Biome;
|
||||
use pocketmine\world\biome\BiomeRegistry;
|
||||
use pocketmine\world\biome\UnknownBiome;
|
||||
use pocketmine\world\generator\noise\Simplex;
|
||||
|
||||
@ -55,9 +56,10 @@ abstract class BiomeSelector{
|
||||
public function recalculate() : void{
|
||||
$this->map = new \SplFixedArray(64 * 64);
|
||||
|
||||
$biomeRegistry = BiomeRegistry::getInstance();
|
||||
for($i = 0; $i < 64; ++$i){
|
||||
for($j = 0; $j < 64; ++$j){
|
||||
$biome = Biome::getBiome($this->lookup($i / 63, $j / 63));
|
||||
$biome = $biomeRegistry->getBiome($this->lookup($i / 63, $j / 63));
|
||||
if($biome instanceof UnknownBiome){
|
||||
throw new \RuntimeException("Unknown biome returned by selector with ID " . $biome->getId());
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\world\generator\hell;
|
||||
|
||||
use pocketmine\block\VanillaBlocks;
|
||||
use pocketmine\world\biome\Biome;
|
||||
use pocketmine\world\biome\BiomeRegistry;
|
||||
use pocketmine\world\ChunkManager;
|
||||
use pocketmine\world\generator\Generator;
|
||||
use pocketmine\world\generator\InvalidGeneratorOptionsException;
|
||||
@ -84,9 +85,7 @@ class Nether extends Generator{
|
||||
|
||||
for($x = 0; $x < 16; ++$x){
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
|
||||
$biome = Biome::getBiome(Biome::HELL);
|
||||
$chunk->setBiomeId($x, $z, $biome->getId());
|
||||
$chunk->setBiomeId($x, $z, Biome::HELL);
|
||||
|
||||
for($y = 0; $y < 128; ++$y){
|
||||
if($y === 0 or $y === 127){
|
||||
@ -117,7 +116,7 @@ class Nether extends Generator{
|
||||
}
|
||||
|
||||
$chunk = $world->getChunk($chunkX, $chunkZ);
|
||||
$biome = Biome::getBiome($chunk->getBiomeId(7, 7));
|
||||
$biome = BiomeRegistry::getInstance()->getBiome($chunk->getBiomeId(7, 7));
|
||||
$biome->populateChunk($world, $chunkX, $chunkZ, $this->random);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\world\generator\normal;
|
||||
|
||||
use pocketmine\block\VanillaBlocks;
|
||||
use pocketmine\world\biome\Biome;
|
||||
use pocketmine\world\biome\BiomeRegistry;
|
||||
use pocketmine\world\ChunkManager;
|
||||
use pocketmine\world\generator\biome\BiomeSelector;
|
||||
use pocketmine\world\generator\Gaussian;
|
||||
@ -227,7 +228,7 @@ class Normal extends Generator{
|
||||
}
|
||||
|
||||
$chunk = $world->getChunk($chunkX, $chunkZ);
|
||||
$biome = Biome::getBiome($chunk->getBiomeId(7, 7));
|
||||
$biome = BiomeRegistry::getInstance()->getBiome($chunk->getBiomeId(7, 7));
|
||||
$biome->populateChunk($world, $chunkX, $chunkZ, $this->random);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\BlockLegacyIds;
|
||||
use pocketmine\block\Liquid;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\world\biome\Biome;
|
||||
use pocketmine\world\biome\BiomeRegistry;
|
||||
use pocketmine\world\ChunkManager;
|
||||
use function count;
|
||||
use function min;
|
||||
@ -37,9 +37,10 @@ class GroundCover extends Populator{
|
||||
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
|
||||
$chunk = $world->getChunk($chunkX, $chunkZ);
|
||||
$factory = BlockFactory::getInstance();
|
||||
$biomeRegistry = BiomeRegistry::getInstance();
|
||||
for($x = 0; $x < 16; ++$x){
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
$biome = Biome::getBiome($chunk->getBiomeId($x, $z));
|
||||
$biome = $biomeRegistry->getBiome($chunk->getBiomeId($x, $z));
|
||||
$cover = $biome->getGroundCover();
|
||||
if(count($cover) > 0){
|
||||
$diffY = 0;
|
||||
|
Reference in New Issue
Block a user