diff --git a/src/pocketmine/network/RakLibInterface.php b/src/pocketmine/network/RakLibInterface.php index 3d6449cda..84b0e03ae 100644 --- a/src/pocketmine/network/RakLibInterface.php +++ b/src/pocketmine/network/RakLibInterface.php @@ -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); diff --git a/src/pocketmine/network/protocol/AddEntityPacket.php b/src/pocketmine/network/protocol/AddEntityPacket.php index a020fc1d0..aac99adc5 100644 --- a/src/pocketmine/network/protocol/AddEntityPacket.php +++ b/src/pocketmine/network/protocol/AddEntityPacket.php @@ -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); @@ -61,4 +61,4 @@ class AddEntityPacket extends DataPacket{ } } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/AddItemEntityPacket.php b/src/pocketmine/network/protocol/AddItemEntityPacket.php index c2786ad94..c8fe7a1aa 100644 --- a/src/pocketmine/network/protocol/AddItemEntityPacket.php +++ b/src/pocketmine/network/protocol/AddItemEntityPacket.php @@ -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); @@ -57,4 +57,4 @@ class AddItemEntityPacket extends DataPacket{ $this->putByte($this->roll); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/AddMobPacket.php b/src/pocketmine/network/protocol/AddMobPacket.php index a5ff3b81f..5a2123e4a 100644 --- a/src/pocketmine/network/protocol/AddMobPacket.php +++ b/src/pocketmine/network/protocol/AddMobPacket.php @@ -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); diff --git a/src/pocketmine/network/protocol/AddPaintingPacket.php b/src/pocketmine/network/protocol/AddPaintingPacket.php index d0272d002..81f25986c 100644 --- a/src/pocketmine/network/protocol/AddPaintingPacket.php +++ b/src/pocketmine/network/protocol/AddPaintingPacket.php @@ -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); @@ -53,4 +53,4 @@ class AddPaintingPacket extends DataPacket{ $this->putString($this->title); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/AddPlayerPacket.php b/src/pocketmine/network/protocol/AddPlayerPacket.php index 5df4fa714..b54dd6b0f 100644 --- a/src/pocketmine/network/protocol/AddPlayerPacket.php +++ b/src/pocketmine/network/protocol/AddPlayerPacket.php @@ -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); @@ -67,4 +67,4 @@ class AddPlayerPacket extends DataPacket{ $this->put(Binary::writeMetadata($this->metadata)); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/AnimatePacket.php b/src/pocketmine/network/protocol/AnimatePacket.php index 6e4eca5db..721132e20 100644 --- a/src/pocketmine/network/protocol/AnimatePacket.php +++ b/src/pocketmine/network/protocol/AnimatePacket.php @@ -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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/EntityEventPacket.php b/src/pocketmine/network/protocol/EntityEventPacket.php index 335612adf..bbd915bb5 100644 --- a/src/pocketmine/network/protocol/EntityEventPacket.php +++ b/src/pocketmine/network/protocol/EntityEventPacket.php @@ -36,14 +36,14 @@ 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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/Info.php b/src/pocketmine/network/protocol/Info.php index 51ec4197e..8fea7506c 100644 --- a/src/pocketmine/network/protocol/Info.php +++ b/src/pocketmine/network/protocol/Info.php @@ -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; } diff --git a/src/pocketmine/network/protocol/InteractPacket.php b/src/pocketmine/network/protocol/InteractPacket.php index d0b209780..06d52d6a9 100644 --- a/src/pocketmine/network/protocol/InteractPacket.php +++ b/src/pocketmine/network/protocol/InteractPacket.php @@ -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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/MoveEntityPacket.php b/src/pocketmine/network/protocol/MoveEntityPacket.php index cf7adf99e..51afde98f 100644 --- a/src/pocketmine/network/protocol/MoveEntityPacket.php +++ b/src/pocketmine/network/protocol/MoveEntityPacket.php @@ -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 @@ -59,4 +59,4 @@ class MoveEntityPacket extends DataPacket{ } } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/MovePlayerPacket.php b/src/pocketmine/network/protocol/MovePlayerPacket.php index 16aa83be0..c5c096371 100644 --- a/src/pocketmine/network/protocol/MovePlayerPacket.php +++ b/src/pocketmine/network/protocol/MovePlayerPacket.php @@ -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); @@ -70,4 +70,4 @@ class MovePlayerPacket extends DataPacket{ $this->putByte($this->teleport == true ? 0x80 : 0x00); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/PlayerActionPacket.php b/src/pocketmine/network/protocol/PlayerActionPacket.php index 22d76159a..285659ea6 100644 --- a/src/pocketmine/network/protocol/PlayerActionPacket.php +++ b/src/pocketmine/network/protocol/PlayerActionPacket.php @@ -45,11 +45,11 @@ 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(){ } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/PlayerArmorEquipmentPacket.php b/src/pocketmine/network/protocol/PlayerArmorEquipmentPacket.php index 493e74c69..5cdad7cd1 100644 --- a/src/pocketmine/network/protocol/PlayerArmorEquipmentPacket.php +++ b/src/pocketmine/network/protocol/PlayerArmorEquipmentPacket.php @@ -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,11 +45,11 @@ 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]); $this->putByte($this->slots[3]); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/PlayerEquipmentPacket.php b/src/pocketmine/network/protocol/PlayerEquipmentPacket.php index a2c88f846..b5d79ef6a 100644 --- a/src/pocketmine/network/protocol/PlayerEquipmentPacket.php +++ b/src/pocketmine/network/protocol/PlayerEquipmentPacket.php @@ -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,10 +46,10 @@ 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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/RemoveEntityPacket.php b/src/pocketmine/network/protocol/RemoveEntityPacket.php index fc414eb4a..8757dcf78 100644 --- a/src/pocketmine/network/protocol/RemoveEntityPacket.php +++ b/src/pocketmine/network/protocol/RemoveEntityPacket.php @@ -40,7 +40,7 @@ class RemoveEntityPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->eid); + $this->putLong($this->eid); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/RemovePlayerPacket.php b/src/pocketmine/network/protocol/RemovePlayerPacket.php index bcf539fac..5f8f4600b 100644 --- a/src/pocketmine/network/protocol/RemovePlayerPacket.php +++ b/src/pocketmine/network/protocol/RemovePlayerPacket.php @@ -41,8 +41,8 @@ class RemovePlayerPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->eid); + $this->putLong($this->eid); $this->putLong($this->clientID); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/RespawnPacket.php b/src/pocketmine/network/protocol/RespawnPacket.php index 9943a86f7..6991b2fa0 100644 --- a/src/pocketmine/network/protocol/RespawnPacket.php +++ b/src/pocketmine/network/protocol/RespawnPacket.php @@ -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,10 +46,10 @@ 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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/RotateHeadPacket.php b/src/pocketmine/network/protocol/RotateHeadPacket.php index 0b93a3613..129df23e6 100644 --- a/src/pocketmine/network/protocol/RotateHeadPacket.php +++ b/src/pocketmine/network/protocol/RotateHeadPacket.php @@ -50,9 +50,9 @@ 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)); } } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/SendInventoryPacket.php b/src/pocketmine/network/protocol/SendInventoryPacket.php deleted file mode 100644 index 3133af325..000000000 --- a/src/pocketmine/network/protocol/SendInventoryPacket.php +++ /dev/null @@ -1,69 +0,0 @@ - - - -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]); - } - } - } - -} \ No newline at end of file diff --git a/src/pocketmine/network/protocol/SetEntityDataPacket.php b/src/pocketmine/network/protocol/SetEntityDataPacket.php index 23842fe23..55178357e 100644 --- a/src/pocketmine/network/protocol/SetEntityDataPacket.php +++ b/src/pocketmine/network/protocol/SetEntityDataPacket.php @@ -45,8 +45,8 @@ class SetEntityDataPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->eid); + $this->putLong($this->eid); $this->put(Binary::writeMetadata($this->metadata)); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/SetEntityMotionPacket.php b/src/pocketmine/network/protocol/SetEntityMotionPacket.php index d73433b98..1c6babc8c 100644 --- a/src/pocketmine/network/protocol/SetEntityMotionPacket.php +++ b/src/pocketmine/network/protocol/SetEntityMotionPacket.php @@ -50,11 +50,11 @@ 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 } } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/StartGamePacket.php b/src/pocketmine/network/protocol/StartGamePacket.php index 459dce4f7..5f3fcce91 100644 --- a/src/pocketmine/network/protocol/StartGamePacket.php +++ b/src/pocketmine/network/protocol/StartGamePacket.php @@ -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); @@ -61,4 +61,4 @@ class StartGamePacket extends DataPacket{ $this->putFloat($this->z); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/TakeItemEntityPacket.php b/src/pocketmine/network/protocol/TakeItemEntityPacket.php index 1e4dddba0..5fef8888c 100644 --- a/src/pocketmine/network/protocol/TakeItemEntityPacket.php +++ b/src/pocketmine/network/protocol/TakeItemEntityPacket.php @@ -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); } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/UseItemPacket.php b/src/pocketmine/network/protocol/UseItemPacket.php index 73afa9619..ead8d5237 100644 --- a/src/pocketmine/network/protocol/UseItemPacket.php +++ b/src/pocketmine/network/protocol/UseItemPacket.php @@ -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(); @@ -66,4 +66,4 @@ class UseItemPacket extends DataPacket{ } -} \ No newline at end of file +}