13
0
geforkt von Mirrors/Paper

SPIGOT-7857: Improve ItemMeta block data deserialization

By: blablubbabc <lukas@wirsindwir.de>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-08-08 07:44:52 +10:00
Ursprung 8c7a0e888f
Commit 59b86b9837

Datei anzeigen

@ -519,10 +519,17 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (blockData != null) {
Map<String, String> mapBlockData = new HashMap<>();
if (blockData instanceof Map) {
for (Entry<?, ?> entry : ((Map<?, ?>) blockData).entrySet()) {
mapBlockData.put(entry.getKey().toString(), entry.getValue().toString());
}
} else {
// Legacy pre 1.20.5:
NBTTagCompound nbtBlockData = (NBTTagCompound) CraftNBTTagConfigSerializer.deserialize(blockData);
for (String key : nbtBlockData.getAllKeys()) {
mapBlockData.put(key, nbtBlockData.getString(key));
}
}
this.blockData = mapBlockData;
}