Jump to content

[SOLVED]Item-Name Color Problem.


Tsiumi

Recommended Posts

Hello

How can I define my Itemname?

I don't mean the Name like "Item Name"

The String Name "item_name"

When i do this:

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean Adva){
    
    
    stack.setStackDisplayName(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("item."+toString()+"."+"name"));	


} }

I got this Ingame:

width=800 height=470http://abload.de/img/2015-08-11_15.52.50dpqa4.png[/img]

How can I fix that?

I want to define:

item.item_name.name but I want this for more Items not just 4 one.

Like:

StatCollector.translateToLoca("item.item_name.name)

 

Link to comment
Share on other sites

Maybe i don't understand your question. Here is what i've understand:

You have an item called (for example) "Super Sword"

It's unlocalized name will be: "item.super_sword.name"

This name must be colored in yellow but the name of the item must be "Super Sword" instead of "item.super_sword.name".

If i'm right you want to know the translated string corresponding to "item.super_sword.name", so you should use this code:

your_item.getLocalizedName();

wich will return the translated name for your item (in this case if you item in the code is called "sword" and you do sword.getLocalizedName(); you will get "Super Sword" as result)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

jabelar that's not my problem.

But I've fixed it.

btw I use a translation file. :D

Thx JimiIT92 I've an Idea.

It works with:

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean Adva){

   

   

    stack.setStackDisplayName(EnumChatFormatting.GOLD + StatCollector.translateToLocal(this.getUnlocalizedName()+".name"));

 

 

} }

Link to comment
Share on other sites

Ehm.... i don't speak german but standing to what Google Translate says i can tell you this: that code might work but there are tons of methods that are surely better than that. And because he is a modder longer than me and he helps me a lot too, i suggest to follow his answer ;) Mine might work and you could be ignore the other answer, it's just a your choice :)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

I would not suggest you keep doing what you are doing.  Follow the way dies said.

 

Also, what is with this???

 

        item.xinsidion.ewm.items.ItemBasicMagic@?????

 

That seems very strange.  Would have expected something like item.xinsidion.ItemBasicMagic@?????

 

not necessarily wrong, but seems very odd.

Long time Bukkit & Forge Programmer

Happy to try and help

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.



×
×
  • Create New...

Important Information

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