mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 11:16:57 +00:00
Solved packet encode/decode boilerplate code issue
Something as simple as forgetting the reset() when encoding would cause lots of problems which could go unnoticed. This should be fully backwards-compatible but needs more tests.
This commit is contained in:
@ -64,7 +64,7 @@ class BossEventPacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $overlay;
|
||||
|
||||
public function decode(){
|
||||
public function decodePayload(){
|
||||
$this->bossEid = $this->getEntityUniqueId();
|
||||
$this->eventType = $this->getUnsignedVarInt();
|
||||
switch($this->eventType){
|
||||
@ -91,8 +91,7 @@ class BossEventPacket extends DataPacket{
|
||||
}
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
public function encodePayload(){
|
||||
$this->putEntityUniqueId($this->bossEid);
|
||||
$this->putUnsignedVarInt($this->eventType);
|
||||
switch($this->eventType){
|
||||
|
Reference in New Issue
Block a user