Ember's Text API Unofficial KubeJS Forge Backport

Backports Ember's Text API KubeJS support for Forge 1.20.1.

This is an addon to Ember's Text API which ports KubeJS integration from the Neoforge 1.21.1 version to Forge 1.20.1. This is helpful for servers/modpacks in displaying text to players with custom animation and effects.

  • Creating and styling messages
  • Sending messages to players
  • Custom item tooltips

In this example, a text is displayed the moment a player has respawned. I used EmbersText.markup(duration, text) to create an ImmersiveMessage object then send it to the player via EmberText.send(player, message).

PlayerEvents.respawned(event => {
    const {player} = event
   
    let message = EmbersText.markup(60, "You've met with a terrible fate, haven't you?")
        .anchor("bottom_center")
        .fadeOutTicks(10)
        .scale(1)
        .offset(0, -75)
        .align("center")
    EmberText.send(player, message)
})
 

See Ember's Text API wiki for all possible methods.

I recommend using ProbeJS Legacy to get typings in 1.20.1 for VSCode.

The Ember's Text API Unofficial KubeJS Forge Backport Team

profile avatar
  • 2
    Projects
  • 150
    Downloads

More from unusualgravy