Esempio n. 1
0
 public static function readFrom(Reader $file, TAG_Array $into = null)
 {
     \tool::fprint("Reading ... " . get_called_class() . "::" . __FUNCTION__);
     $self = $into ?: new static();
     while ($tag = $file->read()) {
         if ($tag instanceof TAG_End) {
             break;
         } else {
             $self[] = $tag;
         }
     }
     return $self;
 }
Esempio n. 2
0
#!/usr/bin/env php -f
<?php 
if (version_compare(PHP_VERSION, '7.0', '<')) {
    throw new Exception('Go upgrade, k?');
}
require_once dirname(__DIR__) . '/vendor/autoload.php';
use AnrDaemon\Minecraft\NBT;
$file = new NBT\Reader(new \SplFileObject('compress.zlib://' . __DIR__ . '/level.dat', 'rb'));
$nbt = $file->read();
unset($file);
var_dump($nbt);
$file = new NBT\Writer(new \SplFileObject(__DIR__ . '/level.flat', 'wb'));
$file->write($nbt);
unset($file);