Posted February 16, 20205 yr I want to set localized CustomName(e.g. "componentA (componentB)") to chests. I wrote this: chestEntity.setCustomName(new TranslationTextComponent("chestname.testmod.testA") + " (" + new TranslationTextComponent("chestname.testmod.testB") + ")"); However, setCustomName method requires TextComponent. How do I do? Edited February 17, 20205 yr by kyazuki
February 16, 20205 yr ITextComponent provides an appendText(String text) and an appendSibling(ITextComponent component) method. You can chain these together to get your desired output. I.e. chestEntity.setCustomName(new TranslationTextComponent("chestname.testmod.testA").appendText(" (").appendSibling(new TranslationTextComponent("chestname.testmod.testB")).appendText")")); PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.