aternosorg/thanos
소개
Minecraft 월드에서 사용되지 않는 청크를 자동으로 감지하고 제거하는 PHP 라이브러리입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalThanos
About
Thanos is a PHP library to automatically detect and remove unused chunks from Minecraft worlds. This can reduce the file size of a world by more than 50%.
Other 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.
Only Minecraft: Java Edition worlds are supported.
Installation
composer require aternos/thanos
To work with LZ4 compressed chunks (Minecraft 1.20.5+), you should also install the PHP LZ4 extension.
Known issues
World features like trees that cross chunk borders can sometimes look cut off, if the chunk containing half of the feature is removed while the other half is not. Details can be found in this issue: https://github.com/aternosorg/thanos/issues/20
CLI usage
This library includes a simple cli tool.
./thanos.php /path/to/world/directory [/path/to/output/directory]
Thanos uses Taskmaster for asynchronous tasks, which can be configured using environment variables.
Windows support
While Thanos will generally work on Windows, it will be much slower since asynchronous tasks are not supported. It is therefore recommended to use the Windows Subsystem for Linux to run Thanos on Windows.
Library usage
To use Thanos as a library, create a Thanos object that is configured with the desired Patterns to match chunks which should be kept.
$thanos = new \Aternos\Thanos\Thanos([
new \Aternos\Thanos\Pattern\RangePattern(0, 0, 16, 16), //keep chunks in range x:0 z:0 to x:16 z:16
]);
You can then pass a World object and a destination directory to the snap method to remove chunks that match
none of the patterns.
$world = \Aternos\Thanos\World\World::open("/path/to/world/");
$destination = new \Aternos\IO\System\Directory\Directory("/path/to/output/");
$removedChunks = $thanos->snap($world, $destination);
echo "Removed " . $removedChunks . " chunks\n";
Chunk patterns
To decide which chunks should be kept, Thanos uses chunk patterns, which implement the ChunkPatternInterface.
Built-in patterns include a ListPattern, which keeps chunks based on a predefined list of chunk coordinates,
and a RangePattern, which keeps all chunks in a defined rectangular area.
Pattern factories
Sometimes a pattern cannot be defined statically, but needs to be created based on the world data.
It is therefore possible to also pass instances of WorldPatternFactoryInterface for world-based pattern creation,
and DimensionPatternFactoryInterface for dimension-based pattern creation to the Thanos constructor.
An example for a dimension-based pattern factory is the ForceLoadedChunksPatternFactory. This factory reads
the list of force-loaded chunks for a dimension and creates a ListPattern to keep those chunks.
$thanos = new \Aternos\Thanos\Thanos([
new \Aternos\Thanos\Pattern\Factory\ForceLoadedChunkPatternFactory()
]);
MCA reader and writer
Thanos includes an implementation that can be used to interact with Minecraft MCA files directly.
McaReader
$reader = \Aternos\Thanos\Mca\McaReader::open("/path/to/world/region/r.0.0.mca");
$chunk = $reader->getChunk(123); //Get at index 123 in region file
$chunk = $reader->getChunkAt(12, 23); //Get chunk at chunk coordinates x:12 z:23
// Iterate over all chunks in the region file
foreach ($reader->getChunks() as $chunk) {
//Do something with chunk
}
$reader->close();
McaWriter
$writer = \Aternos\Thanos\Mca\McaWriter::open("/path/to/world/region/r.0.0.mca");
$writer->writeEntry($chunk); // Write a chunk to the MCA file
$writer->close(); // Finalize and close the MCA file
관련 프로젝트 살펴보기
불러오는 중…