Fix stacks losing empty attr modifiers

Fixes #10686
This commit is contained in:
Jake Potrebic 2024-05-10 12:05:06 -07:00
parent 71de67180a
commit 8a5f5f023a

View file

@ -288,12 +288,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.displayName = component; this.displayName = component;
}); });
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
void applyModifiers(Multimap<Attribute, AttributeModifier> modifiers, CraftMetaItem.Applicator tag) { void applyModifiers(Multimap<Attribute, AttributeModifier> modifiers, CraftMetaItem.Applicator tag) {
if (modifiers == null || modifiers.isEmpty()) { - if (modifiers == null || modifiers.isEmpty()) {
- if (this.hasItemFlag(ItemFlag.HIDE_ATTRIBUTES)) { - if (this.hasItemFlag(ItemFlag.HIDE_ATTRIBUTES)) {
- tag.put(CraftMetaItem.ATTRIBUTES, new ItemAttributeModifiers(Collections.emptyList(), false)); - tag.put(CraftMetaItem.ATTRIBUTES, new ItemAttributeModifiers(Collections.emptyList(), false));
- } - }
+ if (modifiers == null/* || modifiers.isEmpty()*/) { // Paper - empty modifiers has a specific meaning, they should still be saved
+ // Paper - don't save ItemFlag if the underlying data isn't present + // Paper - don't save ItemFlag if the underlying data isn't present
return; return;
} }