Code Monkey home page Code Monkey logo

thanos's People

Contributors

kurtthiemann avatar matthi4s avatar pavel-redkin avatar pavog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thanos's Issues

Failed to inflate input data.

Hello, I am trying to use this tool but this error always occurs. I don't know how to solve it on my own.

PHP Warning: inflate_add(): data error in /home/learting/vendor/aternos/thanos/src/Reader/ZlibReader.php on line 108
Failed to inflate input data.
PHP Fatal error: Uncaught Exception: Failed to inflate input data. in /home/learting/vendor/aternos/thanos/src/Reader/ZlibReader.php:113
Stack trace:
#0 /home/learting/vendor/aternos/thanos/src/Chunk/AnvilChunk.php(200): Aternos\Thanos\Reader\ZlibReader->read()
#1 /home/learting/vendor/aternos/thanos/src/Chunk/AnvilChunk.php(168): Aternos\Thanos\Chunk\AnvilChunk->readAfter()
#2 /home/learting/vendor/aternos/thanos/src/Task/RegionTask.php(39): Aternos\Thanos\Chunk\AnvilChunk->getInhabitedTime()
#3 [internal function]: Aternos\Thanos\Task\RegionTask->run()
#4 /home/learting/vendor/aternos/taskmaster/src/Runtime/Runtime.php(72): Fiber->start()
#5 /home/learting/vendor/aternos/taskmaster/src/Communication/RequestHandler.php(65): Aternos\Taskmaster\Runtime\Runtime->runTask()
#6 /home/learting/vendor/aternos/taskmaster/src/Communication/RequestHandlingTrait.php(69): Aternos\Taskmaster\Communication\RequestHandler->handle()
#7 /home/learting/vendor/aternos/taskmaster/src/Communication/Socket/SocketCommunicatorTrait.php(79): Aternos\Taskmaster\Runtime\Runtime->handleRequest()
#8 /home/learting/vendor/aternos/taskmaster/src/Runtime/SocketRuntime.php(88): Aternos\Taskmaster\Runtime\SocketRuntime->update()
#9 /home/learting/vendor/aternos/taskmaster/src/Environment/Fork/ForkWorkerInstance.php(56): Aternos\Taskmaster\Runtime\SocketRuntime->start()
#10 /home/learting/vendor/aternos/taskmaster/src/Worker/Worker.php(118): Aternos\Taskmaster\Environment\Fork\ForkWorkerInstance->start()
#11 /home/learting/vendor/aternos/taskmaster/src/Worker/Worker.php(93): Aternos\Taskmaster\Worker\Worker->startInstance()
#12 /home/learting/vendor/aternos/taskmaster/src/Worker/Worker.php(197): Aternos\Taskmaster\Worker\Worker->getInstance()
#13 /home/learting/vendor/aternos/taskmaster/src/Taskmaster.php(269): Aternos\Taskmaster\Worker\Worker->assignTask()
#14 /home/learting/vendor/aternos/taskmaster/src/Taskmaster.php(234): Aternos\Taskmaster\Taskmaster->assignNextTaskToWorkerIfPossible()
#15 /home/learting/vendor/aternos/taskmaster/src/Taskmaster.php(168): Aternos\Taskmaster\Taskmaster->update()
#16 /home/learting/vendor/aternos/thanos/src/Thanos.php(78): Aternos\Taskmaster\Taskmaster->waitAndHandleTasks()
#17 /home/learting/vendor/aternos/thanos/thanos.php(42): Aternos\Thanos\Thanos->snap()
#18 {main}
thrown in /home/learting/vendor/aternos/thanos/src/Reader/ZlibReader.php on line 113

PHP Fatal error: Uncaught Exception: Failed to inflate input data.

Hello, while using the CLI tool (thanos.php), after some time of running it (some hours) I'm getting the following error:
PHP Warning: inflate_add(): data error in /home/quiquelhappy/purevanilla.co/servers/thanos/src/Reader/ZlibReader.php on line 109 PHP Fatal error: Uncaught Exception: Failed to inflate input data. in /home/quiquelhappy/purevanilla.co/servers/thanos/src/Reader/ZlibReader.php:113 Stack trace: #0 /home/quiquelhappy/purevanilla.co/servers/thanos/src/Chunk/AnvilChunk.php(201): Aternos\Thanos\Reader\ZlibReader->read() #1 /home/quiquelhappy/purevanilla.co/servers/thanos/src/Chunk/AnvilChunk.php(169): Aternos\Thanos\Chunk\AnvilChunk->readAfter() #2 /home/quiquelhappy/purevanilla.co/servers/thanos/src/Thanos.php(58): Aternos\Thanos\Chunk\AnvilChunk->getInhabitedTime() #3 /home/quiquelhappy/purevanilla.co/servers/thanos/thanos.php(42): Aternos\Thanos\Thanos->snap() #4 {main}

