Jump to content

Giving different names to damage values


Recommended Posts

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?

Link to comment
Share on other sites

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.

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.

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.