use of ladysnake.gaspunk.gas.Gas in project Gaspunk by Ladysnake.
the class GasDeserializer method loadGases.
private static boolean loadGases(Path root, Path file) {
String relative = root.relativize(file).toString();
if (!"json".equals(FilenameUtils.getExtension(file.toString())) || relative.startsWith("_"))
return true;
String name = FilenameUtils.removeExtension(relative).replaceAll("\\\\", "/");
try (BufferedReader reader = Files.newBufferedReader(file)) {
Gas gas = GSON.fromJson(reader, Gas.class);
ModGases.REGISTRY.register(gas.setRegistryName(name));
} catch (Exception e) {
GasPunk.LOGGER.error(new FormattedMessage("Error trying to load a gas from file {}", file), e);
}
return true;
}
Aggregations