diff --git a/classes/CustomPacketHandler.class.php b/classes/CustomPacketHandler.class.php index 5bf8e7bd0..d98230fcb 100644 --- a/classes/CustomPacketHandler.class.php +++ b/classes/CustomPacketHandler.class.php @@ -136,9 +136,9 @@ class CustomPacketHandler{ break; case 0x83: if($this->c === false){ - $this->data["unknown1"] = Utils::readInt($this->get(4)); + $this->data["status"] = Utils::readInt($this->get(4)); }else{ - $this->raw .= Utils::writeInt($this->data["unknown1"]); + $this->raw .= Utils::writeInt($this->data["status"]); } break; case 0x85: diff --git a/classes/Packet.class.php b/classes/Packet.class.php index b31961ea2..b3bcd2037 100644 --- a/classes/Packet.class.php +++ b/classes/Packet.class.php @@ -96,6 +96,9 @@ class Packet{ case "triad": $this->addRaw(Utils::writeTriad($this->data[$field])); break; + case "itriad": + $this->addRaw(strrev(Utils::writeTriad($this->data[$field]))); + break; case "int": $this->addRaw(Utils::writeInt($this->data[$field])); break; @@ -187,7 +190,10 @@ class Packet{ break; case "triad": $this->data[] = Utils::readTriad($this->get(3)); - break; + break; + case "itriad": + $this->data[] = Utils::readTriad(strrev($this->get(3))); + break; case "int": $this->data[] = Utils::readInt($this->get(4)); break; diff --git a/classes/PocketMinecraftServer.class.php b/classes/PocketMinecraftServer.class.php index e0924bdb4..23c060f93 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 = Utils::getRandomBytes(8); - $this->seed = "\x4f\xf0\x2d\x84"; + $this->seed = Utils::getRandomBytes(4);//"\x4f\xf0\x2d\x84"; $this->events = array("disabled" => array()); $this->actions = array(); $this->clients = array(); @@ -45,7 +45,8 @@ class PocketMinecraftServer{ $this->interface = new MinecraftInterface("255.255.255.255", $this->protocol, 19132, true, false); console("[INFO] Creating Minecraft Server"); console("[INFO] Username: ".$this->username); - console("[INFO] Protocol: ".$this->protocol); + console("[INFO] Seed: ".Utils::readInt($this->seed)); + //console("[INFO] Protocol: ".$this->protocol); $this->stop = false; } diff --git a/classes/Session.class.php b/classes/Session.class.php index dbb61e129..44ec5b78c 100644 --- a/classes/Session.class.php +++ b/classes/Session.class.php @@ -101,23 +101,35 @@ class Session{ case 0x82: $this->username = $data["username"]; - console("[INFO] User ".$this->username." connected from ".$this->ip.":".$this->port); + console("[INFO] ".$this->username." connected from ".$this->ip.":".$this->port); + $this->send(0x84, array( + $this->counter[0], + 0x00, + array( + "id" => 0x83, + "status" => 0, + ), + )); + ++$this->counter[0]; $this->send(0x84, array( $this->counter[0], 0x00, array( "id" => 0x87, "seed" => $this->server->seed, - "x" => 0, + "x" => 128, "y" => 100, - "z" => 0, + "z" => 128, "spawnX" => 0, - "spawnY" => 100, + "spawnY" => 0, "spawnZ" => 0, ), )); ++$this->counter[0]; break; + case 0x84: + console("[INFO] ".$this->username." spawned!"); + break; } break; diff --git a/pstruct/RakNet.php b/pstruct/RakNet.php index 9636af2a1..d616c7824 100644 --- a/pstruct/RakNet.php +++ b/pstruct/RakNet.php @@ -81,25 +81,25 @@ $pstruct = array( ), 0x80 => array( - "triad", + "itriad", "ubyte", "customData", ), 0x84 => array( - "triad", + "itriad", "ubyte", "customData", ), 0x88 => array( - "triad", + "itriad", "ubyte", "customData", ), 0x8c => array( - "triad", + "itriad", "ubyte", "customData", ), @@ -107,14 +107,14 @@ $pstruct = array( 0xa0 => array( "short", "bool", - "triad", + "itriad", "special1", ), 0xc0 => array( "short", "bool", - "triad", + "itriad", "special1", ), diff --git a/pstruct/dataName.php b/pstruct/dataName.php index 4de02adb1..e3c38b567 100644 --- a/pstruct/dataName.php +++ b/pstruct/dataName.php @@ -40,6 +40,8 @@ $dataName = array( 0x87 => "StartGame", 0x93 => "MoveEntity_PosRot", + 0x94 => "MovePlayer", + 0x9d => "RequestChunk", 0xa4 => "SetEntityMotion", ); \ No newline at end of file