This commit is contained in:
Shoghi Cervantes 2014-03-06 17:24:26 +01:00
parent 18443c0cd7
commit 5c00b415a5
4 changed files with 15 additions and 10 deletions

View File

@ -92,10 +92,6 @@ class NBT implements \ArrayAccess{
public function readTag(){ public function readTag(){
switch($this->getByte()){ switch($this->getByte()){
case NBT\TAG_Byte:
$tag = new Byte($this->getString());
$tag->read($this);
break;
case NBT\TAG_Byte: case NBT\TAG_Byte:
$tag = new Byte($this->getString()); $tag = new Byte($this->getString());
$tag->read($this); $tag->read($this);

View File

@ -26,6 +26,13 @@ use PocketMine\NBT;
class Compound extends NamedNBTTag implements \ArrayAccess, \Iterator{ class Compound extends NamedNBTTag implements \ArrayAccess, \Iterator{
public function __construct($name = "", $value = array()){
$this->name = $name;
if($value !== false){
$this->value = $value;
}
}
public function getType(){ public function getType(){
return NBT\TAG_Compound; return NBT\TAG_Compound;
} }

View File

@ -29,6 +29,13 @@ class Enum extends NamedNBTTag implements \ArrayAccess, \Iterator{
private $tagType; private $tagType;
public function __construct($name = "", $value = array()){
$this->name = $name;
if($value !== false){
$this->value = $value;
}
}
public function getType(){ public function getType(){
return NBT\TAG_Enum; return NBT\TAG_Enum;
} }
@ -110,11 +117,6 @@ class Enum extends NamedNBTTag implements \ArrayAccess, \Iterator{
$size = $nbt->getInt(); $size = $nbt->getInt();
for($i = 0; $i < $size and !$nbt->feof(); ++$i){ for($i = 0; $i < $size and !$nbt->feof(); ++$i){
switch($this->tagType){ switch($this->tagType){
case NBT\TAG_Byte:
$tag = new Byte(false);
$tag->read($nbt);
$this->value[] = $tag;
break;
case NBT\TAG_Byte: case NBT\TAG_Byte:
$tag = new Byte(false); $tag = new Byte(false);
$tag->read($nbt); $tag->read($nbt);

View File

@ -141,6 +141,6 @@ class Async extends Thread{
$this->join(); $this->join();
} }
return $this->result; return (string) $this->result;
} }
} }