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

Change valence-anvil to be more general #504

Closed
Earthcomputer opened this issue Aug 29, 2023 · 3 comments · Fixed by #510
Closed

Change valence-anvil to be more general #504

Earthcomputer opened this issue Aug 29, 2023 · 3 comments · Fixed by #510
Labels
enhancement New feature or request

Comments

@Earthcomputer
Copy link
Contributor

Describe the problem related to your feature request.

Currently, there are two problems with valence-anvil:

  1. It is specific to block state chunks, whereas nowadays Mojang uses the anvil format for entities and POIs too, and possibly other things in the future.
  2. It is specific to Bevy and valence-server, including a Bevy plugin and requiring a biome registry respectively, which makes it harder to justify the use of this crate as a library outside of Valence, like you can with valence_nbt.

What solution would you like?

There needs to be a lower-level public API to simply get a Compound given some chunk coordinates, and to be able to store a new Compound to some new or existing chunk coordinates. The blockstate, entity and POI stuff can then be built on top of that, possibly in a separate crate or in the same crate with feature flags. The Bevy plugin could also be either a separate crate or in the same crate with a feature flag.

What alternative(s) have you considered?

The valence-anvil crate could be left as it is, and I could make an alternative crate which is not specific to Valence. However, I think that not only could 3rd parties benefit to this restructuring, but Valence itself could too. It would help work towards some of the goals in the 0.2 roadmap, such as serialization support for anvil worlds, and would also be helpful for loading and saving entities if that is something you want.

Additional context

I am working on a program to upgrade worlds (like the optimize worlds button in Minecraft), and need an anvil parser to upgrade chunks.

@Earthcomputer Earthcomputer added the enhancement New feature or request label Aug 29, 2023
@Earthcomputer
Copy link
Contributor Author

Just FYI I'm happy to do any implementation work related to this, I just want to make sure I am helping to take Valence in the right direction according to how you guys want it.

@dyc3
Copy link
Collaborator

dyc3 commented Aug 29, 2023

I'm in favor of this. It would be nice if we could decouple the bevy stuff from the anvil stuff as much as possible.

@rj00a
Copy link
Member

rj00a commented Aug 30, 2023

Sounds good 👍🏻 Putting the Valence/Bevy stuff behind feature flags seems like the right approach to me.

@rj00a rj00a closed this as completed in #510 Sep 1, 2023
rj00a pushed a commit that referenced this issue Sep 1, 2023
… flags (#510)

# Objective

- Closes #504 

# Solution

- Place valence and bevy specific stuff in `valence_anvil` behind
feature flags.
- Support for entity and POI chunks can easily be added to
`DimensionFolder` in the future.
- Support for writing chunks is not included in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants