From 70982c145bf873c43e426fbc1560251338ba8264 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jan 2018 18:08:43 +0000 Subject: [PATCH] Level: Clarified documentation for loadChunk() and changed misleading parameter name --- src/pocketmine/level/Level.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index e45d0dd4fc..8b232c0deb 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -2680,15 +2680,17 @@ class Level implements ChunkManager, Metadatable{ } /** + * Attempts to load a chunk from the level provider (if not already loaded). + * * @param int $x * @param int $z - * @param bool $generate + * @param bool $create Whether to create an empty chunk to load if the chunk cannot be loaded from disk. * - * @return bool + * @return bool if loading the chunk was successful * * @throws \InvalidStateException */ - public function loadChunk(int $x, int $z, bool $generate = true) : bool{ + public function loadChunk(int $x, int $z, bool $create = true) : bool{ if(isset($this->chunks[$chunkHash = Level::chunkHash($x, $z)])){ return true; } @@ -2699,12 +2701,12 @@ class Level implements ChunkManager, Metadatable{ $this->timings->syncChunkLoadDataTimer->startTiming(); - $chunk = $this->provider->loadChunk($x, $z, $generate); + $chunk = $this->provider->loadChunk($x, $z, $create); $this->timings->syncChunkLoadDataTimer->stopTiming(); if($chunk === null){ - if($generate){ + if($create){ throw new \InvalidStateException("Could not create new Chunk"); } return false;