geforkt von Mirrors/Paper
SPIGOT-7857: Improve ItemMeta block data deserialization
By: blablubbabc <lukas@wirsindwir.de>
Dieser Commit ist enthalten in:
Ursprung
8c7a0e888f
Commit
59b86b9837
@ -519,9 +519,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
if (blockData != null) {
|
if (blockData != null) {
|
||||||
Map<String, String> mapBlockData = new HashMap<>();
|
Map<String, String> mapBlockData = new HashMap<>();
|
||||||
|
|
||||||
NBTTagCompound nbtBlockData = (NBTTagCompound) CraftNBTTagConfigSerializer.deserialize(blockData);
|
if (blockData instanceof Map) {
|
||||||
for (String key : nbtBlockData.getAllKeys()) {
|
for (Entry<?, ?> entry : ((Map<?, ?>) blockData).entrySet()) {
|
||||||
mapBlockData.put(key, nbtBlockData.getString(key));
|
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;
|
this.blockData = mapBlockData;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren