mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Moved binary methods from Utils to Binary
This commit is contained in:
@ -38,6 +38,7 @@ use pocketmine\nbt\tag\NamedTAG;
|
||||
use pocketmine\nbt\tag\Short;
|
||||
use pocketmine\nbt\tag\String;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use pocketmine\utils\Binary;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
/**
|
||||
@ -188,51 +189,51 @@ class NBT{
|
||||
}
|
||||
|
||||
public function getByte($signed = false){
|
||||
return Utils::readByte($this->get(1), $signed);
|
||||
return Binary::readByte($this->get(1), $signed);
|
||||
}
|
||||
|
||||
public function putByte($v){
|
||||
$this->buffer .= Utils::writeByte($v);
|
||||
$this->buffer .= Binary::writeByte($v);
|
||||
}
|
||||
|
||||
public function getShort(){
|
||||
return $this->endianness === self::BIG_ENDIAN ? Utils::readShort($this->get(2)) : Utils::readLShort($this->get(2));
|
||||
return $this->endianness === self::BIG_ENDIAN ? Binary::readShort($this->get(2)) : Binary::readLShort($this->get(2));
|
||||
}
|
||||
|
||||
public function putShort($v){
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Utils::writeShort($v) : Utils::writeLShort($v);
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeShort($v) : Binary::writeLShort($v);
|
||||
}
|
||||
|
||||
public function getInt(){
|
||||
return $this->endianness === self::BIG_ENDIAN ? Utils::readInt($this->get(4)) : Utils::readLInt($this->get(4));
|
||||
return $this->endianness === self::BIG_ENDIAN ? Binary::readInt($this->get(4)) : Binary::readLInt($this->get(4));
|
||||
}
|
||||
|
||||
public function putInt($v){
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Utils::writeInt($v) : Utils::writeLInt($v);
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeInt($v) : Binary::writeLInt($v);
|
||||
}
|
||||
|
||||
public function getLong(){
|
||||
return $this->endianness === self::BIG_ENDIAN ? Utils::readLong($this->get(8)) : Utils::readLLong($this->get(8));
|
||||
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 ? Utils::writeLong($v) : Utils::writeLLong($v);
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v);
|
||||
}
|
||||
|
||||
public function getFloat(){
|
||||
return $this->endianness === self::BIG_ENDIAN ? Utils::readFloat($this->get(4)) : Utils::readLFloat($this->get(4));
|
||||
return $this->endianness === self::BIG_ENDIAN ? Binary::readFloat($this->get(4)) : Binary::readLFloat($this->get(4));
|
||||
}
|
||||
|
||||
public function putFloat($v){
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Utils::writeFloat($v) : Utils::writeLFloat($v);
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeFloat($v) : Binary::writeLFloat($v);
|
||||
}
|
||||
|
||||
public function getDouble(){
|
||||
return $this->endianness === self::BIG_ENDIAN ? Utils::readDouble($this->get(8)) : Utils::readLDouble($this->get(8));
|
||||
return $this->endianness === self::BIG_ENDIAN ? Binary::readDouble($this->get(8)) : Binary::readLDouble($this->get(8));
|
||||
}
|
||||
|
||||
public function putDouble($v){
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Utils::writeDouble($v) : Utils::writeLDouble($v);
|
||||
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeDouble($v) : Binary::writeLDouble($v);
|
||||
}
|
||||
|
||||
public function getString(){
|
||||
|
Reference in New Issue
Block a user