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.

Check if player has at least a certain ammount of multiple items to do something.

Featured Replies

Posted

I made a upgradable block similar to the "wooden frame" from 7 days to die. I want it when the player tries to upgrade a wooden frame, it searches the players inventory for if they have:

 

at least 10 oak boards (an item I will add to my mod)

and at least 5 iron nails (another item I plan to add)

 

If they have the items, they can then proceed to upgrade the block in which said items will be removed.

 

I am currently searching for a way to implement this.

Thanks for any help.

You can get the inventory of an EntityPlayer object, check through it for your ItemStacks, check if they're large enough, and, if those checks are passed, shrink the stacks by your amounts.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

  • Author

but what if the items they have are spread over multiple slots?

what if they have 5 oak boards in one slot, and the other 5 in another slot?

  • Author
20 hours ago, diesieben07 said:

So what? You know how to write a for loop, right? This is basic programming.

I know about for loops, the thing is I do not know how to do the math/code behind "if the first slot runs out find another slot with the same item and use that".

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.