diff options
Diffstat (limited to 'patches/server/0074-Handle-Item-Meta-Inconsistencies.patch')
-rw-r--r-- | patches/server/0074-Handle-Item-Meta-Inconsistencies.patch | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch index efd643e957..b7c0d2e42f 100644 --- a/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0074-Handle-Item-Meta-Inconsistencies.patch @@ -150,7 +150,7 @@ index b6521462d193bff83ace1dc694c6d957a7173969..d302767e8f01fdfcba9c22e2e35677af static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0fc61f8161 100644 +index 9e23cdef8bd166937093452009f50b86e683cc57..a052c2dab5af99355737a88f75cb0b2e42a60177 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -161,7 +161,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; -@@ -22,6 +23,7 @@ import java.util.Arrays; +@@ -23,6 +24,7 @@ import java.util.Arrays; import java.util.Base64; import java.util.Collection; import java.util.Collections; @@ -169,15 +169,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; -@@ -32,6 +34,7 @@ import java.util.Map; - import java.util.Objects; - import java.util.Optional; - import java.util.Set; -+import java.util.TreeMap; // Paper - import java.util.logging.Level; - import java.util.logging.Logger; - import javax.annotation.Nonnull; -@@ -221,7 +224,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -236,7 +238,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { private List<Component> lore; // null and empty are two different states internally private Integer customModelData; private Map<String, String> blockData; @@ -186,7 +178,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f private Multimap<Attribute, AttributeModifier> attributeModifiers; private int repairCost; private int hideFlag; -@@ -260,7 +263,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -275,7 +277,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = meta.blockData; if (meta.enchantments != null) { @@ -195,7 +187,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f } if (meta.hasAttributeModifiers()) { -@@ -391,8 +394,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -406,8 +408,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -206,7 +198,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f tag.entrySet().forEach((entry) -> { Holder<net.minecraft.world.item.enchantment.Enchantment> id = entry.getKey(); -@@ -646,13 +649,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -661,13 +663,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return modifiers; } @@ -220,9 +212,9 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f - Map<Enchantment, Integer> enchantments = new LinkedHashMap<Enchantment, Integer>(ench.size()); + EnchantmentMap enchantments = new EnchantmentMap(); // Paper for (Map.Entry<?, ?> entry : ench.entrySet()) { - // Doctor older enchants - String enchantKey = entry.getKey().toString(); -@@ -973,14 +976,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + Enchantment enchantment = CraftEnchantment.stringToBukkit(entry.getKey().toString()); + if ((enchantment != null) && (entry.getValue() instanceof Integer)) { +@@ -982,14 +984,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Map<Enchantment, Integer> getEnchants() { @@ -239,7 +231,7 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f } if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { -@@ -1516,7 +1519,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1553,7 +1555,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.customModelData = this.customModelData; clone.blockData = this.blockData; if (this.enchantments != null) { @@ -248,13 +240,13 @@ index 3f309c255097f6778854d710a5a045fa960a953f..c318552a2ac2710cea01ac449a469a0f } if (this.hasAttributeModifiers()) { clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); -@@ -1836,4 +1839,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1875,4 +1877,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return (result != null) ? result : Optional.empty(); } + + // Paper start -+ private static class EnchantmentMap extends TreeMap<Enchantment, Integer> { ++ private static class EnchantmentMap extends java.util.TreeMap<org.bukkit.enchantments.Enchantment, Integer> { + private EnchantmentMap(Map<Enchantment, Integer> enchantments) { + this(); + putAll(enchantments); |