PHP code example of aternos / thanos

1. Go to this page and download the library: Download aternos/thanos library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aternos / thanos example snippets


$world = new Aternos\Thanos\World\AnvilWorld("/path/to/world/directory", "/path/to/output/directory");
$world->copyOtherFiles(); //copy non-region files

foreach ($world as $chunk){
  echo $chunk->getInhabitedTime() . "\n"; //output inhabited time for each chunk
}

if($chunk->getInhabitedTime() > 0){
  $chunk->save();
}

$thanos = new Aternos\Thanos\Thanos();
$thanos->setMaxInhabitedTime(0);
$world = new Aternos\Thanos\World\AnvilWorld("/path/to/world/directory", "/path/to/output/directory");
$removedChunks = $thanos->snap($world);
echo "Removed $removedChunks chunks\n";