aboutsummaryrefslogtreecommitdiff
path: root/minecraft-chat/src/component.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-09 19:35:02 +0000
committermat <github@matdoes.dev>2021-12-09 19:35:02 +0000
commitecee5e96ca2f7d00dd14f44ff0c1facd01550b65 (patch)
tree5f39fa46919fa25ce11e1cccae100953bad292f0 /minecraft-chat/src/component.rs
parenta51524d457fff3e22183be72fb4837123875cfba (diff)
downloadazalea-drasl-ecee5e96ca2f7d00dd14f44ff0c1facd01550b65.tar.xz
add more tests and fix
Diffstat (limited to 'minecraft-chat/src/component.rs')
-rw-r--r--minecraft-chat/src/component.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/minecraft-chat/src/component.rs b/minecraft-chat/src/component.rs
index c0f7677f..3135c3ba 100644
--- a/minecraft-chat/src/component.rs
+++ b/minecraft-chat/src/component.rs
@@ -130,14 +130,12 @@ impl Component {
if extra.len() == 0 {
return Err("Unexpected empty array of components".to_string());
}
- for i in 0..extra.len() {
- component.append(Component::new(extra.get(i).unwrap())?);
+ for extra_component in extra {
+ component.append(Component::new(extra_component)?);
}
}
- // var5_17.setStyle((Style)jsonDeserializationContext.deserialize(jsonElement, Style.class));
let style = Style::deserialize(json);
- println!("set style to {:?}", style);
component.get_base().style = style;
return Ok(component);
@@ -202,7 +200,9 @@ impl Component {
// the old style is current_style and the new style is the base.style
let ansi_text = current_style.compare_ansi(&base.style);
+
current_style.apply(&base.style);
+ println!("\nset style to {:?}", current_style);
styled_component.push_str(&ansi_text);
styled_component.push_str(&component_text);