mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-08-05 16:49:30 +00:00
SPIGOT-7646: Don't duplicate PDC in customTag / retain old values
This commit is contained in:
parent
91b1fc3f1c
commit
bb9a6e9904
1 changed files with 8 additions and 1 deletions
|
@ -372,6 +372,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
persistentDataContainer.put(key, compound.get(key).copy());
|
persistentDataContainer.put(key, compound.get(key).copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
customTag.remove(BUKKIT_CUSTOM_TAG.NBT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (customTag.isEmpty()) {
|
||||||
|
customTag = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -778,6 +784,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NBTTagCompound customTag = (this.customTag != null) ? this.customTag.copy() : null;
|
||||||
if (!persistentDataContainer.isEmpty()) {
|
if (!persistentDataContainer.isEmpty()) {
|
||||||
NBTTagCompound bukkitCustomCompound = new NBTTagCompound();
|
NBTTagCompound bukkitCustomCompound = new NBTTagCompound();
|
||||||
Map<String, NBTBase> rawPublicMap = persistentDataContainer.getRaw();
|
Map<String, NBTBase> rawPublicMap = persistentDataContainer.getRaw();
|
||||||
|
@ -1583,7 +1590,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
builder.put(BUKKIT_CUSTOM_TAG.BUKKIT, persistentDataContainer.serialize());
|
builder.put(BUKKIT_CUSTOM_TAG.BUKKIT, persistentDataContainer.serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customTag != null && !customTag.isEmpty()) {
|
if (customTag != null) {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||||
NBTCompressedStreamTools.writeCompressed(customTag, buf);
|
NBTCompressedStreamTools.writeCompressed(customTag, buf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue