get() public method

public get ( $len )
Ejemplo n.º 1
0
 public function read(NBT $nbt)
 {
     $this->value = [];
     $size = $nbt->endianness === 1 ? \PHP_INT_SIZE === 8 ? \unpack("N", $nbt->get(4))[1] << 32 >> 32 : \unpack("N", $nbt->get(4))[1] : (\PHP_INT_SIZE === 8 ? \unpack("V", $nbt->get(4))[1] << 32 >> 32 : \unpack("V", $nbt->get(4))[1]);
     $value = \unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4));
     foreach ($value as $i => $v) {
         $this->value[$i - 1] = $v;
     }
 }
Ejemplo n.º 2
0
 public function read(NBT $nbt)
 {
     $this->value = [];
     $size = $nbt->getInt();
     $value = unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4));
     foreach ($value as $i => $v) {
         $this->value[$i - 1] = $v;
     }
 }
Ejemplo n.º 3
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->get($nbt->getInt());
 }
Ejemplo n.º 4
0
 public function read(NBT $nbt)
 {
     $this->value = [];
     $this->tagType = \ord($nbt->get(1));
     $size = $nbt->endianness === 1 ? \PHP_INT_SIZE === 8 ? \unpack("N", $nbt->get(4))[1] << 32 >> 32 : \unpack("N", $nbt->get(4))[1] : (\PHP_INT_SIZE === 8 ? \unpack("V", $nbt->get(4))[1] << 32 >> 32 : \unpack("V", $nbt->get(4))[1]);
     for ($i = 0; $i < $size and !$nbt->feof(); ++$i) {
         switch ($this->tagType) {
             case NBT::TAG_Byte:
                 $tag = new Byte("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Short:
                 $tag = new Short("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Int:
                 $tag = new Int("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Long:
                 $tag = new Long("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Float:
                 $tag = new Float("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Double:
                 $tag = new Double("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_ByteArray:
                 $tag = new ByteArray("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_String:
                 $tag = new String("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Enum:
                 $tag = new TagEnum("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Compound:
                 $tag = new Compound("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_IntArray:
                 $tag = new IntArray("");
                 $tag->read($nbt);
                 $this->{$i} = $tag;
                 break;
         }
     }
 }
Ejemplo n.º 5
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? \ENDIANNESS === 0 ? \unpack("d", $nbt->get(8))[1] : \unpack("d", \strrev($nbt->get(8)))[1] : (\ENDIANNESS === 0 ? \unpack("d", \strrev($nbt->get(8)))[1] : \unpack("d", $nbt->get(8))[1]);
 }
Ejemplo n.º 6
0
 public function read(NBT $nbt)
 {
     [];
     $size = $nbt->getInt();
     $this->value = array_values(unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4)));
 }
Ejemplo n.º 7
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? \unpack("N", $nbt->get(4))[1] << 32 >> 32 : \unpack("V", $nbt->get(4))[1] << 32 >> 32;
 }
Ejemplo n.º 8
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? Binary::readLong($nbt->get(8)) : Binary::readLLong($nbt->get(8));
 }
Ejemplo n.º 9
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? unpack("n", $nbt->get(2))[1] : unpack("v", $nbt->get(2))[1];
 }
Ejemplo n.º 10
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? \PHP_INT_SIZE === 8 ? \unpack("N", $nbt->get(4))[1] << 32 >> 32 : \unpack("N", $nbt->get(4))[1] : (\PHP_INT_SIZE === 8 ? \unpack("V", $nbt->get(4))[1] << 32 >> 32 : \unpack("V", $nbt->get(4))[1]);
 }
Ejemplo n.º 11
0
 public function read(NBT $nbt)
 {
     [];
     $size = $nbt->endianness === 1 ? \unpack("N", $nbt->get(4))[1] : \unpack("V", $nbt->get(4))[1];
     $this->value = \array_values(\unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4)));
 }
Ejemplo n.º 12
0
 public function read(NBT $nbt)
 {
     $this->value = $nbt->endianness === 1 ? \ENDIANNESS === 0 ? unpack("f", $nbt->get(4))[1] : unpack("f", strrev($nbt->get(4)))[1] : (\ENDIANNESS === 0 ? unpack("f", strrev($nbt->get(4)))[1] : unpack("f", $nbt->get(4))[1]);
 }
Ejemplo n.º 13
0
 public function read(NBT $nbt)
 {
     $this->value = [];
     $size = $nbt->endianness === 1 ? PHP_INT_SIZE === 8 ? unpack("N", $nbt->get(4))[1] << 32 >> 32 : unpack("N", $nbt->get(4))[1] : (PHP_INT_SIZE === 8 ? unpack("V", $nbt->get(4))[1] << 32 >> 32 : unpack("V", $nbt->get(4))[1]);
     $this->value = unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4));
 }
Ejemplo n.º 14
0
 public function read(NBT $nbt, bool $network = false)
 {
     $this->value = $nbt->get($nbt->getInt($network));
 }
Ejemplo n.º 15
0
 public function read(NBT $nbt)
 {
     $this->value = \ord($nbt->get(1));
 }
Ejemplo n.º 16
0
 public function read(NBT $nbt, bool $network = false)
 {
     $size = $nbt->getInt($network);
     $this->value = array_values(unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", $nbt->get($size * 4)));
 }