Commits
blablubbabc authored and md_5 committed 65247583f8c
492 492 | |
493 493 | Integer customModelData = SerializableMeta.getObject(Integer.class, map, CUSTOM_MODEL_DATA.BUKKIT, true); |
494 494 | if (customModelData != null) { |
495 495 | setCustomModelData(customModelData); |
496 496 | } |
497 497 | |
498 498 | Object blockData = SerializableMeta.getObject(Object.class, map, BLOCK_DATA.BUKKIT, true); |
499 499 | if (blockData != null) { |
500 500 | Map<String, String> mapBlockData = new HashMap<>(); |
501 501 | |
502 - | NBTTagCompound nbtBlockData = (NBTTagCompound) CraftNBTTagConfigSerializer.deserialize(blockData); |
503 - | for (String key : nbtBlockData.getAllKeys()) { |
504 - | mapBlockData.put(key, nbtBlockData.getString(key)); |
502 + | if (blockData instanceof Map) { |
503 + | for (Entry<?, ?> entry : ((Map<?, ?>) blockData).entrySet()) { |
504 + | mapBlockData.put(entry.getKey().toString(), entry.getValue().toString()); |
505 + | } |
506 + | } else { |
507 + | // Legacy pre 1.20.5: |
508 + | NBTTagCompound nbtBlockData = (NBTTagCompound) CraftNBTTagConfigSerializer.deserialize(blockData); |
509 + | for (String key : nbtBlockData.getAllKeys()) { |
510 + | mapBlockData.put(key, nbtBlockData.getString(key)); |
511 + | } |
505 512 | } |
506 513 | |
507 514 | this.blockData = mapBlockData; |
508 515 | } |
509 516 | |
510 517 | enchantments = buildEnchantments(map, ENCHANTMENTS); |
511 518 | attributeModifiers = buildModifiers(map, ATTRIBUTES); |
512 519 | |
513 520 | Integer repairCost = SerializableMeta.getObject(Integer.class, map, REPAIR.BUKKIT, true); |
514 521 | if (repairCost != null) { |