mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-29 14:49:59 +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
|
* @return Tile|null
|
||||||
*/
|
*/
|
||||||
public function getTileAt(int $x, int $y, int $z) : ?Tile{
|
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