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

Anvil world persistence #145

Merged
merged 23 commits into from
Oct 5, 2019
Merged

Anvil world persistence #145

merged 23 commits into from
Oct 5, 2019

Conversation

caelunshun
Copy link
Member

@caelunshun caelunshun commented Oct 1, 2019

Resolves #52.

  • Sector allocator for region files
  • RegionFile::save_chunk()
  • Chunk saving support for chunk worker
  • Periodic saving of loaded chunks (only those modified), at configurable intervals
  • Saving of chunks on unload and shutdown
  • Creation of new region files
  • Saving of entities
  • Saving of player data on disconnect and shutdown
  • Saving of level data

@caelunshun caelunshun added this to the 0.5 milestone Oct 1, 2019
@codecov
Copy link

codecov bot commented Oct 3, 2019

Codecov Report

Merging #145 into develop will decrease coverage by 0.78%.
The diff coverage is 47.74%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #145      +/-   ##
===========================================
- Coverage    61.66%   60.88%   -0.79%     
===========================================
  Files           77       81       +4     
  Lines         9045     9767     +722     
===========================================
+ Hits          5578     5947     +369     
- Misses        3467     3820     +353
Impacted Files Coverage Δ
server/src/entity/item.rs 94.97% <ø> (+0.94%) ⬆️
server/src/lib.rs 34.93% <0%> (-1.93%) ⬇️
core/src/inventory.rs 84.84% <0%> (-1.98%) ⬇️
core/src/world/mod.rs 37.67% <0%> (ø) ⬆️
server/src/shutdown.rs 0% <0%> (ø)
core/src/save/entity.rs 45.51% <0%> (-23.24%) ⬇️
server/src/chunkworker.rs 20.4% <0%> (-3.77%) ⬇️
server/src/player/mod.rs 100% <100%> (ø) ⬆️
server/src/entity/mod.rs 100% <100%> (ø) ⬆️
server/src/player/inventory.rs 98.95% <100%> (ø) ⬆️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20bf937...c5271d2. Read the comment docs.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@caelunshun caelunshun force-pushed the feature/world-persistence branch from 0205cf4 to d9c289c Compare October 3, 2019 01:08
@caelunshun caelunshun force-pushed the feature/world-persistence branch from d9c289c to c3f97c4 Compare October 3, 2019 01:36
@caelunshun caelunshun marked this pull request as ready for review October 4, 2019 17:12
@caelunshun
Copy link
Member Author

Everything appears to work.

@caelunshun caelunshun requested a review from aramperes October 4, 2019 17:12
@caelunshun caelunshun changed the title [WIP] Anvil world persistence Anvil world persistence Oct 4, 2019
@aramperes
Copy link
Contributor

How is "shutdown" triggered? Is there a hook for sigint/ctrlc that sends a message in the shutdown channel?

@caelunshun
Copy link
Member Author

How is "shutdown" triggered? Is there a hook for sigint/ctrlc that sends a message in the shutdown channel?

Yes, using the ctrlc crate. The shutdown hook is set in shutdown::init().

@caelunshun caelunshun merged commit fb4222f into develop Oct 5, 2019
@caelunshun caelunshun deleted the feature/world-persistence branch October 5, 2019 18:11
cheako pushed a commit to cheako/feather that referenced this pull request Jan 4, 2020
Resolves feather-rs#52.

Features implemented:
* Sector allocator for region files
* RegionFile::save_chunk()
* Chunk saving support for chunk worker
* Periodic saving of loaded chunks (only those modified), at configurable intervals
* Saving of chunks on unload and shutdown
* Creation of new region files
* Saving of entities
* Saving of player data on disconnect and shutdown
* Saving of level data

This is a squashing of 23 commits:

* Implement sector allocator

* Implement conversion of chunk data compound to `nbt::Blob`

* Initial implementation of RegionHandle::save_chunk (untested)

* Initial chunk worker support for chunk saving

* Save chunks upon unload

* Implement periodic saving of chunks, with interval defined in config

* Implement saving of chunks on shutdown

* Implement creation of new region files

* Save level.dat on shutdown

* Begin work on entity saving

* Fix saving of item entities

* Add more data to chunk save so that the vanilla server accepts it

* Fix panic when chunk containing players was saved

* Attempt to fix Windows overflow error

* Implement saving of player data on disconnect and shutdown

* Fix ordering of pitch and yaw

* Fix panic on double chunk unload

* Fix panic when entities without position are saved

* Use more idiomatic early return syntax

* Implement conversion from global to section palette for chunk saving
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.

Anvil world persistence
2 participants