Jump to content

[1.16.5] simple way to merge ItemStacks?


Nyko

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 comment
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 comment
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 comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

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