mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
World::getBlockAt() now doesn't assume that AIR has a fullStateId of 0
This commit is contained in:
parent
d0470a80ab
commit
f5807ac049
@ -33,6 +33,7 @@ use pocketmine\block\BlockLegacyIds;
|
|||||||
use pocketmine\block\tile\Spawnable;
|
use pocketmine\block\tile\Spawnable;
|
||||||
use pocketmine\block\tile\Tile;
|
use pocketmine\block\tile\Tile;
|
||||||
use pocketmine\block\UnknownBlock;
|
use pocketmine\block\UnknownBlock;
|
||||||
|
use pocketmine\block\VanillaBlocks;
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\entity\Location;
|
use pocketmine\entity\Location;
|
||||||
use pocketmine\entity\object\ExperienceOrb;
|
use pocketmine\entity\object\ExperienceOrb;
|
||||||
@ -1329,7 +1330,6 @@ class World implements ChunkManager{
|
|||||||
* @param bool $addToCache Whether to cache the block object created by this method call.
|
* @param bool $addToCache Whether to cache the block object created by this method call.
|
||||||
*/
|
*/
|
||||||
public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{
|
public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{
|
||||||
$fullState = 0;
|
|
||||||
$relativeBlockHash = null;
|
$relativeBlockHash = null;
|
||||||
$chunkHash = World::chunkHash($x >> 4, $z >> 4);
|
$chunkHash = World::chunkHash($x >> 4, $z >> 4);
|
||||||
|
|
||||||
@ -1342,13 +1342,15 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
$chunk = $this->chunks[$chunkHash] ?? null;
|
$chunk = $this->chunks[$chunkHash] ?? null;
|
||||||
if($chunk !== null){
|
if($chunk !== null){
|
||||||
$fullState = $chunk->getFullBlock($x & 0x0f, $y, $z & 0x0f);
|
$block = BlockFactory::getInstance()->fromFullBlock($chunk->getFullBlock($x & 0x0f, $y, $z & 0x0f));
|
||||||
}else{
|
}else{
|
||||||
$addToCache = false;
|
$addToCache = false;
|
||||||
|
$block = VanillaBlocks::AIR();
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$block = VanillaBlocks::AIR();
|
||||||
}
|
}
|
||||||
|
|
||||||
$block = BlockFactory::getInstance()->fromFullBlock($fullState);
|
|
||||||
$block->position($this, $x, $y, $z);
|
$block->position($this, $x, $y, $z);
|
||||||
|
|
||||||
static $dynamicStateRead = false;
|
static $dynamicStateRead = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user