Jump to content

[1.7.10] Getting Translated Block Name


Izzy Axel

Recommended Posts

So, in addInformation, I'm trying to get a block's translated name.  This is what I've been trying:

 

list.add(StatCollector.translateToLocal("Bound Block: " + StatCollector.translateToLocal(Block.getBlockById(stack.stackTagCompound.getInteger(tagID)).getUnlocalizedName())));

 

But this is still returning tile.xxx.name, and getLocalizeName just subtracts the ".name".  What is the correct method for doing this?

Link to comment
Share on other sites

That should return the correct localized name. (Don't use StatCollector for that; It is already localized)

It seems that forge couldn't find your lang file or your lang file does not contain the exact name.

So please post where your lang files are, and the contents of them.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

src\main\resources\assets\filltool\lang\en_US.lang

 

 

itemGroup.FillTab=Fill Tool
item.fillTool.name=Fill Tool

 

 

I don't see how my lang file is the issue here, shouldn't that be an issue with Minecraft's lang file since we're talking about vanilla blocks?

 

 

Woah that's weird, yeah guess there is some issue in the dev workspace, I just put it on my server, and it translates fine

Link to comment
Share on other sites

Oh it was vanilla block. What block do you want to show?

And please post your current code of the item.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

IntelliJ, I add

 

 

idea { module { inheritOutputDirs = true } }
sourceSets { main { output.resourcesDir = output.classesDir } }

 

 

to the end of the build.gradle, import it, run setupDecompWorkspace inside IntelliJ, then run gradlew gIR from a command prompt.

 

PS I should also note, it's giving me translated names for some blocks, and not others in the dev workspace, like sand and dirt are never translated, but grass and leaves are.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.