pocketmine\nbt\tag\ByteArrayTag::read PHP Méthode

read() public méthode

public read ( NBT $nbt, boolean $network = false )
$nbt pocketmine\nbt\NBT
$network boolean
    public function read(NBT $nbt, bool $network = false)
    {
        $this->value = $nbt->get($nbt->getInt($network));
    }

Usage Example

Exemple #1
0
 public function read(NBT $nbt, bool $network = false)
 {
     $this->value = [];
     $this->tagType = $nbt->getByte();
     $size = $nbt->getInt($network);
     for ($i = 0; $i < $size and !$nbt->feof(); ++$i) {
         switch ($this->tagType) {
             case NBT::TAG_Byte:
                 $tag = new ByteTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Short:
                 $tag = new ShortTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Int:
                 $tag = new IntTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Long:
                 $tag = new LongTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Float:
                 $tag = new FloatTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Double:
                 $tag = new DoubleTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_ByteArray:
                 $tag = new ByteArrayTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_String:
                 $tag = new StringTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_List:
                 $tag = new TagEnum("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_Compound:
                 $tag = new CompoundTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
             case NBT::TAG_IntArray:
                 $tag = new IntArrayTag("");
                 $tag->read($nbt, $network);
                 $this->{$i} = $tag;
                 break;
         }
     }
 }
All Usage Examples Of pocketmine\nbt\tag\ByteArrayTag::read