Expanded the scope of item brushes (/br apply item, /br paint item).

They now additionally take a direction in which the simulated item usage
should be facing.
Also allow the item parser to parse "hand" and "offhand" as items, to
allow platforms with NBT item support return items with NBT (since
parsing is a slightly more complex task).
This commit is contained in:
wizjany
2019-06-09 00:30:57 -04:00
parent 62e2a76d78
commit f2f9c26602
14 changed files with 287 additions and 118 deletions

View File

@ -93,15 +93,16 @@ public final class LegacyMapper {
for (Map.Entry<String, String> blockEntry : dataFile.blocks.entrySet()) {
String id = blockEntry.getKey();
blockEntries.put(id, blockEntry.getValue());
final String value = blockEntry.getValue();
blockEntries.put(id, value);
try {
BlockState state = WorldEdit.getInstance().getBlockFactory().parseFromInput(blockEntry.getValue(), parserContext).toImmutableState();
BlockState state = WorldEdit.getInstance().getBlockFactory().parseFromInput(value, parserContext).toImmutableState();
blockToStringMap.put(state, id);
stringToBlockMap.put(id, state);
} catch (InputParseException e) {
boolean fixed = false;
if (fixer != null) {
String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, blockEntry.getValue(), 1631);
String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, value, 1631);
try {
BlockState state = WorldEdit.getInstance().getBlockFactory().parseFromInput(newEntry, parserContext).toImmutableState();
blockToStringMap.put(state, id);
@ -111,7 +112,7 @@ public final class LegacyMapper {
}
}
if (!fixed) {
log.warn("Unknown block: " + blockEntry.getValue());
log.warn("Unknown block: " + value);
}
}
}