Browse Source

Effects.cfg parser

feature-config-parsing
FatBoy-DOTC 5 months ago
parent
commit
8eee7ca23e
  1. 23
      src/engine/ConfigParsing/EffectsParser.java

23
src/engine/ConfigParsing/EffectsParser.java

@ -13,6 +13,7 @@ import engine.ConfigParsing.EffectsData.EffectData;
import engine.ConfigParsing.EffectsData.Mod; import engine.ConfigParsing.EffectsData.Mod;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,15 +42,19 @@ public class EffectsParser {
CreateBlocks(compiledData); CreateBlocks(compiledData);
} }
public static String[] readLines(String filename) throws IOException { public static String[] readLines(String filename) throws IOException {
FileReader fileReader = new FileReader(filename); File effectsCfg = new File(EffectsPath);
BufferedReader bufferedReader = new BufferedReader(fileReader); return effectsCfg.list();
List<String> lines = new ArrayList<>();
String line;
while ((line = bufferedReader.readLine()) != null) { //FileReader fileReader = new FileReader(filename);
lines.add(line); //BufferedReader bufferedReader = new BufferedReader(fileReader);
} //List<String> lines = new ArrayList<>();
bufferedReader.close(); // String line;
return lines.toArray(new String[0]); //while ((line = bufferedReader.readLine()) != null) {
// lines.add(line);
//}
//bufferedReader.close();
//return lines.toArray(new String[0]);
} }
public static void CreateBlocks(ArrayList<ArrayList<String>> compiledData) public static void CreateBlocks(ArrayList<ArrayList<String>> compiledData)
{ {

Loading…
Cancel
Save