Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] simple way to merge ItemStacks?


Recommended Posts

As already stated in the title, I would like to know if there is an easy way to combine ItemStacks?
 

My problem at the moment is that I have a list with ItemStacks and want to combine them,
which means if the list contains 10 times of stone with a count of 10.
form that I want to make a list with 2 times of stone from it which means the count of the items in total are the same so i have two stack with the count 64 and 36.
is this possible/ is there a simple way to do that?

Link to post
Share on other sites

there isn't a function that does that already.

however writing your own helper function shouldn't be that hard

don't forget to handle the case when the ItemStacks contain different Items, or Items with non-64 maximum stack sizes

  • Thanks 1
Link to post
Share on other sites
1 hour ago, kiou.23 said:

there isn't a function that does that already.

however writing your own helper function shouldn't be that hard

don't forget to handle the case when the ItemStacks contain different Items, or Items with non-64 maximum stack sizes

38 minutes ago, diesieben07 said:

Look at ItemStackHandler#insertItem for an example of how to do this.

thanks for the good ideas

 

Link to post
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.

Guest
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 Privacy Policy.