Skip to content

lucko/text

 
 

Repository files navigation

text

A text library for Minecraft.

Build Status codecov

Example usage:

// Creates a line of text saying "You're a Bunny! Press <key> to jump!", with some colouring and styling.
final TextComponent textComponent = TextComponent.of("You're a ")
    .color(TextColor.GRAY)
    .append(TextComponent.of("Bunny").color(TextColor.LIGHT_PURPLE))
    .append(TextComponent.of("! Press "))
    .append(
        KeybindComponent.of("key.jump")
            .color(TextColor.LIGHT_PURPLE)
            .decoration(TextDecoration.BOLD, true)
    )
    .append(TextComponent.of(" to jump!"));
// now you can send `component` to something, such as a client

You can also use a builder, which is mutable, and creates one final component with the children.

// Creates a line of text saying "You're a Bunny! Press <key> to jump!", with some colouring and styling.
final TextComponent textComponent = TextComponent.builder().content("You're a ")
    .color(TextColor.GRAY)
    .append(TextComponent.of("Bunny").color(TextColor.LIGHT_PURPLE))
    .append(TextComponent.of("! Press "))
    .append(
        KeybindComponent.of("key.jump")
            .color(TextColor.LIGHT_PURPLE)
            .decoration(TextDecoration.BOLD, true)
    )
    .append(TextComponent.of(" to jump!"))
	.build();
// now you can send `textComponent` to something, such as a client

About

A text library for Minecraft.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.9%
  • Shell 0.1%