Config work

This commit is contained in:
Muramasa 2016-08-18 07:00:57 +01:00
parent 6917673264
commit eaadf6f74b
4 changed files with 729 additions and 2406 deletions

View file

@ -28,7 +28,6 @@ import gregtech.loaders.load.GT_SonictronLoader;
import gregtech.loaders.misc.GT_Achievements;
import gregtech.loaders.misc.GT_Bees;
import gregtech.loaders.misc.GT_CoverLoader;
import gregtech.loaders.misc.OreProcessingConfiguration;
import gregtech.loaders.postload.*;
import gregtech.loaders.preload.*;
import ic2.api.recipe.IRecipeInput;
@ -127,7 +126,6 @@ public class GT_Mod
GregTech_API.sUnification = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "Unification.cfg")));
GregTech_API.sSpecialFile = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "Other.cfg")));
GregTech_API.sOPStuff = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "OverpoweredStuff.cfg")));
GregTech_API.sMaterialsFile = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "Materials.cfg")));
GregTech_API.sClientDataFile = new GT_Config(new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.cfg")));
@ -271,7 +269,7 @@ public class GT_Mod
}
}
//GT_Config.troll = (Calendar.getInstance().get(2) + 1 == 4) && (Calendar.getInstance().get(5) >= 1) && (Calendar.getInstance().get(5) <= 2);
Materials.initCustomMats("custom");
Materials.initCustomMaterials();
GT_Log.out.println("GT_Mod: Saving Main Config");
tMainConfig.save();
@ -298,8 +296,6 @@ public class GT_Mod
new Enchantment_EnderDamage();
new Enchantment_Radioactivity();
new OreProcessingConfiguration(aEvent.getModConfigurationDirectory()).run();
new GT_Loader_OreProcessing().run();
new GT_Loader_OreDictionary().run();
new GT_Loader_ItemData().run();
@ -684,7 +680,7 @@ public class GT_Mod
GregTech_API.mInputRF = false;
}
}
Materials.initMaterialProperties();
achievements = new GT_Achievements();
Map.Entry<IRecipeInput, RecipeOutput> tRecipe;
GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables.");

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,60 +0,0 @@
package gregtech.loaders.misc;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import java.io.File;
import java.util.HashMap;
public class OreProcessingConfiguration
implements Runnable
{
private final Configuration mConfiguration;
private final HashMap<String, Boolean> mEnabledMaterials;
public OreProcessingConfiguration(File aModConfigurationDirectory)
{
this.mEnabledMaterials = new HashMap<String, Boolean>();
this.mConfiguration =
new Configuration(new File(new File(aModConfigurationDirectory, "GregTech"), "OreProcessing.cfg"));
this.mConfiguration.load();
this.loadConfiguration();
if (this.mConfiguration.hasChanged())
{
this.mConfiguration.save();
}
}
private void loadConfiguration()
{
for (Materials tMaterial : GregTech_API.sGeneratedMaterials)
{
if (tMaterial != null && tMaterial != Materials._NULL)
{
String tMaterialName = tMaterial.mName;
boolean tDefaultValue = (tMaterial.mTypes & 8) != 0;
Property tProperty =
this.mConfiguration.get("processores", tMaterialName + "_" + tDefaultValue, tDefaultValue);
this.mEnabledMaterials.put(tMaterialName, tProperty.getBoolean(tDefaultValue));
}
}
}
@Override
public void run()
{
//TODO Reimplement
/*for (String tMaterialName : this.mEnabledMaterials.keySet())
{
if (this.mEnabledMaterials.get(tMaterialName))
{
Materials.valueOf(tMaterialName).mTypes |= 8;
}
else if ((Materials.valueOf(tMaterialName).mTypes & 8) != 0)
{
Materials.VALUES.valueOf(tMaterialName).mTypes ^= 8;
}
Materials.VALUES.
}*/
}
}