This is only happening on this specific world, I've tested on others and it works perfectly. I'm not sure if this is a "corrupted" chunk or not, but if it is, I'd like to remove it anyways, is there any param for that? Thanks!

Thanos' chunk trimming can be destructive to trees

I doubt it's something that can be fixed easily, but I felt like I should at least report it considering I've seen it mentioned nowhere.

I've seen a lot of trees disfigured on Aternos while playing on a server with friends (especially when playing with biome mods which adds very large trees with organic shapes), which wasn't something I experienced on solo maps or on other servers. I made the hypothesis the optimization feature was the culprit, and after a bit of testing I confirmed this hypothesis.

Due to how Minecraft's generation works, blindly deleting a chunk can mess with certain parts of the generation, most notably trees. When they span across chunks, it doesn't actually matter for the game because neighboring chunks are already being generated, so it can just write to them and call it a day. However, if a chunk containing a tree was to be deleted, it would not be generated at the exact same spot again and the leaves that grew in the neighbor chunk would remain floating. Similarly, if a chunk containing leaves from another chunk's tree is removed, the tree will permanently lose those leaves.

One approach I imagine could help prevent this is making sure neighboring chunks aren't in a state where they may have generated things in the current chunk; but I'm pretty sure this would have quite a big impact on the effectiveness of the optimization.

Getting Issues with the new version

E:\Minecraft Files\thanos>php ./vendor/aternos/thanos/thanos.php ./world ./newworld
PHP Warning: stream_socket_pair(): Failed to create sockets: [10042]: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call in E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\SocketPair.php on line 25
PHP Warning: Trying to access array offset on false in E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\SocketPair.php on line 26
PHP Fatal error: Uncaught TypeError: stream_set_blocking(): Argument #1 ($stream) must be of type resource, null given in E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\Socket.php:38
Stack trace:
#0 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\Socket.php(38): stream_set_blocking()
#1 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\SocketPair.php(26): Aternos\Taskmaster\Communication\Socket\Socket->__construct()
#2 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Runtime\RuntimeProcess.php(34): Aternos\Taskmaster\Communication\Socket\SocketPair->__construct()
#3 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Environment\Process\ProcessWorkerInstance.php(39): Aternos\Taskmaster\Runtime\RuntimeProcess->__construct()
#4 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Worker\Worker.php(118): Aternos\Taskmaster\Environment\Process\ProcessWorkerInstance->start()
#5 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Worker\Worker.php(93): Aternos\Taskmaster\Worker\Worker->startInstance()
#6 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Worker\Worker.php(197): Aternos\Taskmaster\Worker\Worker->getInstance()
#7 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Taskmaster.php(269): Aternos\Taskmaster\Worker\Worker->assignTask()
#8 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Taskmaster.php(234): Aternos\Taskmaster\Taskmaster->assignNextTaskToWorkerIfPossible()
#9 E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Taskmaster.php(168): Aternos\Taskmaster\Taskmaster->update()
#10 E:\Minecraft Files\thanos\vendor\aternos\thanos\src\Thanos.php(78): Aternos\Taskmaster\Taskmaster->waitAndHandleTasks()
#11 E:\Minecraft Files\thanos\vendor\aternos\thanos\thanos.php(42): Aternos\Thanos\Thanos->snap()
#12 {main}
thrown in E:\Minecraft Files\thanos\vendor\aternos\taskmaster\src\Communication\Socket\Socket.php on line 38

These are the error logs ^^

Thanos trying to get the inhabited time of null

I just tested thanos on a world and got the following error:

Fatal error: Uncaught Error: Call to a member function getInhabitedTime() on null in C:\Users\julia\Desktop\Coding\Minecraft\thanos\vendor\aternos\thanos\src\Thanos.php:49
Stack trace:
#0 C:\Users\julia\Desktop\Coding\Minecraft\thanos\thanos.php(42): Aternos\Thanos\Thanos->snap(Object(Aternos\Thanos\World\AnvilWorld))
#1 {main}
  thrown in C:\Users\julia\Desktop\Coding\Minecraft\thanos\vendor\aternos\thanos\src\Thanos.php on line 49

i changed the snap function from

public function snap(WorldInterface $world): int
    {
        $world->copyOtherFiles();
        $removedChunks = 0;
        foreach ($world as $chunk) {
              $time = $chunk->getInhabitedTime();
              if ($time > $this->minInhabitedTime || $time === -1) {
                  $chunk->save();
              } else {
                  $removedChunks++;
              }
        }
        return $removedChunks;
    }

