Block saving chunks too big

This commit is contained in:
Shoghi Cervantes
2015-01-11 15:48:08 +01:00
parent f8c144be31
commit f30986d187
2 changed files with 8 additions and 2 deletions

View File

@ -32,6 +32,7 @@ use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\IntArray;
use pocketmine\nbt\tag\Long;
use pocketmine\utils\Binary;
use pocketmine\utils\ChunkException;
use pocketmine\utils\MainLogger;
class RegionLoader{
@ -182,6 +183,9 @@ class RegionLoader{
protected function saveChunk($x, $z, $chunkData){
$length = strlen($chunkData) + 1;
if($length + 4 > self::MAX_SECTOR_LENGTH){
throw new ChunkException("Chunk is too big! ".($length + 4)." > ".self::MAX_SECTOR_LENGTH);
}
$sectors = (int) ceil(($length + 4) / 4096);
$index = self::getChunkOffset($x, $z);
if($this->locationTable[$index][1] < $sectors){