mirror of
https://github.com/PaperMC/Paper.git
synced 2025-04-13 15:36:27 +02:00
SPIGOT-7646: Don't duplicate PDC in customTag / retain old values
By: md_5 <git@md-5.net>
This commit is contained in:
parent
4ae8689c1b
commit
1390477e34
@ -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…
Reference in New Issue
Block a user