Posted December 22, 20213 yr i try: @Override @OnlyIn(Dist.CLIENT) public void appendHoverText(ItemStack itemStack, @Nullable World world, List<ITextComponent> textComponents, ITooltipFlag tipFlag) { if (itemStack.getTag() != null) { textComponents.add(new TranslationTextComponent("tooltip.chinacraft.silk_worm.schedule",10)); } } No effect, he didn't append variables behind mine
December 22, 20213 yr first do never use @OnlyIn, since it's only for vanilla second, do you want to have the '10' as replacement for your TranslationTextComponent? -> if yes, that's not how the TranslationTextComponent worked, you need to put the Translation into the language file -> if not, explain what you mean by 'he didn't append variables behind mine'
December 23, 20213 yr Author 7 hours ago, Luis_ST said: first do never use @OnlyIn, since it's only for vanilla second, do you want to have the '10' as replacement for your TranslationTextComponent? -> if yes, that's not how the TranslationTextComponent worked, you need to put the Translation into the language file -> if not, explain what you mean by 'he didn't append variables behind mine' This is my language file I also have a custom variable, I want to splice it to the back of the language file to make it look like this: Growth progress: 20 "tooltip.chinacraft.silk_worm.schedule": "§aGrowth progress: ", @Override public void appendHoverText(ItemStack itemStack, @Nullable World world, List<ITextComponent> textComponents, ITooltipFlag tipFlag) { if (itemStack.getTag() != null) { textComponents.add(new TranslationTextComponent("tooltip.chinacraft.silk_worm.schedule")); } } I am curious how it is implemented in the code. Or do I need to implement it in the language file? I use translation software, if you don’t understand, I’m sorry Edited December 23, 20213 yr by Spring
December 23, 20213 yr 8 hours ago, Spring said: I also have a custom variable, I want to splice it to the back of the language file to make it look like this: Growth progress: 20 19 hours ago, Spring said: new TranslationTextComponent("tooltip.chinacraft.silk_worm.schedule",10) this is correct but the translation should look like this: "tooltip.chinacraft.silk_worm.schedule": "Growth progress: %s" 8 hours ago, Spring said: §a do not use color codes, use IFormattableTextComponent#mergeStyle
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.