Use getBool() more

This commit is contained in:
Dylan K. Taylor 2017-05-10 11:30:24 +01:00
parent c51c8ae700
commit 71af694cc1
3 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ class CommandStepPacket extends DataPacket{
$this->overload = $this->getString();
$this->uvarint1 = $this->getUnsignedVarInt();
$this->currentStep = $this->getUnsignedVarInt();
$this->done = (bool) $this->getByte();
$this->done = $this->getBool();
$this->clientId = $this->getUnsignedVarLong();
$this->inputJson = json_decode($this->getString());
$this->outputJson = $this->getString();

View File

@ -45,8 +45,8 @@ class MoveEntityPacket extends DataPacket{
$this->pitch = $this->getByte() * (360.0 / 256);
$this->headYaw = $this->getByte() * (360.0 / 256);
$this->yaw = $this->getByte() * (360.0 / 256);
$this->onGround = $this->getByte();
$this->teleported = $this->getByte();
$this->onGround = $this->getBool();
$this->teleported = $this->getBool();
}
public function encode(){
@ -56,8 +56,8 @@ class MoveEntityPacket extends DataPacket{
$this->putByte($this->pitch / (360.0 / 256));
$this->putByte($this->headYaw / (360.0 / 256));
$this->putByte($this->yaw / (360.0 / 256));
$this->putByte($this->onGround);
$this->putByte($this->teleported);
$this->putBool($this->onGround);
$this->putBool($this->teleported);
}
public function handle(NetworkSession $session) : bool{

View File

@ -71,11 +71,11 @@ class BinaryStream extends \stdClass{
}
public function getBool() : bool{
return (bool) $this->getByte();
return $this->get(1) !== "\x00";
}
public function putBool($v){
$this->putByte((bool) $v);
$this->buffer .= ($v ? "\x01" : "\x00");
}
public function getLong(){