mirror of
https://github.com/Pumpkin-MC/Pumpkin
synced 2025-10-23 17:44:45 +00:00
* Make protochunk not have a lifetime * Staged chunks * fix * new generation system init * small optimize * fix warning * fmt * new get chunk * use write_radius * save stage in protochunk * clean up * clean old fn * fix bug * support saving but broke shutdown * fail to fix shutdown and still many problems need to solve * fix shutdown * fix chunk unload; give highest priority to get_chunk * fix tick deadlock * fix chunk level * drop old channel * rewrite run_decrease_update; fix a stupid error * Update chunk_system.rs * remove some log * lighter dependency * clean up * fix ci * clean up & merge * Update chunk_system.rs * fix a bug * Proto Chunk Saving, safer io and remove debug output Port Proto Chunk Saving From #1164 * fix a bug * fetching chunk message level set to debug * Update multi_noise.rs --------- Co-authored-by: 4lve <72332750+4lve@users.noreply.github.com> Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
32 lines
920 B
Rust
32 lines
920 B
Rust
use std::fs;
|
|
|
|
use heck::ToPascalCase;
|
|
use proc_macro2::TokenStream;
|
|
use quote::{format_ident, quote};
|
|
|
|
pub(crate) fn build() -> TokenStream {
|
|
println!("cargo:rerun-if-changed=../assets/chunk_status.json");
|
|
|
|
let chunk_status: Vec<String> =
|
|
serde_json::from_str(&fs::read_to_string("../assets/chunk_status.json").unwrap())
|
|
.expect("Failed to parse chunk_status.json");
|
|
let mut variants = TokenStream::new();
|
|
|
|
for status in chunk_status.iter() {
|
|
let full_name = format!("minecraft:{status}");
|
|
let name = format_ident!("{}", status.to_pascal_case());
|
|
variants.extend([quote! {
|
|
#[serde(rename = #full_name)]
|
|
#name,
|
|
}]);
|
|
}
|
|
quote! {
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone, Copy)]
|
|
pub enum ChunkStatus {
|
|
#variants
|
|
}
|
|
}
|
|
}
|