Changing protocol to 18

This commit is contained in:
ArkQuark 2023-02-20 21:22:14 +03:00
parent 1239c31ebe
commit 44e0109580
3 changed files with 35 additions and 39 deletions

View file

@ -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) . ")"); 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; //spawn!
case ProtocolInfo::READY_PACKET: /*if($this->spawned !== false){
if($this->loggedIn === false){
break; 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); //if($this->entity->y <= 0){// fix!!!
$pData = $this->data->get("position"); //$pos = new Position($this->entity->x, 64, $this->entity->z, $this->level);
$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); //else{
$this->spawned = true; $pos = new Position($this->entity->x, $this->entity->y, $this->entity->z, $this->level);
$this->server->api->player->spawnAllPlayers($this); //}
$this->server->api->player->spawnToAllPlayers($this); $pData = $this->data->get("position");
$this->server->api->entity->spawnAll($this); $this->teleport($pos, isset($pData["yaw"]) ? $pData["yaw"] : false, isset($pData["pitch"]) ? $pData["pitch"] : false, true, true);
$this->server->api->entity->spawnToAll($this->entity); $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(5, [$this->entity, "update"], [], true);
$this->server->schedule(2, [$this->entity, "updateMovement"], [], true); $this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
$this->sendArmor(); $this->sendArmor();
$array = explode("@n", (string)$this->server->motd); $array = explode("@n", (string)$this->server->motd);
foreach($array as $msg){ foreach($array as $msg){
$this->sendChat($msg."\n"); $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->sendInventory();
$this->sendSettings();
$this->server->schedule(50, [$this, "orderChunks"], []);
$this->blocked = false;
$this->server->handle("player.spawn", $this);
break; break;
case ProtocolInfo::ROTATE_HEAD_PACKET: case ProtocolInfo::ROTATE_HEAD_PACKET:
if($this->spawned === false){ if($this->spawned === false){

View file

@ -48,9 +48,9 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
ini_set("memory_limit", "256M"); //Default ini_set("memory_limit", "256M"); //Default
define("LOG", true); define("LOG", true);
define("START_TIME", microtime(true)); define("START_TIME", microtime(true));
define("MAJOR_VERSION", "1.0.2dev"); define("MAJOR_VERSION", "2.0.0dev");
define("CODENAME", "懐かしさ (Nostalgia)"); //i'm not very creative - kotyaralih define("CODENAME", "Breadfence"); //i'm not very creative - kotyaralih
define("CURRENT_MINECRAFT_VERSION", "v0.8.1 alpha"); define("CURRENT_MINECRAFT_VERSION", "v0.9.5 alpha");
define("CURRENT_API_VERSION", '12.1'); define("CURRENT_API_VERSION", '12.1');
define("CURRENT_PHP_VERSION", "5.5"); define("CURRENT_PHP_VERSION", "5.5");
$gitsha1 = false; $gitsha1 = false;

View file

@ -3,7 +3,7 @@
abstract class ProtocolInfo{ abstract class ProtocolInfo{
const CURRENT_PROTOCOL = 14; const CURRENT_PROTOCOL = 18;
const PING_PACKET = 0x00; const PING_PACKET = 0x00;
@ -70,6 +70,7 @@ abstract class ProtocolInfo{
const ADVENTURE_SETTINGS_PACKET = 0xb7; const ADVENTURE_SETTINGS_PACKET = 0xb7;
const ENTITY_DATA_PACKET = 0xb8; const ENTITY_DATA_PACKET = 0xb8;
const PLAYER_INPUT_PACKET = 0xb9; const PLAYER_INPUT_PACKET = 0xb9;
//const FULL_CHUNK_DATA_PACKET = 0xba;
} }
/*Unused: /*Unused: