Posted May 11, 20232 yr When player killed mob, my mod will send some item into inventory of player directly. But I find that sometimes the same type items can't merge into one slot. But after put them in mainhand, these items can be merge into one slot. The item be sent is mod custom item, and they have some HoverText added by mod. How to solve it?
May 11, 20232 yr Author Additionally, I use player.addItem(Moditem.TestItem.get().getDefaultInstance()) to send items.
May 13, 20232 yr Author Solved! I found that when the items in your hand, the items would be sent a mod's nbt tag automatically. That caused one slot item had tag, and another slot not. So, the solution is: Before sending items to player, use itemstack.getOrCreateTagElement method to add tag to items firstly. And then all the items have same tags, they can be merged into one slot!
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.