Moved the lang files to the resources folder and moved the config to a new location.
This commit is contained in:
parent
a5d3ad9ce6
commit
53fe67cf61
3 changed files with 22 additions and 4 deletions
|
@ -46,6 +46,7 @@ public class Config {
|
|||
public static final String RESOURCE_PREFIX = "/mods/mmmPowersuits/";
|
||||
public static final String TEXTURE_PREFIX = RESOURCE_PREFIX + "textures/";
|
||||
public static final String SOUND_PREFIX = RESOURCE_PREFIX + "sound/";
|
||||
public static final String LANG_PREFIX = RESOURCE_PREFIX + "lang/";
|
||||
// public static final String SEBK_ICON_PATH =
|
||||
// "/mods/mmmPowersuits//machinemuse/sebkicons.png";
|
||||
public static final String SEBK_ARMOR_PATH = TEXTURE_PREFIX + "models/sebkarmor.png";
|
||||
|
@ -63,7 +64,7 @@ public class Config {
|
|||
public static final String CITIZENJOE_ARMORPANTS_PATH = TEXTURE_PREFIX + "models/joearmorpants.png";
|
||||
public static final String GLASS_TEXTURE = TEXTURE_PREFIX + "gui/glass.png";
|
||||
|
||||
public static final String LANG_PATH = "/net/machinemuse/general/lang/";
|
||||
//public static final String LANG_PATH = "/net/machinemuse/general/lang/";
|
||||
|
||||
public static String[] languages = {"en_US"};
|
||||
|
||||
|
@ -319,12 +320,12 @@ public class Config {
|
|||
public static boolean canUseShaders = false;
|
||||
|
||||
public static void setConfigFolderBase(File folder) {
|
||||
configFolder = new File(folder.getAbsolutePath() + "/net/machinemuse/general/");
|
||||
configFolder = new File(folder.getAbsolutePath() + "/machinemuse");
|
||||
}
|
||||
|
||||
public static void extractLang(String[] langauges) {
|
||||
for (String lang : langauges) {
|
||||
InputStream inputStream = ModularPowersuits.INSTANCE.getClass().getResourceAsStream(LANG_PATH + lang + ".lang");
|
||||
InputStream inputStream = ModularPowersuits.INSTANCE.getClass().getResourceAsStream(LANG_PREFIX + lang + ".lang");
|
||||
try {
|
||||
File file = new File(configFolder.getAbsolutePath() + "/lang/" + lang + ".lang");
|
||||
if (!file.exists()) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import net.machinemuse.general.MuseLogger;
|
||||
import net.machinemuse.general.recipe.RecipeManager;
|
||||
import net.machinemuse.powersuits.block.BlockLuxCapacitor;
|
||||
import net.machinemuse.powersuits.block.BlockTinkerTable;
|
||||
|
@ -26,6 +27,10 @@ import net.machinemuse.powersuits.network.MusePacketHandler;
|
|||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Main mod class. This is what Forge loads to get the mod up and running, both
|
||||
* server- and client-side.
|
||||
|
@ -93,7 +98,19 @@ public class ModularPowersuits {
|
|||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
INSTANCE = this;
|
||||
Config.init(new Configuration(event.getSuggestedConfigurationFile()));
|
||||
Path oldPath = event.getSuggestedConfigurationFile().toPath();
|
||||
File newConfig = new File(event.getModConfigurationDirectory() + "/machinemuse/mmmPowersuits.cfg");
|
||||
if (Files.exists(oldPath)) {
|
||||
try {
|
||||
Path newPath = newConfig.toPath();
|
||||
Files.move(oldPath, newPath);
|
||||
Files.deleteIfExists(oldPath);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MuseLogger.logError("Error initializing MPS config.");
|
||||
}
|
||||
}
|
||||
Config.init(new Configuration(newConfig));
|
||||
Config.setConfigFolderBase(event.getModConfigurationDirectory());
|
||||
Config.extractLang(Config.languages);
|
||||
|
||||
|
|
Loading…
Reference in a new issue