Living Entity: Proper death
Now we wait until despawning the entity so the death animation is played
This commit is contained in:
1 parent
d827f68826
commit
27f239a612
10 files changed
+139
-29
No files matched your search
@@ -0,0 +1,27 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use heck::ToPascalCase;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{format_ident, quote};
|
||||
|
||||
pub(crate) fn build() -> TokenStream {
|
||||
println!("cargo:rerun-if-changed=../assets/entity_statuses.json");
|
||||
|
||||
let events: HashMap<String, u8> =
|
||||
serde_json::from_str(include_str!("../../assets/entity_statuses.json"))
|
||||
.expect("Failed to parse entity_statuses.json");
|
||||
let mut variants = TokenStream::new();
|
||||
|
||||
for (event, id) in events.iter() {
|
||||
let name = format_ident!("{}", event.to_pascal_case());
|
||||
variants.extend([quote! {
|
||||
#name = #id,
|
||||
}]);
|
||||
}
|
||||
quote! {
|
||||
#[repr(u8)]
|
||||
pub enum EntityStatus {
|
||||
#variants
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user