mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 19:37:17 +00:00
"Working" server
This commit is contained in:
parent
fc63676bde
commit
2fd71922ca
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
),
|
||||
|
||||
|
@ -40,6 +40,8 @@ $dataName = array(
|
||||
0x87 => "StartGame",
|
||||
|
||||
0x93 => "MoveEntity_PosRot",
|
||||
0x94 => "MovePlayer",
|
||||
0x9d => "RequestChunk",
|
||||
|
||||
0xa4 => "SetEntityMotion",
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user