Jump to content

working whit meta items. adding and consuming metaItems


perromercenary00

Recommended Posts

good days

i need little help whith itemStacks, two little commands

i have made  two meta items:  suspencionderedstone  y  suspencionderedstoneActivada

each of whith 8 meta subitems wath i wana doo is first check if player has in his inventory the especific meta item (1)

and it it has change it for other meta item (1)  more or lest i have this

 

 

public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer steve){

 

if (steve.inventory.hasItem(modItems.varaMercenaria)){ //here  i need someting like

// steve.inventory.hasItemStack(modItems.suspencionderedstone,1, 2)//(item ,cuantity, meta)

 

steve.inventory.consumeInventoryItem(modItems.suspensionderedstone);//here i need something like

//steve.inventory.consumeInventoryItemStack(modItems.suspensionderedstone,1 ,2);

 

 

steve.inventory.addItemStackToInventory(new ItemStack(modItems.suspensionderedstoneActivada, 1, 2));//this works pretty well

 

}

}

 

:o

Link to comment
Share on other sites

more or less

 

the thing is that i have a multi meta item

 

//item                      //meta

suspencionderedstone 0

suspencionderedstone 1

suspencionderedstone 2

suspencionderedstone 3

suspencionderedstone 4

suspencionderedstone 5

suspencionderedstone 6

suspencionderedstone 7

 

i need to know if it is in the inventory at least one of the especific meta for example:

 

i wanna know if there is suspencionderedstone 4  exactly the 4  and whit this in mind consume "suspencionderedstone 4"  and based on that add to the inventory suspencionderedstoneActivate 4

 

if there is "suspencionderedstone 4" in inventory replace it whith "suspencionderedstoneActivate 4"

 

but the methods i found only work with items whitout  metadata

 

steve.inventory.hasItem()

steve.inventory.consumeInventoryItem()

 

 

but

steve.inventory.addItemStackToInventory(new ItemStack(modItems.suspensionderedstoneActivada, 1, 2);

this one leftme define the metadata

 

 

 

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.