Beispiel #1
0
 public static function store($value)
 {
     if (\tool::debug()) {
         \tool::fprint("Storing " . get_called_class() . ":{$value}");
     }
     return Writer::convert('d', $value);
 }
Beispiel #2
0
 public static function store($value)
 {
     if ($value < -2147483648 || $value > 2147483647) {
         throw new RangeException('Value is out of allowed range for given type.');
     }
     if (\tool::debug()) {
         \tool::fprint("Storing " . get_called_class() . ":{$value}");
     }
     return Writer::convert('l', (int) $value);
 }
#!/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);