Expected behavior
When using bundles I would expect getCursor to return the item in the cursor. To be more specific, I would expect getCursor to return:
- The item being inserted/removed from the bundle when right clicking the bundle while it is in an inventory
- The bundle when inserting/removing items while holding the bundle in your cursor
Observed/Actual behavior
When inserting and removing items from a bundle in the inventory, getCursor returns the bundle.
When inserting and removing items from a bundle in the cursor, getCursor returns the item in the slot after the item is moved. For example, when inserting a single a single white wool block into an empty bundle, air will be returned. If you then tried to insert a stack of 64 white wool into the same bundle, a single white wool block would be returned (This the wool block left over after the bundle is filled).
Steps/models to reproduce
- Create a plugin with an InventoryClickEvent similar to this one and put it in a server:
@EventHandler
public void inventoryClick(InventoryClickEvent event) {
System.out.println(event.getCursor());
}
- Give yourself a bundle, you can use
/give @s minecraft:bundle and pick additional stackable items to put in the bundle.
- Notice the output as you insert and remove the additional items from the bundle. Try with the bundle both in your inventory and in your cursor. It should look something like this (I've commented the actions each output corresponds to):
[09:52:50 INFO]: ItemStack{AIR x 1} // picking up the item (expected)
[09:52:51 INFO]: ItemStack{BUNDLE x 1, BUNDLE_META:{meta-type=BUNDLE, items=[ItemStack{WHITE_WOOL x 64}]}} // putting items on the cursor into a bundle in the inventory (unexpected)
[09:52:52 INFO]: ItemStack{BUNDLE x 1} // taking items out of the bundle in the inventory (unexpected)
[09:52:53 INFO]: ItemStack{WHITE_WOOL x 64} // putting the items back into the inventory (expected)
[09:52:53 INFO]: ItemStack{AIR x 1} // picking up the bundle (expected)
[09:52:54 INFO]: ItemStack{AIR x 1} // inserting a single item into the bundle in the cursor (unexpected)
[09:52:55 INFO]: ItemStack{WHITE_WOOL x 1} // inserting a stack of items into the bundle where one is wool is left after the bundle is filled (unexpected)
[09:52:57 INFO]: ItemStack{WHITE_WOOL x 64} // removing items from the bundle back into the inventory (unexpected)
[09:52:57 INFO]: ItemStack{BUNDLE x 1} // dropping the bundle (expected)
If it helps, here is the video where I generated the above output: https://github.com/PaperMC/Paper/assets/17679976/7a6a61c2-dad0-45ff-ae47-2a39af0b33bb
Plugin and Datapack List
Only the test plugin is present on this server. There no additional datapacks present.
Paper version
This server is running Paper version 1.20.6-147-ver/1.20.6@e41d44f (2024-06-17T19:24:35Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
You are running the latest version
Previous version: git-Paper-477 (MC: 1.20.4)
Other
Bundles are returned properly when you are not putting items in or taking items out.
Sorry if this is too much information. I wanted to be as specific as possible.
Expected behavior
When using bundles I would expect
getCursorto return the item in the cursor. To be more specific, I would expectgetCursorto return:Observed/Actual behavior
When inserting and removing items from a bundle in the inventory,
getCursorreturns the bundle.When inserting and removing items from a bundle in the cursor,
getCursorreturns the item in the slot after the item is moved. For example, when inserting a single a single white wool block into an empty bundle, air will be returned. If you then tried to insert a stack of 64 white wool into the same bundle, a single white wool block would be returned (This the wool block left over after the bundle is filled).Steps/models to reproduce
/give @s minecraft:bundleand pick additional stackable items to put in the bundle.If it helps, here is the video where I generated the above output: https://github.com/PaperMC/Paper/assets/17679976/7a6a61c2-dad0-45ff-ae47-2a39af0b33bb
Plugin and Datapack List
Only the test plugin is present on this server. There no additional datapacks present.
Paper version
Other
Bundles are returned properly when you are not putting items in or taking items out.
Sorry if this is too much information. I wanted to be as specific as possible.