Posted November 15, 20195 yr 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.
November 15, 20195 yr 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.
November 15, 20195 yr 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?
November 16, 20195 yr 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.