Using the inventory set command to place an item into a GUI can cause the sorting of the item's NBT keys to change, which may prevent the item from stacking with the original item.
Here's an example to illustrate this. The NBT data below is before and after the item is placed, with the content remaining the same but the order changed.
``
Fu_Meng has the following entity data: {Slot: 0b, id: "minecraft:paper", tag: {NeigeItems: {id: "测试配方", data: "{}", hashCode: 80424972}, display: {Name: '{"text":"","extra":[{"text":"测试配方","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"green","bold":false}]}'}, "材料": {"测试2": 10, "测试1": 10}}, Count: 1b}
Fu_Meng has the following entity data: {Slot: 1b, id: "minecraft:paper", tag: {NeigeItems: {id: "测试配方", data: "{}", hashCode: 80424972}, display: {Name: '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"测试配方"}],"text":""}'}, "材料": {"测试2": 10, "测试1": 10}}, Count: 1b}
This is my code:
- define tempitem <context.cursor_item>
- adjust <player> item_on_cursor:<context.item>
- inventory set o:<[tempitem]> slot:<context.slot> d:<player.open_inventory>