Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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.

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.