mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 12:48:32 +00:00
Fixed LongTags in tile NBT
This commit is contained in:
parent
62aba15f9e
commit
4d8d57ca5e
@ -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));
|
return $this->endianness === self::BIG_ENDIAN ? Binary::readLong($this->get(8)) : Binary::readLLong($this->get(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putLong($v){
|
public function putLong($v, bool $network = false){
|
||||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v);
|
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{
|
public function getFloat() : float{
|
||||||
|
@ -43,13 +43,11 @@ class LongTag extends NamedTag{
|
|||||||
return NBT::TAG_Long;
|
return NBT::TAG_Long;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: check if this also changed to varint
|
|
||||||
|
|
||||||
public function read(NBT $nbt, bool $network = false){
|
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){
|
public function write(NBT $nbt, bool $network = false){
|
||||||
$nbt->putLong($this->value);
|
$nbt->putLong($this->value, $network);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user