diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index 9d9b121ef..0fd712e7f 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -37,6 +37,7 @@ use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\IntTag; use pocketmine\network\mcpe\protocol\types\CommandOriginData; use pocketmine\network\mcpe\protocol\types\EntityLink; +use pocketmine\network\mcpe\protocol\types\GameRuleType; use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor; use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece; use pocketmine\network\mcpe\protocol\types\SkinAnimation; @@ -602,13 +603,13 @@ class NetworkBinaryStream extends BinaryStream{ $type = $this->getUnsignedVarInt(); $value = null; switch($type){ - case 1: + case GameRuleType::BOOL: $value = $this->getBool(); break; - case 2: + case GameRuleType::INT: $value = $this->getUnsignedVarInt(); break; - case 3: + case GameRuleType::FLOAT: $value = $this->getLFloat(); break; } @@ -632,13 +633,13 @@ class NetworkBinaryStream extends BinaryStream{ $this->putString($name); $this->putUnsignedVarInt($rule[0]); switch($rule[0]){ - case 1: + case GameRuleType::BOOL: $this->putBool($rule[1]); break; - case 2: + case GameRuleType::INT: $this->putUnsignedVarInt($rule[1]); break; - case 3: + case GameRuleType::FLOAT: $this->putLFloat($rule[1]); break; } diff --git a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php index 104db48eb..1b38c0fdf 100644 --- a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php +++ b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php @@ -31,6 +31,7 @@ use pocketmine\nbt\tag\ListTag; use pocketmine\network\mcpe\NetworkBinaryStream; use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\types\EducationEditionOffer; +use pocketmine\network\mcpe\protocol\types\GameRuleType; use pocketmine\network\mcpe\protocol\types\GeneratorType; use pocketmine\network\mcpe\protocol\types\MultiplayerGameVisibility; use pocketmine\network\mcpe\protocol\types\PlayerPermissions; @@ -110,7 +111,7 @@ class StartGamePacket extends DataPacket{ * @phpstan-var array */ public $gameRules = [ //TODO: implement this - "naturalregeneration" => [1, false] //Hack for client side regeneration + "naturalregeneration" => [GameRuleType::BOOL, false] //Hack for client side regeneration ]; /** @var bool */ public $hasBonusChestEnabled = false;