to

public function snap(WorldInterface $world): int
    {
        $world->copyOtherFiles();
        $removedChunks = 0;
        foreach ($world as $chunk) {
            if(!$chunk == null){
              $time = $chunk->getInhabitedTime();
              if ($time > $this->minInhabitedTime || $time === -1) {
                  $chunk->save();
              } else {
                  $removedChunks++;
              }
            }
        }
        return $removedChunks;
    }

and after doing that it worked.

Is there a way to delete in place?

I did not test the tool yet tbh. But so far from checking the readme it looks like this tool goes over the whole world and copies the chunks
that we want to keep. It would be nice if this could in place delete all chunks one by one. So it could be run in steps or while the game server is running. Am I missing something?

My current use case is that my 2TB world drive reached 100% usage. Going over the whole thing and copying out another world is not an option. And also in the future I would like to keep it running as a cronjob.

`hasExistingChunks()` seems to return false for the first region

While trying to implement #14 my self.

public function save(bool $verify = true): void
{
if ($this->hasExistingChunks()) {
$this->writeToFile(
$this->getDestination(),
$verify
);
}
}

I changed this to

    public function save(bool $verify = true): void
    {
        if(!$this->hasExistingChunks()) {
            echo "[-] want to delete this savedchunks=" . $this->countSavedChunks() . " file=" . $this->getDestination() . "\n";
            unlink($this->getDestination());
        } else {
            echo "[+] want to keep this savedchunks=" . $this->countSavedChunks() . " file=" . $this->getDestination() . "\n";
        }
    }

Which always said the first region has 0 chunks. Meaning after running this multiple times it continued deleting more and more chunks until the whole world was gone. Is this a flaw in my messy change or in thanos?

Im not quite sure how the iterator magic works but is there any chance that the save() is called before it was able to caculate the saved chunks?

Many incompatibilities with data packs

Background Information

Hello, I am a data pack developer at Vanilla Tweaks. I'm assuming you know what a data pack is, but the gist is that their logic runs almost entirely on vanilla commands. We can't run Java or access files or chunk NBT or anything. Just vanilla commands, for the most part. And vanilla commands don't have the ability to change a chunk's InhabitedTime value.

Many data packs use a method where chunks really far from spawn are kept loaded via the /forceload command. Data packs use these loaded chunks to optimize certain methods of in-world processing, store information in those chunks, and also perform certain operations which are necessary to perform in-world rather than in data. You can run /forceload add ~ ~, and the chunk which the command was ran from will be kept loaded indefinitely. You can get a complete list of all the force-loaded chunks in a dimension using /forceload query, and you can remove a chunk from being force-loaded using /forceload remove ~ ~.

The Issue

The reason data pack developers choose to force-load locations so far from spawn is intended specifically to prevent players from entering them and interfering with the data packs. This means the InhabitedTime of these chunks never increases, causing an incompatibility with Aternos's "Optimize" setting, which to my understanding is what this repository is for. That setting deletes these force-loaded chunks, since they almost always have no InhabitedTime, causing any data packs which depend on persisting information in those chunks to stop working properly. The only current workaround we can give to our users is to disable Aternos's "Optimize" setting entirely.

Proposed Solution

My suggestion, which would fix these incompatibilities with many data packs, is to also not discard any chunks which are force-loaded. Chunks can only be force-loaded via the /forceload command (unless a mod or plugin does it by other means), so this can't have any side effects that would result in unintended/unnecessary chunks being kept.

Useful Details for Implementation

Each dimension's force-loaded chunks are stored in its data folder, in chunks.dat. In that file's NBT, data.Forced is an array of longs which contains information about which chunks are force-loaded in that dimension. Unfortunately I couldn't find any documentation on it beyond that, so you'd have to figure out the exact format of the chunk coordinates within those longs, but I don't think it should be too complicated. It seems each long in the array somehow represents the coordinates of one force-loaded chunk.

Thanos removed only chunks from overworld [CLOSED]

Hello !
I"m using Minecraft 1.7.10 and I need upload my world to aternos , but my world has 347 MB .
After using your program , world megabytes was reduced by 9 only so, can you program work for other dimesions like moon and these things you know ?

About setMinInhabitedTime

Is this in seconds or minutes or something else? Since i wanna increase this for my end since players do a lot of elytra gliding and it makes a lot of unneeded chunks, but i don't wanna make it so end ships could be reset and that'd be bad
I use the default thanos.php file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.