diff --git a/src/network/protocol/packet/AdventureSettingsPacket.php b/src/network/protocol/packet/AdventureSettingsPacket.php index b287c9d52..930941012 100644 --- a/src/network/protocol/packet/AdventureSettingsPacket.php +++ b/src/network/protocol/packet/AdventureSettingsPacket.php @@ -31,6 +31,7 @@ class AdventureSettingsPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putInt($this->flags); } diff --git a/src/network/protocol/packet/ChatPacket.php b/src/network/protocol/packet/ChatPacket.php index f04edef68..8c142976f 100644 --- a/src/network/protocol/packet/ChatPacket.php +++ b/src/network/protocol/packet/ChatPacket.php @@ -31,6 +31,7 @@ class ChatPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putString($this->message); } diff --git a/src/network/protocol/packet/ContainerSetContentPacket.php b/src/network/protocol/packet/ContainerSetContentPacket.php index bdcae1d28..e648c94da 100644 --- a/src/network/protocol/packet/ContainerSetContentPacket.php +++ b/src/network/protocol/packet/ContainerSetContentPacket.php @@ -43,6 +43,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putByte($this->windowid); $this->putShort(count($this->slots)); foreach($this->slots as $slot){ diff --git a/src/network/protocol/packet/ContainerSetDataPacket.php b/src/network/protocol/packet/ContainerSetDataPacket.php index 2a36d2222..e18b6cb77 100644 --- a/src/network/protocol/packet/ContainerSetDataPacket.php +++ b/src/network/protocol/packet/ContainerSetDataPacket.php @@ -33,6 +33,7 @@ class ContainerSetDataPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putByte($this->windowid); $this->putShort($this->property); $this->putShort($this->value); diff --git a/src/network/protocol/packet/ContainerSetSlotPacket.php b/src/network/protocol/packet/ContainerSetSlotPacket.php index 0ab886d45..6f1a2079d 100644 --- a/src/network/protocol/packet/ContainerSetSlotPacket.php +++ b/src/network/protocol/packet/ContainerSetSlotPacket.php @@ -35,6 +35,7 @@ class ContainerSetSlotPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putByte($this->windowid); $this->putShort($this->slot); $this->putSlot($this->item); diff --git a/src/network/protocol/packet/DisconnectPacket.php b/src/network/protocol/packet/DisconnectPacket.php index d255d9b5b..42bfaba88 100644 --- a/src/network/protocol/packet/DisconnectPacket.php +++ b/src/network/protocol/packet/DisconnectPacket.php @@ -29,7 +29,7 @@ class DisconnectPacket extends RakNetDataPacket{ } public function encode(){ - + $this->reset(); } } \ No newline at end of file diff --git a/src/network/protocol/packet/EntityDataPacket.php b/src/network/protocol/packet/EntityDataPacket.php index f906814e6..16a59db1e 100644 --- a/src/network/protocol/packet/EntityDataPacket.php +++ b/src/network/protocol/packet/EntityDataPacket.php @@ -37,6 +37,7 @@ class EntityDataPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putShort($this->x); $this->putByte($this->y); $this->putShort($this->z); diff --git a/src/network/protocol/packet/MoveEntityPacket.php b/src/network/protocol/packet/MoveEntityPacket.php index 37086ecf8..ba0a672dd 100644 --- a/src/network/protocol/packet/MoveEntityPacket.php +++ b/src/network/protocol/packet/MoveEntityPacket.php @@ -30,7 +30,7 @@ class MoveEntityPacket extends RakNetDataPacket{ } public function encode(){ - + $this->reset(); } } \ No newline at end of file diff --git a/src/network/protocol/packet/SetSpawnPositionPacket.php b/src/network/protocol/packet/SetSpawnPositionPacket.php index 2217d0155..baed71d8f 100644 --- a/src/network/protocol/packet/SetSpawnPositionPacket.php +++ b/src/network/protocol/packet/SetSpawnPositionPacket.php @@ -33,6 +33,7 @@ class SetSpawnPositionPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putInt($this->x); $this->putInt($this->z); $this->putByte($this->y); diff --git a/src/network/protocol/packet/UpdateBlockPacket.php b/src/network/protocol/packet/UpdateBlockPacket.php index 11095e8ef..9fea1461e 100644 --- a/src/network/protocol/packet/UpdateBlockPacket.php +++ b/src/network/protocol/packet/UpdateBlockPacket.php @@ -35,6 +35,7 @@ class UpdateBlockPacket extends RakNetDataPacket{ } public function encode(){ + $this->reset(); $this->putInt($this->x); $this->putInt($this->z); $this->putByte($this->y); diff --git a/src/network/raknet/RakNetCodec.php b/src/network/raknet/RakNetCodec.php index 209ba1762..a009f63d2 100644 --- a/src/network/raknet/RakNetCodec.php +++ b/src/network/raknet/RakNetCodec.php @@ -144,9 +144,8 @@ class RakNetCodec{ $this->putInt($pk->splitCount); $this->putShort($pk->splitID); $this->putInt($pk->splitIndex); - }else{ - $this->putByte($pk->pid()); - } + } + $this->buffer .= $pk->buffer; }