mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
make use of new GameRuleType constants
This commit is contained in:
parent
66d44aa814
commit
fd63f19199
@ -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;
|
||||
}
|
||||
|
@ -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<string, array{0: int, 1: bool|int|float}>
|
||||
*/
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user