diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index f9b217b26..c64ada77a 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2338,6 +2338,18 @@ class Level implements ChunkManager, Metadatable{ return null; } + /** + * Returns the chunk containing the given Vector3 position. + * + * @param Vector3 $pos + * @param bool $create + * + * @return null|Chunk + */ + public function getChunkAtPosition(Vector3 $pos, bool $create = false) : ?Chunk{ + return $this->getChunk($pos->getFloorX() >> 4, $pos->getFloorZ() >> 4, $create); + } + /** * Returns the chunks adjacent to the specified chunk. *