Prepare ChatType registry

This commit is contained in:
Snowiiii committed 2024-08-11 17:55:41 +02:00
1 parent 41442c5b5d
commit 5b636111e4
10 files changed
+99 -46

No files matched your search

+28 -2
View File
@@ -1,7 +1,33 @@
pub struct ChatType {}
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct ChatType {
chat: Decoration,
narration: Decoration,
}
#[derive(Debug, Clone, Serialize)]
pub struct Decoration {
translation_key: String,
// style: Option,
style: u8,
// TODO
// style: Option<Styles>,
parameters: Vec<String>,
}
impl Default for ChatType {
fn default() -> Self {
Self {
chat: Decoration {
style: 0,
parameters: vec!["sender".into(), "content".into()],
translation_key: "chat.type.text".into(),
},
narration: Decoration {
style: 0,
parameters: vec!["sender".into(), "content".into()],
translation_key: "chat.type.text.narrate".into(),
},
}
}
}
+19 -1
View File
@@ -1,4 +1,5 @@
use biomes::Biome;
use chat_type::ChatType;
use dimensions::Dimension;
use fastnbt::SerOpts;
use paint::Painting;
@@ -50,6 +51,16 @@ impl Registry {
.unwrap(),
}],
};
let _chat_types = Registry {
registry_id: "minecraft:chat_type".to_string(),
registry_entries: vec![RegistryEntry {
entry_id: "minecraft:chat",
data: fastnbt::to_bytes_with_opts(&ChatType::default(), SerOpts::network_nbt())
.unwrap(),
}],
};
let damage_types = Registry {
registry_id: "minecraft:damage_type".to_string(),
registry_entries: damage_type::entires(),
@@ -62,6 +73,13 @@ impl Registry {
.unwrap(),
}],
};
vec![dimensions, damage_types, biomes, wolf_variants, paintings]
vec![
dimensions,
damage_types,
biomes,
wolf_variants,
paintings,
// chat_types,
]
}
}