Changed path of configuration file.

This commit is contained in:
SirSengir 2012-08-18 12:06:35 +02:00
parent b87d8fd817
commit f12688e0a3
4 changed files with 12 additions and 53 deletions

View file

@ -144,7 +144,7 @@ public class BuildCraftCore {
initialized = true;
mainConfiguration = new BuildCraftConfiguration(new File(ProxyCore.proxy.getBuildCraftBase(), "config/buildcraft.cfg"), true);
mainConfiguration = new BuildCraftConfiguration(new File(ProxyCore.proxy.getBuildCraftBase(), "config/buildcraft/main.conf"));
mainConfiguration.load();
redLaserTexture = 0 * 16 + 2;

View file

@ -19,54 +19,8 @@ import net.minecraftforge.common.Property;
public class BuildCraftConfiguration extends Configuration {
public BuildCraftConfiguration(File file, boolean loadLegacy) {
public BuildCraftConfiguration(File file) {
super(file);
if (loadLegacy)
loadLegacyProperties();
}
public void loadLegacyProperties() {
File cfgfile = ProxyCore.proxy.getPropertyFile();
Properties props = new Properties();
try {
if (!cfgfile.exists())
return;
if (cfgfile.canRead()) {
FileInputStream fileinputstream = new FileInputStream(cfgfile);
props.load(fileinputstream);
fileinputstream.close();
}
getOrCreateProperty("stonePipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("stonePipe.blockId"));
getOrCreateProperty("woodenPipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("woodenPipe.blockId"));
getOrCreateProperty("ironPipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("ironPipe.blockId"));
getOrCreateProperty("goldenPipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("goldenPipe.blockId"));
getOrCreateProperty("diamondPipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("diamondPipe.blockId"));
getOrCreateProperty("obsidianPipe.id", Configuration.CATEGORY_BLOCK, props.getProperty("obsidianPipeBlock.blockId"));
getOrCreateProperty("autoWorkbench.id", Configuration.CATEGORY_BLOCK, props.getProperty("autoWorkbench.blockId"));
getOrCreateProperty("miningWell.id", Configuration.CATEGORY_BLOCK, props.getProperty("miningWell.blockId"));
getOrCreateProperty("quarry.id", Configuration.CATEGORY_BLOCK, props.getProperty("quarry.blockId"));
getOrCreateProperty("drill.id", Configuration.CATEGORY_BLOCK, props.getProperty("drill.blockId"));
getOrCreateProperty("frame.id", Configuration.CATEGORY_BLOCK, props.getProperty("frame.blockId"));
getOrCreateProperty("marker.id", Configuration.CATEGORY_BLOCK, props.getProperty("marker.blockId"));
getOrCreateProperty("filler.id", Configuration.CATEGORY_BLOCK, props.getProperty("filler.blockId"));
getOrCreateProperty("woodenGearItem.id", Configuration.CATEGORY_ITEM, props.getProperty("woodenGearItem.id"));
getOrCreateProperty("stoneGearItem.id", Configuration.CATEGORY_ITEM, props.getProperty("stoneGearItem.id"));
getOrCreateProperty("ironGearItem.id", Configuration.CATEGORY_ITEM, props.getProperty("ironGearItem.id"));
getOrCreateProperty("goldenGearItem.id", Configuration.CATEGORY_ITEM, props.getProperty("goldGearItem.id"));
getOrCreateProperty("diamondGearItem.id", Configuration.CATEGORY_ITEM, props.getProperty("diamondGearItem.id"));
getOrCreateProperty("mining.enabled", Configuration.CATEGORY_GENERAL, props.getProperty("mining.enabled"));
getOrCreateProperty("current.continuous", Configuration.CATEGORY_GENERAL, props.getProperty("current.continous"));
cfgfile.delete();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override

View file

@ -9,8 +9,11 @@
package buildcraft.core;
import java.io.File;
import buildcraft.transport.render.TileEntityPickupFX;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
@ -60,6 +63,11 @@ public class ClientProxyCore extends ProxyCore {
ModLoader.getMinecraftInstance().getSendQueue().addToSendQueue(packet);
}
/* FILE SYSTEM */
public File getBuildCraftBase() {
return Minecraft.getMinecraftDir();
}
/* BUILDCRAFT PLAYER */
@Override
public String playerName() {

View file

@ -82,10 +82,6 @@ public class ProxyCore {
ModLoader.addShapelessRecipe(result, recipe);
}
public File getPropertyFile() {
return new File("BuildCraft.cfg");
}
public void sendToPlayers(Packet packet, World w, int x, int y, int z, int maxDistance) {
if (packet != null) {
for (int j = 0; j < w.playerEntities.size(); j++) {
@ -105,8 +101,9 @@ public class ProxyCore {
public void sendToServer(Packet packet) {}
/* FILE SYSTEM */
public File getBuildCraftBase() {
return new File("buildcraft/");
return new File("./");
}
public int addCustomTexture(String pathToTexture) {