Fix patch conflict with upstream

This commit is contained in:
Zach Brown 2017-04-22 17:49:47 -05:00
parent f68b2ab95e
commit 5f3d5d8170
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -1,4 +1,4 @@
From 89011dc877a65af7754e98c4764d44c93e5772f2 Mon Sep 17 00:00:00 2001 From dc7e3a08fdabca0ced4e60d7c27aa58790185d29 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400 Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies Subject: [PATCH] Handle Item Meta Inconsistencies
@ -144,7 +144,7 @@ index a54bc7c42..81ec8f69e 100644
static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) { static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index ec5680633..9e7f9c661 100644 index a9a338a82..0ac639f76 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -6,13 +6,8 @@ import java.lang.annotation.RetentionPolicy; @@ -6,13 +6,8 @@ import java.lang.annotation.RetentionPolicy;
@ -162,7 +162,7 @@ index ec5680633..9e7f9c661 100644
import net.minecraft.server.NBTBase; import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagCompound; import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.NBTTagList; import net.minecraft.server.NBTTagList;
@@ -37,10 +32,18 @@ import com.google.common.collect.Sets; @@ -38,10 +33,18 @@ import com.google.common.collect.Sets;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
@ -181,7 +181,7 @@ index ec5680633..9e7f9c661 100644
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.NBTCompressedStreamTools; import net.minecraft.server.NBTCompressedStreamTools;
@@ -224,7 +227,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -225,7 +228,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
private String displayName; private String displayName;
private String locName; private String locName;
private List<String> lore; private List<String> lore;
@ -190,7 +190,7 @@ index ec5680633..9e7f9c661 100644
private int repairCost; private int repairCost;
private int hideFlag; private int hideFlag;
private boolean unbreakable; private boolean unbreakable;
@@ -232,7 +235,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -233,7 +236,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
private static final Set<String> HANDLED_TAGS = Sets.newHashSet(); private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
private NBTTagCompound internalTag; private NBTTagCompound internalTag;
@ -199,7 +199,7 @@ index ec5680633..9e7f9c661 100644
CraftMetaItem(CraftMetaItem meta) { CraftMetaItem(CraftMetaItem meta) {
if (meta == null) { if (meta == null) {
@@ -247,7 +250,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -248,7 +251,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
if (meta.enchantments != null) { // Spigot if (meta.enchantments != null) { // Spigot
@ -208,7 +208,7 @@ index ec5680633..9e7f9c661 100644
} }
this.repairCost = meta.repairCost; this.repairCost = meta.repairCost;
@@ -468,13 +471,13 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -469,13 +472,13 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
} }
@ -218,13 +218,13 @@ index ec5680633..9e7f9c661 100644
return null; return null;
} }
NBTTagList ench = tag.getList(key.NBT, 10); NBTTagList ench = tag.getList(key.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
- Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(ench.size()); - Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(ench.size());
+ EnchantmentMap enchantments = new EnchantmentMap(); // Paper + EnchantmentMap enchantments = new EnchantmentMap(); // Paper
for (int i = 0; i < ench.size(); i++) { for (int i = 0; i < ench.size(); i++) {
int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT); int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT);
@@ -545,13 +548,13 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -546,13 +549,13 @@ class CraftMetaItem implements ItemMeta, Repairable {
void deserializeInternal(NBTTagCompound tag) { void deserializeInternal(NBTTagCompound tag) {
} }
@ -240,7 +240,7 @@ index ec5680633..9e7f9c661 100644
for (Map.Entry<?, ?> entry : ench.entrySet()) { for (Map.Entry<?, ?> entry : ench.entrySet()) {
Enchantment enchantment = Enchantment.getByName(entry.getKey().toString()); Enchantment enchantment = Enchantment.getByName(entry.getKey().toString());
@@ -695,12 +698,12 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -696,12 +699,12 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
public Map<Enchantment, Integer> getEnchants() { public Map<Enchantment, Integer> getEnchants() {
@ -255,7 +255,7 @@ index ec5680633..9e7f9c661 100644
} }
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
@@ -870,7 +873,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -871,7 +874,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
clone.lore = new ArrayList<String>(this.lore); clone.lore = new ArrayList<String>(this.lore);
} }
if (this.enchantments != null) { if (this.enchantments != null) {
@ -264,7 +264,7 @@ index ec5680633..9e7f9c661 100644
} }
clone.hideFlag = this.hideFlag; clone.hideFlag = this.hideFlag;
clone.unbreakable = this.unbreakable; clone.unbreakable = this.unbreakable;
@@ -1027,6 +1030,28 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -1028,6 +1031,23 @@ class CraftMetaItem implements ItemMeta, Repairable {
} }
} }
@ -276,12 +276,7 @@ index ec5680633..9e7f9c661 100644
+ } + }
+ +
+ private EnchantmentMap() { + private EnchantmentMap() {
+ super(new Comparator<Enchantment>() { + super((o1, o2) -> ((Integer) o1.getId()).compareTo(o2.getId()));
+ @Override
+ public int compare(Enchantment o1, Enchantment o2) {
+ return ((Integer) o1.getId()).compareTo(o2.getId());
+ }
+ });
+ } + }
+ +
+ public EnchantmentMap clone() { + public EnchantmentMap clone() {