Actually work this time

main
Astoria 1 year ago
parent 0bf77072ea
commit a6d0afa9cf

@ -1,5 +1,6 @@
plugins { plugins {
id 'babric-loom' version '0.12-SNAPSHOT' id 'babric-loom' version '0.12-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java' id 'java'
} }
@ -7,6 +8,23 @@ group = project.mod_group
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
version = project.mod_version version = project.mod_version
//Begin shadowing weirdness
configurations {
shade
}
shadowJar {
archiveClassifier.set('shadow')
configurations = [project.configurations.shade]
}
tasks.assemble.dependsOn tasks.shadowJar
remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.archiveFile)
}
//End shadowing weirdness
loom { loom {
gluedMinecraftJar() gluedMinecraftJar()
noIntermediateMappings() noIntermediateMappings()
@ -63,7 +81,7 @@ dependencies {
modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0"
//TOML //TOML
implementation 'com.moandjiezana.toml:toml4j:0.7.2' modImplementation include(shadow('com.moandjiezana.toml:toml4j:0.7.2'))
} }

@ -15,8 +15,6 @@ import turniplabs.halplibe.helper.BlockHelper;
import turniplabs.halplibe.helper.RecipeHelper; import turniplabs.halplibe.helper.RecipeHelper;
import java.io.*; import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
public class IronChestMain implements ModInitializer { 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"); File config = new File("config/AstoriaIronChest.toml");
if (!config.exists()) { if (!config.exists()) {
LOGGER.warn("Config For afloydironchest Not Found! Creating new config based upon default :)"); LOGGER.warn("Config For afloydironchest Not Found! Creating new config based upon default :)");
InputStream in; InputStream in;
OutputStream out; OutputStream out;
try { try {
in = new FileInputStream(getDefaultConfig()); in = getClass().getClassLoader().getResourceAsStream("assets/ironchest/config.toml");
out = new FileOutputStream(config); out = new FileOutputStream(config);
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int length; int length;
while((length = in.read(buffer)) > 0){ while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length); out.write(buffer, 0, length);
} }
return getConfig(); return getConfig();
@ -120,18 +118,4 @@ public class IronChestMain implements ModInitializer {
return config; 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;
}
}
Loading…
Cancel
Save