Kenneth201998 Posted November 15, 2019 Posted November 15, 2019 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. Quote
SerpentDagger Posted November 15, 2019 Posted November 15, 2019 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. Quote Fancy 3D Graphing Calculator mod, with many different coordinate systems. Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.
Kenneth201998 Posted November 15, 2019 Author Posted November 15, 2019 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? Quote
Kenneth201998 Posted November 16, 2019 Author Posted November 16, 2019 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". Quote
Recommended Posts
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.