Skip to content

Commit

Permalink
add Anvil Chunk saving (#401)
Browse files Browse the repository at this point in the history
* anvil saving foundation

* fix: clippy warns

* write chunk header

* write x_pos and z_pos

* cargo: fmt

* maybe improve something, maybe made something worse

* Make anvil work (#465)

* refactored stuff into chaos

* now we got sinkholes

* Reimplemented the whole write logic we now have wierd chunks but the data is mostly correct

* Fixed long overflow

* Fix fmt and clippy

* Added unit test to check anvil saving

* Fix fmt

* Fixed useless clone

* Removed unnecessary unwraps and added timestamp table

* Removed fs2 dependency

* Fix stop deadlock

---------

Co-authored-by: Alvsch <[email protected]>

* Update README.md

---------

Co-authored-by: Nico Göbel <[email protected]>
Co-authored-by: Alvsch <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent 8721576 commit 495de3d
Show file tree
Hide file tree
Showing 9 changed files with 584 additions and 121 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
- [x] Bossbar
- [x] Chunk Loading
- [x] Chunk Generation
- [ ] Chunk Saving
- [x] Chunk Saving
- [x] World Time
- [x] Scoreboard
- [x] World Borders
Expand Down
4 changes: 4 additions & 0 deletions pumpkin-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pumpkin-core = { path = "../pumpkin-core" }
pumpkin-config = { path = "../pumpkin-config" }
pumpkin-macros = { path = "../pumpkin-macros" }

bytes.workspace = true


tokio.workspace = true
rayon.workspace = true
derive_more.workspace = true
Expand All @@ -26,6 +29,7 @@ flate2 = "1.0"
lz4 = "1.28.0"

file-guard = "0.2.0"
indexmap = "2.7.0"

enum_dispatch = "0.3.13"

Expand Down
8 changes: 8 additions & 0 deletions pumpkin-world/src/block/block_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ pub static BLOCK_ID_BY_REGISTRY_ID: LazyLock<HashMap<String, u16>> = LazyLock::n
map
});

pub static BLOCK_ID_TO_REGISTRY_ID: LazyLock<HashMap<u16, String>> = LazyLock::new(|| {
let mut map = HashMap::new();
for block in &*BLOCKS.blocks {
map.insert(block.default_state_id, block.name.clone());
}
map
});

pub static BLOCK_ID_BY_STATE_ID: LazyLock<HashMap<u16, u16>> = LazyLock::new(|| {
let mut map = HashMap::new();
for block in &BLOCKS.blocks {
Expand Down
Loading

0 comments on commit 495de3d

Please sign in to comment.