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

They aren't called by their specific name - they have metadata.

The way to get the item (for example, bonemeal) is to get it by its metadata. (Items.dye, int metadata)

 

Bonemeal is Dye (metadata: 15)

Items.dye, 15.

  • Author

ok thanks but how does that work if the code is getting a string

GameRegistry.addRecipe(new ItemStack(dyeblock1, 1), new Object[] {"  ","BB ","BB ", 'B', Item.itemRegistry.getObject("bonemeal")});

       

        }

because it wouldnt function if i changed bonemeal to Item.Dyes, 15. Also arent they (trying to) removing that in 1.8 so would there be another way to call the dyes

You don't call items like that.

 

GameRegistry.addRecipe(new ItemStack(dyeblock1, 1), new Object[] {"   ","BB ","BB ", 'B', new ItemStack(Items.dye, 1, 15)});

 

Would be how you do it.

 

From what I know, the Item class is what contains all the methods that you'll use and it initialises the items, but the Items class is where you call the items from when using the item objects in code.

 

When you need metadata for something you use an ItemStack

 

call it using "new ItemStack(Block/Item, amount, metadata)"

 

so yours would be

new ItemStack(Items.dye, 1, 15)

where Items.dye is the dye item

1 is the amount (which is irrelevant really, because it sorta defaults to 1 and nothing higher really works as far as I know)

and 15 would be the metadata

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.