Rename BlockFactory::fromFullBlock() -> BlockFactory::fromStateId()

This commit is contained in:
Dylan K. Taylor
2022-07-05 13:46:19 +01:00
parent a059d03b37
commit 0a23e91329
12 changed files with 25 additions and 25 deletions

View File

@@ -41,7 +41,7 @@ class SimpleChunkManager implements ChunkManager{
public function getBlockAt(int $x, int $y, int $z) : Block{
if($this->isInWorld($x, $y, $z) && ($chunk = $this->getChunk($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE)) !== null){
return BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($x & Chunk::COORD_MASK, $y, $z & Chunk::COORD_MASK));
return BlockFactory::getInstance()->fromStateId($chunk->getFullBlock($x & Chunk::COORD_MASK, $y, $z & Chunk::COORD_MASK));
}
return VanillaBlocks::AIR();
}

View File

@@ -444,7 +444,7 @@ class World implements ChunkManager{
if($blockStateData === null){
continue;
}
$block = BlockFactory::getInstance()->fromFullBlock(GlobalBlockStateHandlers::getDeserializer()->deserialize($blockStateData));
$block = BlockFactory::getInstance()->fromStateId(GlobalBlockStateHandlers::getDeserializer()->deserialize($blockStateData));
}else{
//TODO: we probably ought to log an error here
continue;
@@ -1112,7 +1112,7 @@ class World implements ChunkManager{
$state = $subChunk->getFullBlock($x, $y, $z);
if(isset($this->randomTickBlocks[$state])){
$block = $blockFactory->fromFullBlock($state);
$block = $blockFactory->fromStateId($state);
$block->position($this, $chunkX * Chunk::EDGE_LENGTH + $x, ($Y << SubChunk::COORD_BIT_SIZE) + $y, $chunkZ * Chunk::EDGE_LENGTH + $z);
$block->onRandomTick();
}
@@ -1528,7 +1528,7 @@ class World implements ChunkManager{
$chunk = $this->chunks[$chunkHash] ?? null;
if($chunk !== null){
$block = BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($x & Chunk::COORD_MASK, $y, $z & Chunk::COORD_MASK));
$block = BlockFactory::getInstance()->fromStateId($chunk->getFullBlock($x & Chunk::COORD_MASK, $y, $z & Chunk::COORD_MASK));
}else{
$addToCache = false;
$block = VanillaBlocks::AIR();
@@ -2146,7 +2146,7 @@ class World implements ChunkManager{
$localY = $tilePosition->getFloorY();
$localZ = $tilePosition->getFloorZ() & Chunk::COORD_MASK;
$newBlock = BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($localX, $localY, $localZ));
$newBlock = BlockFactory::getInstance()->fromStateId($chunk->getFullBlock($localX, $localY, $localZ));
$expectedTileClass = $newBlock->getIdInfo()->getTileClass();
if(
$expectedTileClass === null || //new block doesn't expect a tile

View File

@@ -51,7 +51,7 @@ class GroundCover implements Populator{
$startY = 127;
for(; $startY > 0; --$startY){
if(!$factory->fromFullBlock($chunk->getFullBlock($x, $startY, $z))->isTransparent()){
if(!$factory->fromStateId($chunk->getFullBlock($x, $startY, $z))->isTransparent()){
break;
}
}
@@ -59,7 +59,7 @@ class GroundCover implements Populator{
$endY = $startY - count($cover);
for($y = $startY; $y > $endY && $y >= 0; --$y){
$b = $cover[$startY - $y];
$id = $factory->fromFullBlock($chunk->getFullBlock($x, $y, $z));
$id = $factory->fromStateId($chunk->getFullBlock($x, $y, $z));
if($id->getTypeId() === BlockTypeIds::AIR && $b->isSolid()){
break;
}