mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Filter item parent configs out first
This commit is contained in:
parent
306a988e5c
commit
61a1f5879a
1 changed files with 12 additions and 10 deletions
|
@ -103,6 +103,12 @@ public class GameConfiguration {
|
|||
List<String> ignoredItems = new ArrayList<>();
|
||||
items.forEach((name, v) -> {
|
||||
Map<String, Object> config = (Map<String, Object>)v;
|
||||
|
||||
if(!config.containsKey("code")) {
|
||||
ignoredItems.add(name);
|
||||
return;
|
||||
}
|
||||
|
||||
String[] segments = name.split("/", 2);
|
||||
String category = segments.length == 2 ? segments[0] : "unknown";
|
||||
config.put("id", name);
|
||||
|
@ -142,16 +148,12 @@ public class GameConfiguration {
|
|||
}
|
||||
|
||||
// Register item
|
||||
if(config.containsKey("code")) {
|
||||
try {
|
||||
Item item = JsonHelper.readValue(config, Item.class, new InjectableValues.Std().addValue("name", name));
|
||||
ItemRegistry.registerItem(item);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.fatal("Failed to register item {}", name, e);
|
||||
System.exit(0);
|
||||
}
|
||||
} else {
|
||||
ignoredItems.add(name);
|
||||
try {
|
||||
Item item = JsonHelper.readValue(config, Item.class, new InjectableValues.Std().addValue("name", name));
|
||||
ItemRegistry.registerItem(item);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.fatal("Failed to register item {}", name, e);
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue