Synchronize hotbar slots, removed RotateHeadPacket, improved MoveEntityPacket, FullChunkDataPacket

This commit is contained in:
Shoghi Cervantes
2015-03-24 16:26:46 +01:00
parent 4e934654ef
commit d1760d9bb8
10 changed files with 64 additions and 134 deletions

View File

@ -59,7 +59,6 @@ use pocketmine\network\protocol\RemoveBlockPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\RespawnPacket;
use pocketmine\network\protocol\RotateHeadPacket;
use pocketmine\network\protocol\SetDifficultyPacket;
use pocketmine\network\protocol\SetEntityDataPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
@ -312,7 +311,6 @@ class RakLibInterface implements ServerInstance, SourceInterface{
$this->registerPacket(ProtocolInfo::ADD_ITEM_ENTITY_PACKET, AddItemEntityPacket::class);
$this->registerPacket(ProtocolInfo::TAKE_ITEM_ENTITY_PACKET, TakeItemEntityPacket::class);
$this->registerPacket(ProtocolInfo::MOVE_ENTITY_PACKET, MoveEntityPacket::class);
$this->registerPacket(ProtocolInfo::ROTATE_HEAD_PACKET, RotateHeadPacket::class);
$this->registerPacket(ProtocolInfo::MOVE_PLAYER_PACKET, MovePlayerPacket::class);
$this->registerPacket(ProtocolInfo::REMOVE_BLOCK_PACKET, RemoveBlockPacket::class);
$this->registerPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, UpdateBlockPacket::class);

View File

@ -42,6 +42,8 @@ class FullChunkDataPacket extends DataPacket{
public function encode(){
$this->reset();
$this->putInt($this->chunkX);
$this->putInt($this->chunkZ);
$this->put($this->data);
}

View File

@ -52,45 +52,44 @@ interface Info{
const TAKE_ITEM_ENTITY_PACKET = 0x8e;
const MOVE_ENTITY_PACKET = 0x8f;
const ROTATE_HEAD_PACKET = 0x90;
const MOVE_PLAYER_PACKET = 0x91;
const MOVE_PLAYER_PACKET = 0x90;
const REMOVE_BLOCK_PACKET = 0x92;
const UPDATE_BLOCK_PACKET = 0x93;
const REMOVE_BLOCK_PACKET = 0x91;
const UPDATE_BLOCK_PACKET = 0x92;
const ADD_PAINTING_PACKET = 0x94;
const ADD_PAINTING_PACKET = 0x93;
const EXPLODE_PACKET = 0x95;
const EXPLODE_PACKET = 0x94;
const LEVEL_EVENT_PACKET = 0x96;
const TILE_EVENT_PACKET = 0x97;
const ENTITY_EVENT_PACKET = 0x98;
const MOB_EFFECT_PACKET = 0x99;
const LEVEL_EVENT_PACKET = 0x95;
const TILE_EVENT_PACKET = 0x96;
const ENTITY_EVENT_PACKET = 0x97;
const MOB_EFFECT_PACKET = 0x98;
const PLAYER_EQUIPMENT_PACKET = 0x9a;
const PLAYER_ARMOR_EQUIPMENT_PACKET = 0x9b;
const INTERACT_PACKET = 0x9c;
const USE_ITEM_PACKET = 0x9d;
const PLAYER_ACTION_PACKET = 0x9e;
const HURT_ARMOR_PACKET = 0x9f;
const SET_ENTITY_DATA_PACKET = 0xa0;
const SET_ENTITY_MOTION_PACKET = 0xa1;
//const SET_ENTITY_LINK_PACKET = 0xa2;
const SET_HEALTH_PACKET = 0xa3;
const SET_SPAWN_POSITION_PACKET = 0xa4;
const ANIMATE_PACKET = 0xa5;
const RESPAWN_PACKET = 0xa6;
const DROP_ITEM_PACKET = 0xa7;
const CONTAINER_OPEN_PACKET = 0xa8;
const CONTAINER_CLOSE_PACKET = 0xa9;
const CONTAINER_SET_SLOT_PACKET = 0xaa;
const CONTAINER_SET_DATA_PACKET = 0xab;
const CONTAINER_SET_CONTENT_PACKET = 0xac;
//const CONTAINER_ACK_PACKET = 0xad;
const ADVENTURE_SETTINGS_PACKET = 0xae;
const TILE_ENTITY_DATA_PACKET = 0xaf;
//const PLAYER_INPUT_PACKET = 0xb0;
const FULL_CHUNK_DATA_PACKET = 0xb1;
const SET_DIFFICULTY_PACKET = 0xb2;
const PLAYER_EQUIPMENT_PACKET = 0x99;
const PLAYER_ARMOR_EQUIPMENT_PACKET = 0x9a;
const INTERACT_PACKET = 0x9b;
const USE_ITEM_PACKET = 0x9c;
const PLAYER_ACTION_PACKET = 0x9d;
const HURT_ARMOR_PACKET = 0x9e;
const SET_ENTITY_DATA_PACKET = 0x9f;
const SET_ENTITY_MOTION_PACKET = 0xa0;
//const SET_ENTITY_LINK_PACKET = 0xa1;
const SET_HEALTH_PACKET = 0xa2;
const SET_SPAWN_POSITION_PACKET = 0xa3;
const ANIMATE_PACKET = 0xa4;
const RESPAWN_PACKET = 0xa5;
const DROP_ITEM_PACKET = 0xa6;
const CONTAINER_OPEN_PACKET = 0xa7;
const CONTAINER_CLOSE_PACKET = 0xa8;
const CONTAINER_SET_SLOT_PACKET = 0xa9;
const CONTAINER_SET_DATA_PACKET = 0xaa;
const CONTAINER_SET_CONTENT_PACKET = 0xab;
//const CONTAINER_ACK_PACKET = 0xac;
const ADVENTURE_SETTINGS_PACKET = 0xad;
const TILE_ENTITY_DATA_PACKET = 0xae;
//const PLAYER_INPUT_PACKET = 0xaf;
const FULL_CHUNK_DATA_PACKET = 0xb0;
const SET_DIFFICULTY_PACKET = 0xb1;
}

View File

@ -55,7 +55,8 @@ class MoveEntityPacket extends DataPacket{
$this->putFloat($d[2]); //y
$this->putFloat($d[3]); //z
$this->putFloat($d[4]); //yaw
$this->putFloat($d[5]); //pitch
$this->putFloat($d[5]); //headYaw
$this->putFloat($d[6]); //pitch
}
}

View File

@ -1,58 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
class RotateHeadPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
// eid, yaw
/** @var array[] */
public $entities = [];
public function pid(){
return Info::ROTATE_HEAD_PACKET;
}
public function clean(){
$this->entities = [];
return parent::clean();
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt(count($this->entities));
foreach($this->entities as $d){
$this->putLong($d[0]); //eid
$this->putFloat($d[1]);
}
}
}