Before the recent ItemStack changes, you could new ItemStack(AIR, 0) to create an empty ItemStack (an ItemStack#empty, basically).
Observed/Actual behavior
amount is limited to above 0 now, even though places like ItemStack#empty/ItemType#createItemStack still allow that, which breaks old code from before ItemStack#empty using an amount of 0 to create empty stacks & is a bit of a weird inconsistency in general.
> datapack list
[11:23:16 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[11:23:16 INFO]: There are no more data packs available
Paper version
> version
[11:23:29 INFO]: Checking version, please wait...
[11:23:29 INFO]: This server is running Paper version 1.21-3-master@4514f41 (2024-06-18T09:17:48Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
You are running the latest version
Expected behavior
Before the recent
ItemStack
changes, you couldnew ItemStack(AIR, 0)
to create an emptyItemStack
(anItemStack#empty
, basically).Observed/Actual behavior
amount is limited to above 0 now, even though places like
ItemStack#empty
/ItemType#createItemStack
still allow that, which breaks old code from beforeItemStack#empty
using an amount of 0 to create empty stacks & is a bit of a weird inconsistency in general.Steps/models to reproduce
Plugin and Datapack List
Paper version
Other
See Discord discussion: https://discord.com/channels/289587909051416579/555462289851940864/1252563371635638272 Like lynx suggested there, having an
amount
of 0 delgate toItemStack#empty
might be a good solution to both keep compatibility & still not allow creating random 0 amount stacks