Guess NBTTag_List components type automatically

This commit is contained in:
Shoghi Cervantes 2014-03-01 11:26:19 +01:00
parent 734b066131
commit 914098310c

View File

@ -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){