Posted November 27, 201212 yr Hello, all I am trying to do is give different names to different damage values of an object. for (int x = 0; x < SaberMod.starMapNames.length; x++) { ItemStack starMap = new ItemStack(SaberMod.starMap, 1, x); LanguageRegistry.addName(starMap, "Star Map: " + SaberMod.starMapNames[x]); } As you can see above, my code parses through every name for my item, then finds the item with its value depending on the name being parsed, then it adds the name to that damage value. However, When I test all of the items of the type have the last name in the String[] object as their name, not the individual name. This is happening because it's not recognizing the data value and applying it to the entire item, what can I do to solve this?
November 27, 201212 yr Hmmm there is an other way to get a name to the item. but this need itemmetadata. it comes from the item itself. and i do not know if its language config compatibel is. but here is the code. it comes in the itemwhatever class. public String getItemDisplayName(ItemStack par0) { String par1 = ""; switch(par0.getItemDamage()) { case 0 : par1 = "Item1 Damage 0"; break; case 2000: par1 = "Whatever"; break; default: "Everthing else than 1 and 2000"; } return par1; } This is the code. i use it by my self. and it work with metadata items very good and its very easy to extend it. but ever case need a break. default not. i hope i could help. and when not then no problem.
November 28, 201212 yr Author When I place one item with a data value onto a stack of the same items but with different data values, they combine, how could I stop this?
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.