{"id":19826240,"url":"https://github.com/aternosorg/thanos","last_synced_at":"2025-05-16T14:04:52.949Z","repository":{"id":35024303,"uuid":"197808722","full_name":"aternosorg/thanos","owner":"aternosorg","description":"PHP library to automatically detect and remove unused chunks from Minecraft worlds.","archived":false,"fork":false,"pushed_at":"2024-09-27T11:01:48.000Z","size":105,"stargazers_count":233,"open_issues_count":1,"forks_count":22,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-15T16:54:11.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/aternos/thanos","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aternosorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-19T16:30:23.000Z","updated_at":"2025-04-28T17:36:57.000Z","dependencies_parsed_at":"2024-02-29T13:03:08.075Z","dependency_job_id":"bda49ec3-15c7-4344-9e68-5037e14ef445","html_url":"https://github.com/aternosorg/thanos","commit_stats":{"total_commits":35,"total_committers":5,"mean_commits":7.0,"dds":"0.37142857142857144","last_synced_commit":"8c08de679875d58c8ae9f3caf478a4d9f737be33"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fthanos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fthanos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fthanos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aternosorg%2Fthanos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aternosorg","download_url":"https://codeload.github.com/aternosorg/thanos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T11:09:50.781Z","updated_at":"2025-05-16T14:04:52.930Z","avatar_url":"https://github.com/aternosorg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thanos\n\n### About\n\nThanos is a PHP library to automatically detect and remove unused chunks from Minecraft worlds.\nThis can reduce the file size of a world by more than 50%.\n\nOther than existing tools, this library does not use blocklists. Instead, the inhabited time value is used to determine whether a chunk is used or not. This prevents used chunks from sometimes being removed by accident and makes this library compatible with most mods and plugins.\n\nCurrently, only the Minecraft Anvil world format (Minecraft Java Edition) is supported.\n### Installation\n\n```bash\ncomposer require aternos/thanos\n```\n\nTo work with LZ4 compressed chunks (Minecraft 1.20.5+), you should also install the [PHP LZ4 extension](https://github.com/kjdev/php-ext-lz4).\n\n## Usage\n\n### CLI tool\n\nThis library includes a simple cli tool.\n\n```bash\n./thanos.php /path/to/world/directory [/path/to/output/directory]\n```\nThanos uses [Taskmaster](https://github.com/aternosorg/taskmaster) for asynchronous tasks, which can be configured [using environment variables](https://github.com/aternosorg/taskmaster#defining-workers-using-environment-variables).\n\n### Windows support\n\nWhile Thanos will generally work on Windows, it will be much slower since asynchronous tasks are not supported.\nIt is therefore recommended to use the [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) to run Thanos on Windows.\n\n### Known issues\n\nWorld features like trees that cross chunk borders can sometimes look cut off,\nif the chunk containing half of the feature is removed while the other half is not.\nDetails can be found in this issue: https://github.com/aternosorg/thanos/issues/20\n\n### Worlds\n\nA world object represents a Minecraft world with all its files.\nIt allows iteration over all chunks and provides a function to copy all non-region files to the output directory.\n```php\n$world = new Aternos\\Thanos\\World\\AnvilWorld(\"/path/to/world/directory\", \"/path/to/output/directory\");\n$world-\u003ecopyOtherFiles(); //copy non-region files\n\nforeach ($world as $chunk){\n  echo $chunk-\u003egetInhabitedTime() . \"\\n\"; //output inhabited time for each chunk\n}\n```\nAfter iterating over all chunks of a region file, it will be automatically saved to the output directory.\n\n#### Methods\n\n``getPath() : string`` Get world directory path\n\n``getDestination() : string`` Get world output directory\n\n``getOtherFiles() : string[]`` Get all files, that are not region directories\n\n``copyOtherFiles() : void`` Copy all files, that are not region directories, to the output directory\n\n``static isWorld(string $path) : bool`` Check if `$path` is world directory\n\n### Chunks\n\nA chunk object represents a Minecraft world chunk. Due to performance reasons, \nchunk data is not completely parsed but only used to find metadata that helps to determine whether a chunk is used.\n\n```php\nif($chunk-\u003egetInhabitedTime() \u003e 0){\n  $chunk-\u003esave();\n}\n```\nIf a chunk is not marked as saved, it will not be written to the output directory.\n\n#### Methods\n\n``getOffset() : int`` Get offset of chunk data within the region file\n\n``getLength() : int`` Get length of raw chunk data\n\n``getData() : string`` Get raw chunk data\n\n``getInhabitedTime() : int`` Get InhabitedTime value from chunk data. Returns -1 if InhabitedTime could not be read.\n\n``getLastUpdate() : int`` Get LastUpdate value from chunk data. Returns -1 if LastUpdate could not be read.\n\n``setTimestamp(int $timestamp) : void`` Set last modification time\n\n``getTimestamp() : int`` Get last modification time\n\n``save() : void`` Mark chunk as saved\n\n``isSaved() : bool`` Check whether this chunk is marked as saved\n\n### Thanos\nThanos automatically finds unused chunks in a world and reduces them to atoms.\n\n```php\n$thanos = new Aternos\\Thanos\\Thanos();\n$thanos-\u003esetMaxInhabitedTime(0);\n$world = new Aternos\\Thanos\\World\\AnvilWorld(\"/path/to/world/directory\", \"/path/to/output/directory\");\n$removedChunks = $thanos-\u003esnap($world);\necho \"Removed $removedChunks chunks\\n\";\n```\n\n#### Methods\n\n``setMinInhabitedTime(int $minInhabitedTime) : void`` Set min inhabited time for a chunk to not be removed\n\n``getMinInhabitedTime() : int`` Get min inhabited time\n\n``snap(WorldInterface $world) : int`` Remove unused chunks, returns the amount of chunks removed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fthanos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faternosorg%2Fthanos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faternosorg%2Fthanos/lists"}