Improve legacy conversion of some materials that changed post flattening

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-02-21 12:13:05 +11:00
parent c4c8db5127
commit 153bdf9192
2 changed files with 7 additions and 8 deletions

View File

@@ -324,17 +324,13 @@ public final class CraftLegacy {
for (byte data = 0; data < 16; data++) {
MaterialData matData = new MaterialData(material, data);
Dynamic blockTag = DataConverterFlattenData.b(material.getId() << 4 | data);
blockTag = DataConverterRegistry.a().update(DataConverterTypes.BLOCK_STATE, blockTag, 100, CraftMagicNumbers.INSTANCE.getDataVersion());
// TODO: better skull conversion, chests
if (blockTag.get("Name").asString("").contains("%%FILTER_ME%%")) {
continue;
}
String name = blockTag.get("Name").asString("");
// TODO: need to fix
if (name.equals("minecraft:portal")) {
name = "minecraft:nether_portal";
}
Block block = IRegistry.BLOCK.get(new MinecraftKey(name));
if (block == null) {
continue;
@@ -357,6 +353,9 @@ public final class CraftLegacy {
Preconditions.checkState(!properties.getString(dataKey).isEmpty(), "Empty data string");
Optional opt = state.b(properties.getString(dataKey));
if (!opt.isPresent()) {
throw new IllegalStateException("No state value " + properties.getString(dataKey) + " for " + dataKey);
}
blockData = blockData.set(state, (Comparable) opt.get());
}