Translation in sponge 8.0

In sponge 7.0 I can get ItemStack Translation name by this code.

ItemStack item;

but in sponge 8.0, I couldn’t find the getTranslation method.

How can I get Translation in sponge 8.0 ?

Please help me.

This comes under the component library (new text library)

I believe you can do

Component component = item.asComponent();
if(component instanceof TranslatableComponent){
  TranslatableComponent translatable = (TranslatableComponent) component;
  //text is translatable

You can read more here

1 Like

Thank you so much!