Jump to content

Limit inventory content.


Nauktis

Recommended Posts

Hi,

 

I an trying to limit what can be inserted in an inventory.

The kind of limitation I need is:

  • "No more than 10 item Items.apple at any given time."
  • "No more than 8 item Items.arrow at any given time."

(all Items.apple do not need to be in the same slot)

 

I am not looking for getInventoryStackLimit() as it will depend on the kind of item.

I need the limitation to be applicable for GUI interactions but also machines inserting (hoppers and whatnot).

 

I am currently using a IInventory as sides do not matter but it seems ISidedInventory allows for more control.

Worst case scenario, I disallow interactions from machines and use the Slot to have more fine grained control.

 

What do you think?

 

Thanks a lot beforehand for your help ;)

Link to comment
Share on other sites

Alright, I'll try it this way then.

 

I didn't try before because the Javadoc is saying:

/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/

 

Any idea why "(ignoring stack size)"?

It is usually used to limit the kind of item you can put in.

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.