Fix build

This commit is contained in:
Dylan K. Taylor
2023-01-26 14:48:43 +00:00
parent 2cd8e4d270
commit f56339c306
6 changed files with 22 additions and 54 deletions

View File

@ -35,6 +35,7 @@ use pocketmine\event\entity\EntityExplodeEvent;
use pocketmine\item\VanillaItems;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\world\format\SubChunk;
use pocketmine\world\particle\HugeExplodeSeedParticle;
use pocketmine\world\sound\ExplodeSound;
@ -111,8 +112,12 @@ class Explosion{
if($this->subChunkExplorer->moveTo($vBlockX, $vBlockY, $vBlockZ) === SubChunkExplorerStatus::INVALID){
continue;
}
$subChunk = $this->subChunkExplorer->currentSubChunk;
if($subChunk === null){
throw new AssumptionFailedError("SubChunkExplorer subchunk should not be null here");
}
$state = $this->subChunkExplorer->currentSubChunk->getBlockStateId($vBlockX & SubChunk::COORD_MASK, $vBlockY & SubChunk::COORD_MASK, $vBlockZ & SubChunk::COORD_MASK);
$state = $subChunk->getBlockStateId($vBlockX & SubChunk::COORD_MASK, $vBlockY & SubChunk::COORD_MASK, $vBlockZ & SubChunk::COORD_MASK);
$blastResistance = $blockFactory->blastResistance[$state] ?? 0;
if($blastResistance >= 0){

View File

@ -25,6 +25,7 @@ namespace pocketmine\world\generator\hell;
use pocketmine\block\VanillaBlocks;
use pocketmine\data\bedrock\BiomeIds;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\world\biome\BiomeRegistry;
use pocketmine\world\ChunkManager;
use pocketmine\world\format\Chunk;
@ -71,7 +72,8 @@ class Nether extends Generator{
$noise = $this->noiseBase->getFastNoise3D(Chunk::EDGE_LENGTH, 128, Chunk::EDGE_LENGTH, 4, 8, 4, $chunkX * Chunk::EDGE_LENGTH, 0, $chunkZ * Chunk::EDGE_LENGTH);
$chunk = $world->getChunk($chunkX, $chunkZ);
//TODO: why don't we just create and set the chunk here directly?
$chunk = $world->getChunk($chunkX, $chunkZ) ?? throw new \InvalidArgumentException("Chunk $chunkX $chunkZ does not yet exist");
$bedrock = VanillaBlocks::BEDROCK()->getStateId();
$netherrack = VanillaBlocks::NETHERRACK()->getStateId();

View File

@ -141,7 +141,8 @@ class Normal extends Generator{
$noise = $this->noiseBase->getFastNoise3D(Chunk::EDGE_LENGTH, 128, Chunk::EDGE_LENGTH, 4, 8, 4, $chunkX * Chunk::EDGE_LENGTH, 0, $chunkZ * Chunk::EDGE_LENGTH);
$chunk = $world->getChunk($chunkX, $chunkZ);
//TODO: why don't we just create and set the chunk here directly?
$chunk = $world->getChunk($chunkX, $chunkZ) ?? throw new \InvalidArgumentException("Chunk $chunkX $chunkZ does not yet exist");
$biomeCache = [];

View File

@ -36,7 +36,7 @@ use function min;
class GroundCover implements Populator{
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
$chunk = $world->getChunk($chunkX, $chunkZ);
$chunk = $world->getChunk($chunkX, $chunkZ) ?? throw new \InvalidArgumentException("Chunk $chunkX $chunkZ does not yet exist");
$factory = RuntimeBlockStateRegistry::getInstance();
$biomeRegistry = BiomeRegistry::getInstance();
for($x = 0; $x < Chunk::EDGE_LENGTH; ++$x){