mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
handle recent ItemMeta changes in serialization logic
This commit is contained in:
parent
c5fb79b218
commit
b71a9db7ad
1 changed files with 18 additions and 0 deletions
|
@ -296,6 +296,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
CraftMetaItem.getOrEmpty(tag, CraftMetaItem.NAME).ifPresent((component) -> {
|
CraftMetaItem.getOrEmpty(tag, CraftMetaItem.NAME).ifPresent((component) -> {
|
||||||
this.displayName = component;
|
this.displayName = component;
|
||||||
});
|
});
|
||||||
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
Map<?, ?> mods = SerializableMeta.getObject(Map.class, map, key.BUKKIT, true);
|
||||||
|
Multimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create();
|
||||||
|
if (mods == null) {
|
||||||
|
- return result;
|
||||||
|
+ return null; // Paper - null is different from an empty map
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Object obj : mods.keySet()) {
|
||||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +395,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
||||||
}
|
}
|
||||||
if (this.customTag != null) {
|
if (this.customTag != null) {
|
||||||
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void serializeModifiers(Multimap<Attribute, AttributeModifier> modifiers, ImmutableMap.Builder<String, Object> builder, ItemMetaKey key) {
|
||||||
|
- if (modifiers == null || modifiers.isEmpty()) {
|
||||||
|
+ if (modifiers == null/* || modifiers.isEmpty()*/) { // Paper - null and an empty map have different behaviors
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
// Paper start - improve checking handled tags
|
// Paper start - improve checking handled tags
|
||||||
@org.jetbrains.annotations.VisibleForTesting
|
@org.jetbrains.annotations.VisibleForTesting
|
||||||
|
|
Loading…
Reference in a new issue