putInt() public method

public putInt ( $v )
Exemplo n.º 1
0
 public function write(NBT $nbt)
 {
     $nbt->putInt(strlen($this->value));
     $nbt->put($this->value);
 }
Exemplo n.º 2
0
 public function write(NBT $nbt)
 {
     if (!isset($this->tagType)) {
         $id = null;
         foreach ($this as $tag) {
             if ($tag instanceof Tag) {
                 if (!isset($id)) {
                     $id = $tag->getType();
                 } elseif ($id !== $tag->getType()) {
                     return false;
                 }
             }
         }
         $this->tagType = $id;
     }
     $nbt->putByte($this->tagType);
     /** @var Tag[] $tags */
     $tags = [];
     foreach ($this as $tag) {
         if ($tag instanceof Tag) {
             $tags[] = $tag;
         }
     }
     $nbt->putInt(count($tags));
     foreach ($tags as $tag) {
         $tag->write($nbt);
     }
 }
Exemplo n.º 3
0
 public function write(NBT $nbt)
 {
     $nbt->putInt(count($this->value));
     $nbt->put(pack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", ...$this->value));
 }
Exemplo n.º 4
0
 public function write(NBT $nbt, bool $network = false)
 {
     $nbt->putInt(strlen($this->value), $network);
     $nbt->put($this->value);
 }