Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
7ae2c671c6
The craftbukkit implementation stores the old and new data patch of an item during ItemStack#useOn(UseOnContext) to properly cancel events via comparison and change detection of the component patch. However, it uses #getComponentsPatch to fetch the new stack component patch, which always yields an empty patch set if an itemstack is considered empty by the game. As the restoration of an itemstack's count to its previous state is handled after the entire ItemStack#useOn method, items used in creative mode temporarily have a count of zero, which causes craftbukkit to consider their new component patch as EMPTY even tho said item may have data. The new patch is applied and, after useOn completes, the count is reset if the player is in creative mode, leading to lost data. This commit fixes said inconsistency by directly accessing the components of the item via components#asPatch, storing the proper component patch even for an item that temporarily has a count of zero. |
||
---|---|---|
.. | ||
api | ||
server |