Add backward compatibility code for CSV columns handler and handlerID

This commit is contained in:
Wilhelm Schuster committed 2023-07-06 23:05:59 +02:00
1 parent 3449e9d153
commit 7ab8940287
2 files changed
+20 -2

No files matched your search

@@ -231,8 +231,17 @@ public abstract class GuiRecipeTab extends Widget {
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
CSVParser csvParser = CSVFormat.EXCEL.withFirstRecordAsHeader().parse(reader);
if (csvParser.getHeaderNames().contains("handler")) {
NEIClientConfig.logger.warn("Found column 'handler' in catalysts.csv. Please rename to 'handlerID'");
}
for (CSVRecord record : csvParser) {
final String handlerID = record.get("handlerID");
final String handlerID;
if (record.isMapped("handler")) {
handlerID = record.get("handler");
} else {
handlerID = record.get("handlerID");
}
final String modName = record.get("modName");
final String modId = record.get("modId");
final boolean requiresMod = Boolean.parseBoolean(record.get("modRequired"));
@@ -164,8 +164,17 @@ public class RecipeCatalysts {
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
CSVParser csvParser = CSVFormat.EXCEL.withFirstRecordAsHeader().parse(reader);
if (csvParser.getHeaderNames().contains("handlerID")) {
NEIClientConfig.logger
.warn("Found column 'handlerID' in catalysts.csv. Please rename to 'catalystHandlerID'");
}
for (CSVRecord record : csvParser) {
final String catalystHandlerID = record.get("catalystHandlerID");
final String catalystHandlerID;
if (record.isMapped("handlerID")) {
catalystHandlerID = record.get("handlerID");
} else {
catalystHandlerID = record.get("catalystHandlerID");
}
final String modId = record.get("modId");
final boolean requiresMod = Boolean.parseBoolean(record.get("modRequired"));
final String excludedModId = record.get("excludedModId");