mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 10:19:39 +00:00
Use getBool() more
This commit is contained in:
parent
c51c8ae700
commit
71af694cc1
@ -42,7 +42,7 @@ class CommandStepPacket extends DataPacket{
|
|||||||
$this->overload = $this->getString();
|
$this->overload = $this->getString();
|
||||||
$this->uvarint1 = $this->getUnsignedVarInt();
|
$this->uvarint1 = $this->getUnsignedVarInt();
|
||||||
$this->currentStep = $this->getUnsignedVarInt();
|
$this->currentStep = $this->getUnsignedVarInt();
|
||||||
$this->done = (bool) $this->getByte();
|
$this->done = $this->getBool();
|
||||||
$this->clientId = $this->getUnsignedVarLong();
|
$this->clientId = $this->getUnsignedVarLong();
|
||||||
$this->inputJson = json_decode($this->getString());
|
$this->inputJson = json_decode($this->getString());
|
||||||
$this->outputJson = $this->getString();
|
$this->outputJson = $this->getString();
|
||||||
|
@ -45,8 +45,8 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
$this->pitch = $this->getByte() * (360.0 / 256);
|
$this->pitch = $this->getByte() * (360.0 / 256);
|
||||||
$this->headYaw = $this->getByte() * (360.0 / 256);
|
$this->headYaw = $this->getByte() * (360.0 / 256);
|
||||||
$this->yaw = $this->getByte() * (360.0 / 256);
|
$this->yaw = $this->getByte() * (360.0 / 256);
|
||||||
$this->onGround = $this->getByte();
|
$this->onGround = $this->getBool();
|
||||||
$this->teleported = $this->getByte();
|
$this->teleported = $this->getBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
@ -56,8 +56,8 @@ class MoveEntityPacket extends DataPacket{
|
|||||||
$this->putByte($this->pitch / (360.0 / 256));
|
$this->putByte($this->pitch / (360.0 / 256));
|
||||||
$this->putByte($this->headYaw / (360.0 / 256));
|
$this->putByte($this->headYaw / (360.0 / 256));
|
||||||
$this->putByte($this->yaw / (360.0 / 256));
|
$this->putByte($this->yaw / (360.0 / 256));
|
||||||
$this->putByte($this->onGround);
|
$this->putBool($this->onGround);
|
||||||
$this->putByte($this->teleported);
|
$this->putBool($this->teleported);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(NetworkSession $session) : bool{
|
public function handle(NetworkSession $session) : bool{
|
||||||
|
@ -71,11 +71,11 @@ class BinaryStream extends \stdClass{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getBool() : bool{
|
public function getBool() : bool{
|
||||||
return (bool) $this->getByte();
|
return $this->get(1) !== "\x00";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putBool($v){
|
public function putBool($v){
|
||||||
$this->putByte((bool) $v);
|
$this->buffer .= ($v ? "\x01" : "\x00");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLong(){
|
public function getLong(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user