From 82b6eb382dd0776fb17dc00a1d63adb8ba22b565 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 27 Nov 2012 22:35:47 +0100 Subject: [PATCH] Updated packet structure --- classes/CustomPacketHandler.class.php | 24 +++++++++++++----------- classes/PocketMinecraftServer.class.php | 2 +- classes/Session.class.php | 3 +++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/classes/CustomPacketHandler.class.php b/classes/CustomPacketHandler.class.php index 2ebce5fb5..1e0676df3 100644 --- a/classes/CustomPacketHandler.class.php +++ b/classes/CustomPacketHandler.class.php @@ -82,19 +82,21 @@ class CustomPacketHandler{ break; case 0x87: if($this->c === false){ - $this->data["seed"] = $this->get(8); - $this->data["unknown1"] = $this->get(4); - $this->data["unknown2"] = $this->get(4); - $this->data["spawnX"] = Utils::readFloat($this->get(4)); - $this->data["spawnY"] = Utils::readFloat($this->get(4)); - $this->data["spawnZ"] = Utils::readFloat($this->get(4)); + $this->data["seed"] = $this->get(4); + $this->data["spawnX"] = Utils::readInt($this->get(4)); + $this->data["spawnY"] = Utils::readInt($this->get(4)); + $this->data["spawnZ"] = Utils::readInt($this->get(4)); + $this->data["x"] = Utils::readFloat($this->get(4)); + $this->data["y"] = Utils::readFloat($this->get(4)); + $this->data["z"] = Utils::readFloat($this->get(4)); }else{ $this->raw .= $this->data["seed"]; - $this->raw .= "\x00\x00\x00\x01\x00\x00\x00\x05"; - $this->raw .= "\x43\x00\x80\x00\x42\x82\x00\x00\x43\x00\x80\x00"; - /*$this->raw .= Utils::writeFloat($this->data["spawnX"]); - $this->raw .= Utils::writeFloat($this->data["spawnY"]); - $this->raw .= Utils::writeFloat($this->data["spawnZ"]);*/ + $this->raw .= Utils::writeInt($this->data["spawnX"]); + $this->raw .= Utils::writeInt($this->data["spawnY"]); + $this->raw .= Utils::writeInt($this->data["spawnZ"]); + $this->raw .= Utils::writeFloat($this->data["x"]); + $this->raw .= Utils::writeFloat($this->data["y"]); + $this->raw .= Utils::writeFloat($this->data["z"]); } break; case 0x09: diff --git a/classes/PocketMinecraftServer.class.php b/classes/PocketMinecraftServer.class.php index e0b9c4a41..b20b377ee 100644 --- a/classes/PocketMinecraftServer.class.php +++ b/classes/PocketMinecraftServer.class.php @@ -36,7 +36,7 @@ class PocketMinecraftServer{ $this->username = $username; $this->cnt = 1; $this->serverID = substr(Utils::generateKey(), 0, 8); - $this->seed = "\x4f\xf0\x2d\x84\x00\x00\x00\x00"; + $this->seed = "\x4f\xf0\x2d\x84"; $this->events = array("disabled" => array()); $this->actions = array(); $this->clients = array(); diff --git a/classes/Session.class.php b/classes/Session.class.php index 20378aeb2..57391c986 100644 --- a/classes/Session.class.php +++ b/classes/Session.class.php @@ -108,6 +108,9 @@ class Session{ array( "id" => 0x87, "seed" => $this->server->seed, + "x" => 0, + "y" => 100, + "z" => 0, "spawnX" => 0, "spawnY" => 100, "spawnZ" => 0,