Fixed TAG_Short being read as unsigned

This commit is contained in:
Dylan K. Taylor 2017-06-24 11:20:50 +01:00
parent a1ce535d02
commit 22d148a59d
2 changed files with 5 additions and 1 deletions

View File

@ -285,6 +285,10 @@ class NBT{
return $this->endianness === self::BIG_ENDIAN ? Binary::readShort($this->get(2)) : Binary::readLShort($this->get(2));
}
public function getSignedShort() : int{
return $this->endianness === self::BIG_ENDIAN ? Binary::readSignedShort($this->get(2)) : Binary::readSignedLShort($this->get(2));
}
public function putShort($v){
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeShort($v) : Binary::writeLShort($v);
}

View File

@ -44,7 +44,7 @@ class ShortTag extends NamedTag{
}
public function read(NBT $nbt, bool $network = false){
$this->value = $nbt->getShort();
$this->value = $nbt->getSignedShort();
}
public function write(NBT $nbt, bool $network = false){