Re-add legacy support to block parser, and fix query tool.

This commit is contained in:
Matthew Miller
2018-07-23 12:48:11 +10:00
parent 5f551d1ed4
commit 9f9fda72b7
6 changed files with 108 additions and 59 deletions

View File

@ -212,4 +212,9 @@ public class BlockState implements BlockStateHolder<BlockState> {
this.values.put(property, value);
return this;
}
@Override
public String toString() {
return getAsString();
}
}

View File

@ -81,13 +81,14 @@ public class LegacyMapper {
ParserContext parserContext = new ParserContext();
parserContext.setPreferringWildcard(false);
parserContext.setRestricted(false);
parserContext.setTryLegacy(false); // This is legacy. Don't match itself.
for (Map.Entry<String, String> blockEntry : dataFile.blocks.entrySet()) {
try {
blockMap.put(blockEntry.getKey(),
(BlockState) WorldEdit.getInstance().getBlockFactory().parseFromInput(blockEntry.getValue(), parserContext));
} catch (Exception e) {
log.warning("Unknown block: " + blockEntry.getValue());
log.fine("Unknown block: " + blockEntry.getValue());
}
}
@ -95,7 +96,7 @@ public class LegacyMapper {
try {
itemMap.put(itemEntry.getKey(), ItemTypes.get(itemEntry.getValue()));
} catch (Exception e) {
log.warning("Unknown item: " + itemEntry.getValue());
log.fine("Unknown item: " + itemEntry.getValue());
}
}
}