Text Components RS
This is a library for easy implementation and usage of Minecraft's Text Components, designed for Java edition but extensible to match Bedrock's Components.
Usage
You can make your first text component like this:
let component = plain;
Decorate it like this:
let component = component.color.bold;
Adding interactivility like this:
let component = component.insertion;
let component = component.hover_event;
let component = component.click_event;
Once the component is ready to be sent or displayed only rests building it:
component.build;
// Equivalent of doing:
component.to_pretty;
If you want to use serde you will need to do this instead:
component.resolve.serialize;
Displaying TextComponents
TextComponent implements Display for easy logging, as you can see, a component
needs to be resolved before building it into any format, by default it uses a static
reference to NoResolutor, but can be changed to a custom one with:
(Resolutor must be static, or made inside the function call)
set_display_resolutor;
A text component can be printed like a string like this:
println!;
// With format (pretty):
println!;
Roadmap
- Text Components
- Build system
- Resolution system
- Parsing system
- Translations build macro
- Terminal integration
- Serde integration
- SimdNbt integration
- MiniMessages integration
- Extensibility integration
Test
To test the capabilities of the library you can execute:
With all the features: