diff options
| author | mat <github@matdoes.dev> | 2021-12-08 22:09:24 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-08 22:09:24 +0000 |
| commit | 8bc1fd23991539eb8b01fc940b1219786ae5f32b (patch) | |
| tree | d544a4a5dca863c56ece143f201f07445e7cbf4a /minecraft-chat/src/translatable_component.rs | |
| parent | c16d55ccddd741057bf532bd946b2854dc208c65 (diff) | |
| download | azalea-drasl-8bc1fd23991539eb8b01fc940b1219786ae5f32b.tar.xz | |
minecraft-chat compiles
Diffstat (limited to 'minecraft-chat/src/translatable_component.rs')
| -rw-r--r-- | minecraft-chat/src/translatable_component.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/minecraft-chat/src/translatable_component.rs b/minecraft-chat/src/translatable_component.rs index e9099e55..1aecb7a7 100644 --- a/minecraft-chat/src/translatable_component.rs +++ b/minecraft-chat/src/translatable_component.rs @@ -1,10 +1,25 @@ +use crate::{base_component::BaseComponent, component::Component}; + +#[derive(Clone)] +pub enum StringOrComponent { + String(String), + Component(Component), +} + +// extends BaseComponent implements ContextAwareComponent +#[derive(Clone)] pub struct TranslatableComponent { + pub base: BaseComponent, pub key: String, - pub args: Vec<String>, + pub args: Vec<StringOrComponent>, } impl TranslatableComponent { - pub fn new(key: String, args: Vec<String>) -> Self { - Self { key, args } + pub fn new(key: String, args: Vec<StringOrComponent>) -> Self { + Self { + base: BaseComponent::new(), + key, + args, + } } } |
