Posted August 11, 201510 yr 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: http://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)
August 11, 201510 yr As you can see the instruction toString() returns you the reference of the class of the Item You should change that to return your Item name Don't blame me if i always ask for your help. I just want to learn to be better
August 11, 201510 yr Author Yeah I know I tried it with toString(). But how can I define the Item Name? I mean the item_name for translations etc.
August 11, 201510 yr 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
August 11, 201510 yr Basically you need to have a translation file for each language you want to support. I have a tutorial on language localization using lang files here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-localization.html Check out my tutorials here: http://jabelarminecraft.blogspot.com/
August 11, 201510 yr Author jabelar that's not my problem. But I've fixed it. btw I use a translation file. 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")); } }
August 11, 201510 yr Glad that it worked, by the way you should follow the diesieben tip, maybe my "solution" could cause some issues in future (he's a better modder than me ) Don't blame me if i always ask for your help. I just want to learn to be better
August 11, 201510 yr Author diesieben07? Was ist falsch daran? Beziehungsweise was stört daran? Ich würde gerne wissen, wenn ich was tue, was ich da tue.
August 11, 201510 yr 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
August 11, 201510 yr 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
August 11, 201510 yr delpi i think that is the name of he's item class with all the packages path returned by the toString method Don't blame me if i always ask for your help. I just want to learn to be better
August 11, 201510 yr Author JimiIT92 that was to diesieben07 'cause his name is german so I know he can speak german
August 11, 201510 yr Ahahahaha don't worry Don't blame me if i always ask for your help. I just want to learn to be better
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.