mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Level: use chunk records for tile reading in getTileAt()
the previous revision caused a crash when clicking on the bottom of the world due to a block hash being out of bounds.
This commit is contained in:
parent
5d1ec1ad49
commit
66e46e1c07
@ -2039,7 +2039,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @return Tile|null
|
||||
*/
|
||||
public function getTileAt(int $x, int $y, int $z) : ?Tile{
|
||||
return $this->tiles[Level::blockHash($x, $y, $z)] ?? null;
|
||||
return ($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null ? $chunk->getTile($x & 0x0f, $y, $z & 0x0f) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user