diff --git a/src/Player.php b/src/Player.php index bc867672..2aebfbd3 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1712,7 +1712,9 @@ class Player{ return; } - switch ($packet->pid()) { + $internalPid = $packet->getInternalPid(); + + switch ($internalPid) { case 0x01: break; case ProtocolInfo::PONG_PACKET: diff --git a/src/network/protocol/ProtocolInfo.php b/src/network/protocol/ProtocolInfo.php index e1779167..b29ad3ef 100644 --- a/src/network/protocol/ProtocolInfo.php +++ b/src/network/protocol/ProtocolInfo.php @@ -267,8 +267,6 @@ abstract class ProtocolInfo7{ // MCPE 0.3 - 0.5 seem using same packet id const INTERACT_PACKET = 0xa0;//Change const USE_ITEM_PACKET = 0xa1; const PLAYER_ACTION_PACKET = 0xa2; - - const HURT_ARMOR_PACKET = 0xa3; const SET_ENTITY_DATA_PACKET = 0xa3; const SET_ENTITY_MOTION_PACKET = 0xa4; //const SET_ENTITY_LINK_PACKET = 0xa?; diff --git a/src/network/protocol/packet/ContainerOpenPacket.php b/src/network/protocol/packet/ContainerOpenPacket.php index 694afa7e..13704ed3 100644 --- a/src/network/protocol/packet/ContainerOpenPacket.php +++ b/src/network/protocol/packet/ContainerOpenPacket.php @@ -28,7 +28,7 @@ class ContainerOpenPacket extends RakNetDataPacket{ $this->putByte($this->windowid); $this->putByte($this->type); $this->putByte($this->slots); - $this->putInt($this->x); + $this->putInt($this->x);//String $this->putInt($this->y); $this->putInt($this->z); } diff --git a/src/network/protocol/packet/ContainerSetContentPacket.php b/src/network/protocol/packet/ContainerSetContentPacket.php index 96a53428..6378c386 100644 --- a/src/network/protocol/packet/ContainerSetContentPacket.php +++ b/src/network/protocol/packet/ContainerSetContentPacket.php @@ -36,7 +36,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{ $this->putSlot($slot); } if($this->windowid === 0 and count($this->hotbar) > 0){ - $this->putShort(count($this->hotbar)); + $this->putShort(count($this->hotbar));//null foreach($this->hotbar as $slot){ $this->putInt($slot); } diff --git a/src/network/protocol/packet/LoginPacket.php b/src/network/protocol/packet/LoginPacket.php index e87ea91d..54135a21 100644 --- a/src/network/protocol/packet/LoginPacket.php +++ b/src/network/protocol/packet/LoginPacket.php @@ -15,7 +15,7 @@ class LoginPacket extends RakNetDataPacket{ $this->username = $this->getString(); $this->protocol1 = $this->getInt(); $this->protocol2 = $this->getInt(); - $this->clientId = $this->getInt(); + $this->clientId = $this->getInt();//null $this->loginData = $this->getString(); $this->PROTOCOL = $this->protocol1; } diff --git a/src/network/protocol/packet/PlaceBlockPacket.php b/src/network/protocol/packet/PlaceBlockPacket.php new file mode 100644 index 00000000..9171f04a --- /dev/null +++ b/src/network/protocol/packet/PlaceBlockPacket.php @@ -0,0 +1,54 @@ +PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) { + return ProtocolInfo7::PLACE_BLOCK_PACKET; + } + return ProtocolInfo::PLACE_BLOCK_PACKET; + } + + public function decode(){ + $this->unknown1 = $this->getInt(); + $this->unknown2 = $this->getInt(); + $this->unknown3 = $this->getInt(); + $this->unknown4 = $this->getByte(); + $this->unknown5 = $this->getByte(); + $this->unknown6 = $this->getByte(); + $this->unknown7 = $this->getByte(); + ConsoleAPI::info("Int1:".$this->unknown1); + ConsoleAPI::info("Int2:".$this->unknown2); + ConsoleAPI::info("Int3:".$this->unknown3); + ConsoleAPI::info("Byte4:".$this->unknown4); + ConsoleAPI::info("Byte5:".$this->unknown5); + ConsoleAPI::info("Byte6:".$this->unknown6); + ConsoleAPI::info("Byte7:".$this->unknown7); + } + + public function encode(){ + $this->reset(); + $this->putInt($this->unknown1); + $this->putInt($this->unknown2); + $this->putInt($this->unknown3); + $this->putByte($this->unknown4); + $this->putByte($this->unknown5); + $this->putByte($this->unknown6); + $this->putByte($this->unknown7); + ConsoleAPI::info("Int1:".$this->unknown1); + ConsoleAPI::info("Int2:".$this->unknown2); + ConsoleAPI::info("Int3:".$this->unknown3); + ConsoleAPI::info("Byte4:".$this->unknown4); + ConsoleAPI::info("Byte5:".$this->unknown5); + ConsoleAPI::info("Byte6:".$this->unknown6); + ConsoleAPI::info("Byte7:".$this->unknown7); + } + +} \ No newline at end of file diff --git a/src/network/protocol/packet/SetTimePacket.php b/src/network/protocol/packet/SetTimePacket.php index 302afd9e..f50af807 100644 --- a/src/network/protocol/packet/SetTimePacket.php +++ b/src/network/protocol/packet/SetTimePacket.php @@ -14,7 +14,7 @@ class SetTimePacket extends RakNetDataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->time); + $this->putInt($this->time);//long $this->putByte($this->started ? 0x80:0x00); } diff --git a/src/network/protocol/packet/StartGamePacket.php b/src/network/protocol/packet/StartGamePacket.php index a746ea3a..bcbd12bb 100644 --- a/src/network/protocol/packet/StartGamePacket.php +++ b/src/network/protocol/packet/StartGamePacket.php @@ -19,7 +19,7 @@ class StartGamePacket extends RakNetDataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->seed); + $this->putInt($this->seed);//long $this->putInt($this->generator); $this->putInt($this->gamemode); $this->putInt($this->eid); diff --git a/src/network/raknet/RakNetParser.php b/src/network/raknet/RakNetParser.php index b193a36b..be0807a9 100644 --- a/src/network/raknet/RakNetParser.php +++ b/src/network/raknet/RakNetParser.php @@ -965,9 +965,9 @@ class RakNetParser{ case ProtocolInfo7::PLAYER_EQUIPMENT_PACKET: $data = new PlayerEquipmentPacket; break; - /*case ProtocolInfo7::PLAYER_ARMOR_EQUIPMENT_PACKET: + case ProtocolInfo7::PLAYER_ARMOR_EQUIPMENT_PACKET: $data = new PlayerArmorEquipmentPacket; - break;*/ + break; case ProtocolInfo7::INTERACT_PACKET: $data = new InteractPacket; break; @@ -977,9 +977,6 @@ class RakNetParser{ case ProtocolInfo7::PLAYER_ACTION_PACKET: $data = new PlayerActionPacket; break; - /*case ProtocolInfo7::HURT_ARMOR_PACKET: - $data = new HurtArmorPacket; - break;*/ case ProtocolInfo7::SET_ENTITY_DATA_PACKET: $data = new SetEntityDataPacket; break; @@ -1013,12 +1010,12 @@ class RakNetParser{ case ProtocolInfo7::CONTAINER_SET_SLOT_PACKET: $data = new ContainerSetSlotPacket; break; - /*case ProtocolInfo7::CONTAINER_SET_DATA_PACKET: + case ProtocolInfo7::CONTAINER_SET_DATA_PACKET: $data = new ContainerSetDataPacket; - break;*/ - /*case ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET: + break; + case ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET: $data = new ContainerSetContentPacket; - break;*/ + break; case ProtocolInfo7::CHAT_PACKET: $data = new ChatPacket; break; @@ -1028,9 +1025,9 @@ class RakNetParser{ case ProtocolInfo7::ENTITY_DATA_PACKET: $data = new EntityDataPacket; break; - /*case ProtocolInfo7::PLAYER_INPUT_PACKET: + case ProtocolInfo7::PLAYER_INPUT_PACKET: $data = new PlayerInputPacket; - break;*/ + break; default: $data = new UnknownPacket(); $data->packetID = $pid;