From e76734628a216a4731fe4c9d4f6d1eb641d375f4 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Fri, 14 Dec 2012 00:08:14 +0100 Subject: [PATCH] Complete ChunkData sending! --- classes/API/LevelAPI.php | 3 +++ classes/CustomPacketHandler.class.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/classes/API/LevelAPI.php b/classes/API/LevelAPI.php index f772c292..9a9ba1f6 100644 --- a/classes/API/LevelAPI.php +++ b/classes/API/LevelAPI.php @@ -60,6 +60,9 @@ class LevelAPI{ for($i = 0;$i < 0xff; ){ $ordered[$i] = str_repeat("\x00", $i); for($j = 0; $j < $columnsPerPacket; ++$j){ + if(($i + $j) >= 0xff){ + break; + } $ordered[$i] .= "\xff"; for($k = 0; $k < 8; ++$k){ $ordered[$i] .= substr($c[0][$i+$j], $k << 4, 16); //Block data diff --git a/classes/CustomPacketHandler.class.php b/classes/CustomPacketHandler.class.php index 10ca279d..35fe9d4b 100644 --- a/classes/CustomPacketHandler.class.php +++ b/classes/CustomPacketHandler.class.php @@ -375,21 +375,21 @@ class CustomPacketHandler{ break; case MC_REQUEST_CHUNK: if($this->c === false){ - $this->data["x"] = Utils::readInt($this->get(4)); $this->data["z"] = Utils::readInt($this->get(4)); + $this->data["x"] = Utils::readInt($this->get(4)); }else{ - $this->raw .= Utils::writeInt($this->data["x"]); $this->raw .= Utils::writeInt($this->data["z"]); + $this->raw .= Utils::writeInt($this->data["x"]); } break; case MC_CHUNK_DATA: if($this->c === false){ - $this->data["x"] = Utils::readInt($this->get(4)); $this->data["z"] = Utils::readInt($this->get(4)); + $this->data["x"] = Utils::readInt($this->get(4)); $this->data["data"] = $this->get(true); }else{ - $this->raw .= Utils::writeInt($this->data["x"]); $this->raw .= Utils::writeInt($this->data["z"]); + $this->raw .= Utils::writeInt($this->data["x"]); $this->raw .= $this->data["data"]; } break;