Improved Falling blocks physics, entity kill, chunk unserialize, fixed flat generator color, fixed nbt tags __toString(), fixed explosion offsets, fixed increased player interaction range in creative

This commit is contained in:
Shoghi Cervantes
2015-05-13 12:18:59 +02:00
parent f3bdef7513
commit b1edfd7631
14 changed files with 84 additions and 52 deletions

View File

@ -88,4 +88,14 @@ class Compound extends NamedTag implements \ArrayAccess{
}
$nbt->writeTag(new End);
}
public function __toString(){
$str = get_class($this) . "{\n";
foreach($this as $tag){
if($tag instanceof Tag){
$str .= get_class($tag) . ":" . $tag->__toString() . "\n";
}
}
return $str . "}";
}
}

View File

@ -197,4 +197,14 @@ class Enum extends NamedTag implements \ArrayAccess, \Countable{
$tag->write($nbt);
}
}
public function __toString(){
$str = get_class($this) . "{\n";
foreach($this as $tag){
if($tag instanceof Tag){
$str .= get_class($tag) . ":" . $tag->__toString() . "\n";
}
}
return $str . "}";
}
}

View File

@ -44,4 +44,10 @@ class IntArray extends NamedTag{
$nbt->putInt(count($this->value));
$nbt->put(pack($nbt->endianness === NBT::LITTLE_ENDIAN ? "V*" : "N*", ...$this->value));
}
public function __toString(){
$str = get_class($this) . "{\n";
$str .= implode(", ", $this->value);
return $str . "}";
}
}

View File

@ -44,7 +44,7 @@ abstract class Tag extends \stdClass{
abstract public function read(NBT $nbt);
public final function __toString(){
public function __toString(){
return (string) $this->value;
}
}