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

Add region files API #2466

Closed
wants to merge 3 commits into from
Closed

Add region files API #2466

wants to merge 3 commits into from

Conversation

Faithcaio
Copy link
Contributor

@Faithcaio Faithcaio commented Oct 5, 2023

SpongeAPI | Sponge

Adds API to handle region files,

as discussed, adding access to offline chunks instead.

@Yeregorix
Copy link
Member

Aren't regions an implementation detail? A custom implementation could theoretically stores worlds in a different format (not region based). It could even be in memory or in a database, without files.

@pschichtel
Copy link

pschichtel commented Oct 5, 2023

@Yeregorix I fully agree, but the API already leaks this detail currently (ServerWorld.directory).

*
* @return The stream of existing chunk positions.
*/
Stream<Vector3i> chunkPositions();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so how about this instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine

Comment on lines +252 to +265
/**
* Returns the path of the directory where region files are stored.
*
* @return The path of the region directory
*/
Path regionDirPath();

/**
* Returns the path of the region file containing the given {@link WorldChunk}.
*
* @param chunk The {@link WorldChunk} for which to acquire the region file path
* @return The path of the region file for the given chunk
*/
Path regionFilePath(WorldChunk chunk);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd almost want to have a StorageHandler interface to deal with this so that it's not directly exposed in the API, but can be something exposed for "vanilla" kinds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not always guaranteed that the world has region files (like mods) that could be storing chunks in a different region handler that we simply won't be able to directly interface with.

*
* @return The stream of existing chunks.
*/
Stream<OfflineChunk> offlineChunks();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this if you want the chunk data too

@Faithcaio Faithcaio closed this Oct 13, 2023
@Faithcaio Faithcaio deleted the feature/regionfiles branch October 13, 2023 16:24
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

Successfully merging this pull request may close these issues.

4 participants