Blood Magic

Blood Magic

90M Downloads

Blank Rune not properly listed in en_US.lang, fails on Block.getLocalizedName

TeamDman opened this issue ยท 7 comments

commented

calling getLocalizedName() on bloodstone blocks (and others) returns
tile.BloodMagic.bloodstonebrick..name
rather than
Blank Rune

Example code:

ChatUtil.sendNoSpam(player,new TextComponentTranslation(ModBlocks.bloodRune.getLocalizedName()));

ChatUtil.sendNoSpam(player,new TextComponentTranslation( Utils.getBlockForComponent(EnumAltarComponent.BLOODSTONE).getLocalizedName()));

https://github.com/WayofTime/BloodMagic/blob/1.9/src/main/resources/assets/bloodmagic/lang/en_US.lang#L215

https://github.com/WayofTime/BloodMagic/blob/1.9/src/main/java/WayofTime/bloodmagic/api/Constants.java#L271

commented

Use getUnlocalizedName(ItemStack) in the ItemBlock and localize it manually.

commented

ChatUtil.sendNoSpam(player, new TextComponentTranslation(I18n.format(new ItemStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODSTONE)).getUnlocalizedName())));

still returns
tile.BloodMagic.bloodstonebrick.large
unless I am doing that wrong?

commented

Re-read my comment.

commented

Is using I18n.format not manual localization compared to using .getLocalizedName()?

commented

There is a major difference between getUnlocalizedName() and getUnlocalizedName(ItemStack).

commented

Thanks for your help!

Working code in case someone else stumbles across this:
ChatUtil.sendNoSpam(player, new TextComponentTranslation(I18n.format( new ItemStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODSTONE)).getItem().getUnlocalizedName(new ItemStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODSTONE)))) + ".name" ));

commented

Btw, Utils.getBlockForComponent() gets the default block that the Altar Maker uses. It is not intended for anything else.