mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Guess NBTTag_List components type automatically
This commit is contained in:
parent
734b066131
commit
914098310c
@ -168,6 +168,17 @@ class NBTTag_List extends NamedNBTTag implements ArrayAccess, Iterator{
|
||||
}
|
||||
|
||||
public function write(NBT $nbt){
|
||||
if(!isset($this->tagType)){
|
||||
foreach($this->value as $tag){
|
||||
if(!isset($id)){
|
||||
$id = $tag->getType();
|
||||
}elseif($id !== $tag->getType()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->tagType = $id;
|
||||
}
|
||||
|
||||
$nbt->putByte($this->tagType);
|
||||
$nbt->putInt(count($this->value));
|
||||
foreach($this->value as $tag){
|
||||
|
Loading…
x
Reference in New Issue
Block a user