3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Fix stacks losing empty attr modifiers

Fixes #10686
Dieser Commit ist enthalten in:
Jake Potrebic 2024-05-10 12:05:06 -07:00
Ursprung 4fd58a1b8f
Commit 39532a1f8c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5

Datei anzeigen

@ -260,7 +260,7 @@ index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..cf5d27ccc2225bac3aa57912f444f95d
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 0bc100430483f88bc7edf17645250b2862ccc1d5..03f9fff7c06bf5f166d6277e3aa6adb5f646042d 100644
index 0bc100430483f88bc7edf17645250b2862ccc1d5..1f3927ec4a44bc001285869c96a67e687e7438da 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -165,9 +165,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -287,13 +287,15 @@ index 0bc100430483f88bc7edf17645250b2862ccc1d5..03f9fff7c06bf5f166d6277e3aa6adb5
CraftMetaItem.getOrEmpty(tag, CraftMetaItem.NAME).ifPresent((component) -> {
this.displayName = component;
});
@@ -880,9 +886,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -879,10 +885,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
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)) {
- 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
return;
}