1
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-02 11:22:01 +01:00

Move deserialized removed unhandled tags to dedicated removedTags

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-06-15 10:09:35 +10:00
parent 87c3fdad31
commit 85df4599c9

View File

@ -619,7 +619,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(unhandled));
try {
NBTTagCompound unhandledTag = NBTCompressedStreamTools.readCompressed(buf, NBTReadLimiter.unlimitedHeap());
unhandledTags.copy(DataComponentPatch.CODEC.parse(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), unhandledTag).result().get());
DataComponentPatch unhandledPatch = DataComponentPatch.CODEC.parse(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(DynamicOpsNBT.INSTANCE), unhandledTag).result().get();
this.unhandledTags.copy(unhandledPatch);
for (Entry<DataComponentType<?>, Optional<?>> entry : unhandledPatch.entrySet()) {
// Move removed unhandled tags to dedicated removedTags
if (!entry.getValue().isPresent()) {
DataComponentType<?> key = entry.getKey();
this.unhandledTags.clear(key);
this.removedTags.add(key);
}
}
} catch (IOException ex) {
Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex);
}