Merge branch 'php/7.0' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor 2017-09-02 18:57:39 +01:00
commit ca84532640
2 changed files with 12 additions and 7 deletions

View File

@ -308,12 +308,19 @@ class NBT{
}
}
public function getLong() : int{
public function getLong(bool $network = false) : int{
if($network){
return Binary::readVarLong($this->buffer, $this->offset);
}
return $this->endianness === self::BIG_ENDIAN ? Binary::readLong($this->get(8)) : Binary::readLLong($this->get(8));
}
public function putLong($v){
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v);
public function putLong($v, bool $network = false){
if($network){
$this->buffer .= Binary::writeVarLong($v);
}else{
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v);
}
}
public function getFloat() : float{

View File

@ -43,13 +43,11 @@ class LongTag extends NamedTag{
return NBT::TAG_Long;
}
//TODO: check if this also changed to varint
public function read(NBT $nbt, bool $network = false){
$this->value = $nbt->getLong();
$this->value = $nbt->getLong($network);
}
public function write(NBT $nbt, bool $network = false){
$nbt->putLong($this->value);
$nbt->putLong($this->value, $network);
}
}