From 363b24c6636dbf0edd20f93c8ecd95aaa433039e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 21 Dec 2016 23:41:46 +0000 Subject: [PATCH] Fix height limits on subchunks, fixed #196 facepalm --- src/pocketmine/level/format/generic/GenericChunk.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/level/format/generic/GenericChunk.php b/src/pocketmine/level/format/generic/GenericChunk.php index 8e3ed9a2d4..67b38ffdd8 100644 --- a/src/pocketmine/level/format/generic/GenericChunk.php +++ b/src/pocketmine/level/format/generic/GenericChunk.php @@ -554,7 +554,7 @@ class GenericChunk implements Chunk{ } public function getSubChunk(int $fY, bool $generateNew = false) : SubChunk{ - if($fY < 0 or $fY >= self::MAX_SUBCHUNKS){ + if($fY < 0 or $fY >= $this->height){ return new EmptySubChunk($fY); }elseif($generateNew and $this->subChunks[$fY] instanceof EmptySubChunk){ $this->subChunks[$fY] = new SubChunk($fY); @@ -563,7 +563,7 @@ class GenericChunk implements Chunk{ } public function setSubChunk(int $fY, SubChunk $subChunk = null, bool $allowEmpty = false) : bool{ - if($fY < 0 or $fY >= self::MAX_SUBCHUNKS){ + if($fY < 0 or $fY >= $this->height){ return false; } if($subChunk === null or ($subChunk->isEmpty() and !$allowEmpty)){ @@ -597,7 +597,7 @@ class GenericChunk implements Chunk{ public function pruneEmptySubChunks(){ foreach($this->subChunks as $y => $subChunk){ - if($y < 0 or $y > self::MAX_SUBCHUNKS){ + if($y < 0 or $y >= $this->height){ assert(false, "Invalid subchunk index"); unset($this->subChunks[$y]); }elseif($subChunk instanceof EmptySubChunk){