Jump to content

[1.7.10]Change max stack size in container


Recommended Posts

In my container, I want to be able to stack items larger than the default size. I have searched the forums, but haven't seen anything on it. I know it is possible because ExtraUtilities does it for the Filing Cabinet and AE does it as well.


The problem is I am not sure where to start. I thought about just having a Map of some kind (Map<String, List<ItemStack>>) and I could store all the items of a kind in separate stack under a key and just change how I draw them but that doesn't sound right.


What is the preferred way to make it so a slot in a container can stack items larger than the default?

Link to comment
Share on other sites

Do you have any suggestions though?


As diesieben07 says, the problem is that the built-in container system uses an item stack directly and item stacks are limited to 64.  But since this is Java you can make your own kind of container that keeps track of the quantities in a custom field. 


I'm not sure what you specifically wanted to do with this container, but generically you'd have to make sure you can display the quantity correctly (so you'd have to make your own rendering using item icon plus quantity based on your field) and you'd have to replicate the methods for moving things into and out of slots but base it on the custom quantity field instead of the item stack size.


You may also have trouble in how you drop items and how player can get them.  Basically you'll have to break up the stacks into 64-max stacks.  Like if you had a custom slot with 100 quantity in it, if the player took that then you'd have to give them a stack of 64 and a stack of 36.


It is basically a lot of coding to do, so I'd personally only tackle it if you are both a strong programmer and you really, really want this.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.