mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
More packets changed, unique IDs D:
This commit is contained in:
parent
eeeaac04e9
commit
218fd999b0
@ -61,7 +61,6 @@ use pocketmine\network\protocol\RemoveEntityPacket;
|
||||
use pocketmine\network\protocol\RemovePlayerPacket;
|
||||
use pocketmine\network\protocol\RespawnPacket;
|
||||
use pocketmine\network\protocol\RotateHeadPacket;
|
||||
use pocketmine\network\protocol\SendInventoryPacket;
|
||||
use pocketmine\network\protocol\SetDifficultyPacket;
|
||||
use pocketmine\network\protocol\SetEntityDataPacket;
|
||||
use pocketmine\network\protocol\SetEntityMotionPacket;
|
||||
@ -306,9 +305,9 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
private function registerPackets(){
|
||||
$this->packetPool = new \SplFixedArray(256);
|
||||
|
||||
$this->registerPacket(ProtocolInfo::DISCONNECT_PACKET, DisconnectPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::LOGIN_PACKET, LoginPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::LOGIN_STATUS_PACKET, LoginStatusPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::DISCONNECT_PACKET, DisconnectPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::MESSAGE_PACKET, MessagePacket::class);
|
||||
$this->registerPacket(ProtocolInfo::SET_TIME_PACKET, SetTimePacket::class);
|
||||
$this->registerPacket(ProtocolInfo::START_GAME_PACKET, StartGamePacket::class);
|
||||
@ -341,7 +340,6 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
$this->registerPacket(ProtocolInfo::SET_SPAWN_POSITION_PACKET, SetSpawnPositionPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::ANIMATE_PACKET, AnimatePacket::class);
|
||||
$this->registerPacket(ProtocolInfo::RESPAWN_PACKET, RespawnPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::SEND_INVENTORY_PACKET, SendInventoryPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::DROP_ITEM_PACKET, DropItemPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, ContainerOpenPacket::class);
|
||||
$this->registerPacket(ProtocolInfo::CONTAINER_CLOSE_PACKET, ContainerClosePacket::class);
|
||||
|
@ -48,12 +48,12 @@ class AddEntityPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putInt($this->type);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putInt($this->did);
|
||||
$this->putLong($this->did);
|
||||
if($this->did > 0){
|
||||
$this->putShort($this->speedX * 8000);
|
||||
$this->putShort($this->speedY * 8000);
|
||||
|
@ -47,7 +47,7 @@ class AddItemEntityPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putSlot($this->item);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
|
@ -51,7 +51,7 @@ class AddMobPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putInt($this->type);
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
|
@ -45,7 +45,7 @@ class AddPaintingPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLevel($this->eid);
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
$this->putInt($this->z);
|
||||
|
@ -56,7 +56,7 @@ class AddPlayerPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putLong($this->clientID);
|
||||
$this->putString($this->username);
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
|
@ -37,13 +37,13 @@ class AnimatePacket extends DataPacket{
|
||||
|
||||
public function decode(){
|
||||
$this->action = $this->getByte();
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putByte($this->action);
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
}
|
||||
|
||||
}
|
@ -36,13 +36,13 @@ class EntityEventPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->event = $this->getByte();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putByte($this->event);
|
||||
}
|
||||
|
||||
|
@ -80,19 +80,18 @@ interface Info{
|
||||
const SET_SPAWN_POSITION_PACKET = 0xa4;
|
||||
const ANIMATE_PACKET = 0xa5;
|
||||
const RESPAWN_PACKET = 0xa6;
|
||||
const SEND_INVENTORY_PACKET = 0xa7;
|
||||
const DROP_ITEM_PACKET = 0xa8;
|
||||
const CONTAINER_OPEN_PACKET = 0xa9;
|
||||
const CONTAINER_CLOSE_PACKET = 0xaa;
|
||||
const CONTAINER_SET_SLOT_PACKET = 0xab;
|
||||
const CONTAINER_SET_DATA_PACKET = 0xac;
|
||||
const CONTAINER_SET_CONTENT_PACKET = 0xad;
|
||||
//const CONTAINER_ACK_PACKET = 0xae;
|
||||
const CHAT_PACKET = 0xaf;
|
||||
const ADVENTURE_SETTINGS_PACKET = 0xb0;
|
||||
const ENTITY_DATA_PACKET = 0xb1;
|
||||
//const PLAYER_INPUT_PACKET = 0xb2;
|
||||
const FULL_CHUNK_DATA_PACKET = 0xb3;
|
||||
const SET_DIFFICULTY_PACKET = 0xb4;
|
||||
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 CHAT_PACKET = 0xae;
|
||||
const ADVENTURE_SETTINGS_PACKET = 0xaf;
|
||||
const ENTITY_DATA_PACKET = 0xb0;
|
||||
//const PLAYER_INPUT_PACKET = 0xb1;
|
||||
const FULL_CHUNK_DATA_PACKET = 0xb2;
|
||||
const SET_DIFFICULTY_PACKET = 0xb3;
|
||||
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ class InteractPacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putByte($this->action);
|
||||
$this->putInt($this->eid);
|
||||
$this->putInt($this->target);
|
||||
$this->putLong($this->eid);
|
||||
$this->putLong($this->target);
|
||||
}
|
||||
|
||||
}
|
@ -50,7 +50,7 @@ class MoveEntityPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putInt(count($this->entities));
|
||||
foreach($this->entities as $d){
|
||||
$this->putInt($d[0]); //eid
|
||||
$this->putLong($d[0]); //eid
|
||||
$this->putFloat($d[1]); //x
|
||||
$this->putFloat($d[2]); //y
|
||||
$this->putFloat($d[3]); //z
|
||||
|
@ -47,7 +47,7 @@ class MovePlayerPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->x = $this->getFloat();
|
||||
$this->y = $this->getFloat();
|
||||
$this->z = $this->getFloat();
|
||||
@ -60,7 +60,7 @@ class MovePlayerPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
|
@ -45,7 +45,7 @@ class PlayerActionPacket extends DataPacket{
|
||||
$this->y = $this->getInt();
|
||||
$this->z = $this->getInt();
|
||||
$this->face = $this->getInt();
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
@ -36,7 +36,7 @@ class PlayerArmorEquipmentPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->slots[0] = $this->getByte();
|
||||
$this->slots[1] = $this->getByte();
|
||||
$this->slots[2] = $this->getByte();
|
||||
@ -45,7 +45,7 @@ class PlayerArmorEquipmentPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putByte($this->slots[0]);
|
||||
$this->putByte($this->slots[1]);
|
||||
$this->putByte($this->slots[2]);
|
||||
|
@ -38,7 +38,7 @@ class PlayerEquipmentPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->item = $this->getShort();
|
||||
$this->meta = $this->getShort();
|
||||
$this->slot = $this->getByte();
|
||||
@ -46,7 +46,7 @@ class PlayerEquipmentPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putShort($this->item);
|
||||
$this->putShort($this->meta);
|
||||
$this->putByte($this->slot);
|
||||
|
@ -40,7 +40,7 @@ class RemoveEntityPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
}
|
||||
|
||||
}
|
@ -41,7 +41,7 @@ class RemovePlayerPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putLong($this->clientID);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class RespawnPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->x = $this->getFloat();
|
||||
$this->y = $this->getFloat();
|
||||
$this->z = $this->getFloat();
|
||||
@ -46,7 +46,7 @@ class RespawnPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
|
@ -50,7 +50,7 @@ class RotateHeadPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putInt(count($this->entities));
|
||||
foreach($this->entities as $d){
|
||||
$this->putInt($d[0]); //eid
|
||||
$this->putLong($d[0]); //eid
|
||||
$this->putByte((int) ($d[1] / 360));
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +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 SendInventoryPacket extends DataPacket{
|
||||
public static $pool = [];
|
||||
public static $next = 0;
|
||||
|
||||
public $eid;
|
||||
public $windowid;
|
||||
public $slots = [];
|
||||
public $armor = [];
|
||||
|
||||
public function pid(){
|
||||
return Info::SEND_INVENTORY_PACKET;
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getInt();
|
||||
$this->windowid = $this->getByte();
|
||||
$count = $this->getShort();
|
||||
for($s = 0; $s < $count and !$this->feof(); ++$s){
|
||||
$this->slots[$s] = $this->getSlot();
|
||||
}
|
||||
if($this->windowid === 1){ //Armor is sent
|
||||
for($s = 0; $s < 4; ++$s){
|
||||
$this->armor[$s] = $this->getSlot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putByte($this->windowid);
|
||||
$this->putShort(count($this->slots));
|
||||
foreach($this->slots as $slot){
|
||||
$this->putSlot($slot);
|
||||
}
|
||||
if($this->windowid === 1 and count($this->armor) === 4){
|
||||
for($s = 0; $s < 4; ++$s){
|
||||
$this->putSlot($this->armor[$s]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -45,7 +45,7 @@ class SetEntityDataPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->put(Binary::writeMetadata($this->metadata));
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class SetEntityMotionPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putInt(count($this->entities));
|
||||
foreach($this->entities as $d){
|
||||
$this->putInt($d[0]); //eid
|
||||
$this->putLong($d[0]); //eid
|
||||
$this->putShort((int) ($d[1] * 8000)); //motX
|
||||
$this->putShort((int) ($d[2] * 8000)); //motY
|
||||
$this->putShort((int) ($d[3] * 8000)); //motZ
|
||||
|
@ -52,7 +52,7 @@ class StartGamePacket extends DataPacket{
|
||||
$this->putInt($this->seed);
|
||||
$this->putInt($this->generator);
|
||||
$this->putInt($this->gamemode);
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
$this->putInt($this->spawnX);
|
||||
$this->putInt($this->spawnY);
|
||||
$this->putInt($this->spawnZ);
|
||||
|
@ -42,7 +42,7 @@ class TakeItemEntityPacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->target);
|
||||
$this->putInt($this->eid);
|
||||
$this->putLong($this->eid);
|
||||
}
|
||||
|
||||
}
|
@ -53,7 +53,7 @@ class UseItemPacket extends DataPacket{
|
||||
$this->face = $this->getByte();
|
||||
$this->item = $this->getShort();
|
||||
$this->meta = $this->getShort();
|
||||
$this->eid = $this->getInt();
|
||||
$this->eid = $this->getLong();
|
||||
$this->fx = $this->getFloat();
|
||||
$this->fy = $this->getFloat();
|
||||
$this->fz = $this->getFloat();
|
||||
|
Loading…
x
Reference in New Issue
Block a user