A Minecraft Chat Component and Adventure MiniMessage implementation in Rust.
use lobsterchat::component::*;
let text_component: Component = Component::text("Hello, World! ")
.color(0xFFAAFF)
.click_event(ClickEvent::open_url("https://github.com/Maxuss/lobster"))
.append(
Component::translatable("my.translation.key")
.color(NamedColor::Gold)
.hover_event(HoverEvent::ShowText(Component::text("Click for surprise!")))
.insert_text("I love lobsterchat!")
)
.append(
Component::keybind("key.sprint")
.bold(true)
.italic(false)
);
println!("{}", text_component.to_string());
use lobsterchat::message::*;
use lobsterchat::component::{Component, Colored, NamedColor};
let component: Component = lobster("<gold><bold>This is some message!</bold> <blue>Some blue text <#AAFFAA>Some hex text!");
let placeholdered: Component = placeholder_lobster(
"Some normal text. <first> And then <gold><second>.",
[
(
"first",
Component::text("Some replacement.").color(NamedColor::Gold)
),
(
"second",
Component::translatable("translated.text.key")
)
])
Enable minimessage with the minimessage
crate feature
running 1 test
test tests::benchmark_lobster ... bench: 6,335 ns/iter (+/- 147)
So around 6mcs to convert message into a component.
-
Component types (literal, translatable, etc.)
-
Formatting and colors
-
Click / Hover events in components
-
Named color tags (e.g.
<red>, <blue>
) -
Hex color tags (e.g.
<#AAFFAA>
) -
Formatting tags (e.g.
<bold>, <reset>
) -
Placeholder tags
-
Hover / Click Events
-
Advanced formatting tags (e.g.
<rainbow>, <gradient>
)