Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chunk whitelist/blacklist #21

Open
thvless opened this issue Jul 21, 2024 · 4 comments
Open

chunk whitelist/blacklist #21

thvless opened this issue Jul 21, 2024 · 4 comments

Comments

@thvless
Copy link

thvless commented Jul 21, 2024

Hello, i own a self-hosted server where i often purge unused chunks manually using mca selector, and was looking at thanos as an appealing solution, except i have one question/suggestion.

For context: i am running a modded server that includes the mod valkyrien skies: https://github.com/ValkyrienSkies in brief this mod simulates physics in minecraft by storing the "ships" which are the interactable buildable blocks in what they call a shipyard which everything that spans from -28672000 to 28672000 on the x axis and from 12288000 to 28672000 on the z axis
any blocks created here are only there for simulation purposes and what the player sees is a projection of them rendered on the client, eg the player themself is not affecting ChunkInhabitedTime of the chunks in the shipyard

Proposed solution: would it be possible to implement a modifiable black list for the iterator so it skips those coordinates/chunks/mca regions even if their ChunkInhabitedTime is null, i have seen that this has already been done for chunks that are force loaded but since shipyard chunks are only loaded if their projection is loaded it would only cause lag to force load them at all times.

@KurtThiemann
Copy link
Member

Storing these ships as regular blocks in the overworld instead of using some custom file format to save them or at least put them in a dedicated dimension seems like a pretty odd choice...

I added an option to the Thanos class to set a list of chunks that should always be saved. Note that these are chunk coordinates, not block coordinates, so you'd have to divide your block coordinates by 16 to get the correct chunk coordinates. setSaveChunks accepts an array of int arrays, so to save chunks 1,2, 3,4, and 5,6, you'd pass [[1,2], [3,4], [5,6]].

I have not added an option to use this to the thanos cli yet, which is also why I have not created a new release yet. I might look into that next week if I have time.

@thvless
Copy link
Author

thvless commented Jul 21, 2024

Hi, thanks for the quick reply, I see your implementation was through arrays. would it be possible to instead use a range function?

I've determined that in my specific use case the coords of chunks i need protected are X -1792000 to 1792000 and Z 768000 to 1792000. perhaps specifying the range [(1792000,-17920000),(768000,1792000)] or any other for different use cases would be better

@KurtThiemann
Copy link
Member

Okay, Thanos now has a setCustomPatterns method that accepts an array of ChunkPatternInterface. You can pass an instance of RangePattern to save a Range of chunks (the constructor uses chunk coordinates, not block coordinates).
You can also create custom patterns by implementing ChunkPatternInterface yourself.

Still not available in the CLI, as I'd need to think about how that could be represented in command line options. You can, of course, write your own script based on the thanos CLI creates the correct pattern object.

@Merith-TK
Copy link

Storing these ships as regular blocks in the overworld instead of using some custom file format to save them or at least put them in a dedicated dimension seems like a pretty odd choice...
to give some insight into this

Valkyrian Skies has direct compatibility with create, an mechanical automation mod.
It uses the "shipyard" to have a physical in world space for the actual blocks to tick,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants