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

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

Well, there is hasItemStack:

 

steve.inventory.hasItemStack(new ItemStack(modItems.suspencionderedstone,1, 2);

 

There isn't consumeItemStack.

 

There is addItemStackToInventory:

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

 

Is that what you were asking?

  • Author

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

 

 

 

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.