Jump to content

[1.7.2] New in modding help with item metadata


aguinmox

Recommended Posts

Items do not have metadata - the getMetadata(int param) is passed the ItemStacks.itemDamage value and the method converts it to the "metadata" desired. So, this call is not for actual metadata, it is to filter out the useless part of the ItemStack's damage value. Normally useful more for ItemBlocks.

Link to comment
Share on other sites

Just so you understand the bug you are creating... the Item class creates any number of items (all completely different even if given the same name) and each Item (instancde) created is only a prototype of all such items. Therefore, any fields created in the Item class are shared with every item in the game. That includes yours and every other player who has on in their inventory. So, if you create an ItemX (and assign any 'metadata' to that object) then every itemX in the game will have the same metadata.  In other words, every player and every ItemX-based item anywhere in the world will be changed when you change yours. Even the ones in players inventories and chests.

I don't think that is what you want.

Link to comment
Share on other sites

I dont get how come if a player remove an item like this with metadata removes the same as others. I mean i only use a custom item which is useless for my practice and i use only int so they will become unique

 

i have blue ingot , yellow ingot <-- wth wrong?

Link to comment
Share on other sites

I dont get how come if a player remove an item like this with metadata removes the same as others. I mean i only use a custom item which is useless for my practice and i use only int so they will become unique

 

i have blue ingot , yellow ingot <-- wth wrong?

 

The proper way to do what you seem to want (see ItemDye class) is to assign subtypes via Item#hasSubtypes and getIconFromDamage() as well as getSubItems(). The itemStack contains the damage value from which the subItem is determined, not some added field that has no meaning to minecraft.

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.

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

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

Announcements



×
×
  • Create New...

Important Information

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