Commit graph

13 commits

Author SHA1 Message Date
Jake Potrebic
8a5f5f023a Fix stacks losing empty attr modifiers
Fixes #10686
2024-05-10 12:05:06 -07:00
Jake Potrebic
dfd0478a87 Fix BlockStateMeta (#10647)
* Fixes CraftMetaBlockState block entity data components

* rebase and merge into general item meta fix

* Add javadoc notice

* Update message

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-05-05 12:56:46 -07:00
Jake Potrebic
838bab409e Updated Upstream (CraftBukkit) (#10646)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
66fd94322 SPIGOT-7652: Remove remap for SPELL_MOB_AMBIENT which no longer exists
ecfa4f973 SPIGOT-7654: ItemStack#isSimilar does not work with empty BlockStateMeta
4460ecc49 SPIGOT-7655: ItemMeta#addItemFlags(ItemFlag.HIDE_ATTRIBUTES) not working when no attribute modifiers set
5d84f48a4 SPIGOT-7653: Update ApiVersion.CURRENT with latest version and include tests
2024-05-05 09:08:55 -07:00
Bjarne Koll
252c489f15 Keep components using single items in creative (#10664)
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.
2024-05-05 11:40:36 +02:00
Jake Potrebic
9987c3cb96 Reset component prototype on itemtype change 2024-04-28 17:13:30 -07:00
Jake Potrebic
b10448ebda Fix CraftMetaBlockState adding extra tags 2024-04-28 12:34:11 -07:00
Jake Potrebic
819639770e final missing validation for data components 2024-04-28 09:46:30 -07:00
Jake Potrebic
c45369311e respect hard list size limits in ItemMeta 2024-04-28 09:06:14 -07:00
Shane Freeder
36fa573f48 Fix another missing book meta tag 2024-04-28 13:48:20 +01:00
Shane Freeder
4aab51d78a Fix book meta lacking resolved tag from older versions (Fixes #10470) 2024-04-28 13:15:03 +01:00
Nassim Jahnke
7ffc581d32 Fix test compilation 2024-04-28 14:20:52 +02:00
Jake Potrebic
c6bdd67d28 more fixes for ItemMeta relating to components 2024-04-27 22:27:51 -07:00
Jake Potrebic
c534b3e0ea Fix firework meta NPE
Fixes #10466
2024-04-27 20:57:42 -07:00