From 44e0109580886f62a58da8f188a826e0123f1a4c Mon Sep 17 00:00:00 2001 From: ArkQuark <74979909+ArkQuark@users.noreply.github.com> Date: Mon, 20 Feb 2023 21:22:14 +0300 Subject: [PATCH] Changing protocol to 18 --- src/Player.php | 65 +++++++++++++-------------- src/config.php | 6 +-- src/network/protocol/ProtocolInfo.php | 3 +- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/Player.php b/src/Player.php index 5f1d0806..237922ea 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1451,45 +1451,40 @@ class Player{ console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")"); - break; - case ProtocolInfo::READY_PACKET: - if($this->loggedIn === false){ + //spawn! + /*if($this->spawned !== false){ break; - } - switch($packet->status){ - case 1: //Spawn!! - if($this->spawned !== false){ - break; - } + }*/ - $pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level); - $pData = $this->data->get("position"); - $this->teleport($pos, isset($pData["yaw"]) ? $pData["yaw"] : false, isset($pData["pitch"]) ? $pData["pitch"] : false, true, true); - $this->entity->setHealth($this->data->get("health"), "spawn", true); - $this->spawned = true; - $this->server->api->player->spawnAllPlayers($this); - $this->server->api->player->spawnToAllPlayers($this); - $this->server->api->entity->spawnAll($this); - $this->server->api->entity->spawnToAll($this->entity); + //if($this->entity->y <= 0){// fix!!! + //$pos = new Position($this->entity->x, 64, $this->entity->z, $this->level); + //} + //else{ + $pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level); + //} + $pData = $this->data->get("position"); + $this->teleport($pos, isset($pData["yaw"]) ? $pData["yaw"] : false, isset($pData["pitch"]) ? $pData["pitch"] : false, true, true); + $this->entity->setHealth($this->data->get("health"), "spawn", true); + $this->spawned = true; + $this->server->api->player->spawnAllPlayers($this); + $this->server->api->player->spawnToAllPlayers($this); + $this->server->api->entity->spawnAll($this); + $this->server->api->entity->spawnToAll($this->entity); - $this->server->schedule(5, [$this->entity, "update"], [], true); - $this->server->schedule(2, [$this->entity, "updateMovement"], [], true); - $this->sendArmor(); - $array = explode("@n", (string)$this->server->motd); - foreach($array as $msg){ - $this->sendChat($msg."\n"); - } - - $this->sendInventory(); - $this->sendSettings(); - $this->server->schedule(50, [$this, "orderChunks"], []); - $this->blocked = false; - - $this->server->handle("player.spawn", $this); - break; - case 2://Chunk loaded? - break; + $this->server->schedule(5, [$this->entity, "update"], [], true); + $this->server->schedule(2, [$this->entity, "updateMovement"], [], true); + $this->sendArmor(); + $array = explode("@n", (string)$this->server->motd); + foreach($array as $msg){ + $this->sendChat($msg."\n"); } + + $this->sendInventory(); + $this->sendSettings(); + $this->server->schedule(50, [$this, "orderChunks"], []); + $this->blocked = false; + + $this->server->handle("player.spawn", $this); break; case ProtocolInfo::ROTATE_HEAD_PACKET: if($this->spawned === false){ diff --git a/src/config.php b/src/config.php index 33b94ff4..d5b95abd 100644 --- a/src/config.php +++ b/src/config.php @@ -48,9 +48,9 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); ini_set("memory_limit", "256M"); //Default define("LOG", true); define("START_TIME", microtime(true)); -define("MAJOR_VERSION", "1.0.2dev"); -define("CODENAME", "懐かしさ (Nostalgia)"); //i'm not very creative - kotyaralih -define("CURRENT_MINECRAFT_VERSION", "v0.8.1 alpha"); +define("MAJOR_VERSION", "2.0.0dev"); +define("CODENAME", "Breadfence"); //i'm not very creative - kotyaralih +define("CURRENT_MINECRAFT_VERSION", "v0.9.5 alpha"); define("CURRENT_API_VERSION", '12.1'); define("CURRENT_PHP_VERSION", "5.5"); $gitsha1 = false; diff --git a/src/network/protocol/ProtocolInfo.php b/src/network/protocol/ProtocolInfo.php index 862aef95..854954a0 100644 --- a/src/network/protocol/ProtocolInfo.php +++ b/src/network/protocol/ProtocolInfo.php @@ -3,7 +3,7 @@ abstract class ProtocolInfo{ - const CURRENT_PROTOCOL = 14; + const CURRENT_PROTOCOL = 18; const PING_PACKET = 0x00; @@ -70,6 +70,7 @@ abstract class ProtocolInfo{ const ADVENTURE_SETTINGS_PACKET = 0xb7; const ENTITY_DATA_PACKET = 0xb8; const PLAYER_INPUT_PACKET = 0xb9; + //const FULL_CHUNK_DATA_PACKET = 0xba; } /*Unused: