|
|
|
@ -15,8 +15,6 @@ import turniplabs.halplibe.helper.BlockHelper;
|
|
|
|
|
import turniplabs.halplibe.helper.RecipeHelper;
|
|
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class IronChestMain implements ModInitializer {
|
|
|
|
@ -97,18 +95,18 @@ public class IronChestMain implements ModInitializer {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public File getConfig(){
|
|
|
|
|
public File getConfig() {
|
|
|
|
|
File config = new File("config/AstoriaIronChest.toml");
|
|
|
|
|
if (!config.exists()) {
|
|
|
|
|
LOGGER.warn("Config For afloydironchest Not Found! Creating new config based upon default :)");
|
|
|
|
|
InputStream in;
|
|
|
|
|
OutputStream out;
|
|
|
|
|
try {
|
|
|
|
|
in = new FileInputStream(getDefaultConfig());
|
|
|
|
|
in = getClass().getClassLoader().getResourceAsStream("assets/ironchest/config.toml");
|
|
|
|
|
out = new FileOutputStream(config);
|
|
|
|
|
byte[] buffer = new byte[1024];
|
|
|
|
|
int length;
|
|
|
|
|
while((length = in.read(buffer)) > 0){
|
|
|
|
|
while ((length = in.read(buffer)) > 0) {
|
|
|
|
|
out.write(buffer, 0, length);
|
|
|
|
|
}
|
|
|
|
|
return getConfig();
|
|
|
|
@ -120,18 +118,4 @@ public class IronChestMain implements ModInitializer {
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public File getDefaultConfig() {
|
|
|
|
|
URL defaultConfig = getClass().getClassLoader().getResource("assets/ironchest/config.toml");
|
|
|
|
|
if (defaultConfig == null) {
|
|
|
|
|
LOGGER.warn("Default Config For afloydironchest Not Found! REAL BAD.");
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
return new File(defaultConfig.toURI());
|
|
|
|
|
} catch (URISyntaxException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|