Added configuration file to enabling processing of ores
This commit is contained in:
parent
3f46725bbc
commit
5169c509d6
4 changed files with 101 additions and 41 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -75,3 +75,7 @@ local.properties
|
|||
gradle/wrapper/gradle-wrapper.properties
|
||||
gradlew
|
||||
gradlew.bat
|
||||
|
||||
# Linux
|
||||
*~
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package gregtech;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
//import forestry.factory.recipes.ISqueezerRecipe;
|
||||
//import forestry.factory.tiles.TileCentrifuge;
|
||||
//import forestry.factory.tiles.TileSqueezer;
|
||||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.enchants.Enchantment_EnderDamage;
|
||||
import gregtech.api.enchants.Enchantment_Radioactivity;
|
||||
|
@ -32,6 +34,7 @@ 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;
|
||||
|
@ -53,11 +56,9 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
//import forestry.factory.recipes.ISqueezerRecipe;
|
||||
//import forestry.factory.tiles.TileCentrifuge;
|
||||
//import forestry.factory.tiles.TileSqueezer;
|
||||
|
||||
|
||||
@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl;")
|
||||
|
@ -297,6 +298,8 @@ 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();
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package gregtech.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
@ -28,12 +32,7 @@ import gregtech.api.objects.MaterialStack;
|
|||
import gregtech.api.util.*;
|
||||
import gregtech.common.entities.GT_Entity_Arrow;
|
||||
import gregtech.common.items.GT_MetaGenerated_Tool_01;
|
||||
import gregtech.common.items.armor.ContainerBasicArmor;
|
||||
import gregtech.common.items.armor.ContainerElectricArmor1;
|
||||
import gregtech.common.items.armor.GuiElectricArmor1;
|
||||
import gregtech.common.items.armor.GuiModularArmor;
|
||||
import gregtech.common.items.armor.InventoryArmor;
|
||||
import gregtech.common.items.armor.ModularArmor_Item;
|
||||
import gregtech.common.items.armor.*;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -76,21 +75,17 @@ import net.minecraftforge.oredict.RecipeSorter;
|
|||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
||||
private static final EnumSet<OreGenEvent.GenerateMinable.EventType> PREVENTED_ORES = EnumSet.of(OreGenEvent.GenerateMinable.EventType.COAL,
|
||||
new OreGenEvent.GenerateMinable.EventType[]{OreGenEvent.GenerateMinable.EventType.IRON, OreGenEvent.GenerateMinable.EventType.GOLD,
|
||||
OreGenEvent.GenerateMinable.EventType.DIAMOND, OreGenEvent.GenerateMinable.EventType.REDSTONE, OreGenEvent.GenerateMinable.EventType.LAPIS,
|
||||
OreGenEvent.GenerateMinable.EventType.QUARTZ});
|
||||
public final HashSet<ItemStack> mRegisteredOres = new HashSet(10000);
|
||||
public final ArrayList<String> mSoundNames = new ArrayList();
|
||||
public final ArrayList<ItemStack> mSoundItems = new ArrayList();
|
||||
public final ArrayList<Integer> mSoundCounts = new ArrayList();
|
||||
private final Collection<OreDictEventContainer> mEvents = new HashSet();
|
||||
private final Collection<String> mIgnoredItems = new HashSet(Arrays.asList(new String[]{"itemGhastTear", "itemFlint", "itemClay", "itemBucketSaltWater",
|
||||
public final HashSet<ItemStack> mRegisteredOres = new HashSet<ItemStack>(10000);
|
||||
public final ArrayList<String> mSoundNames = new ArrayList<String>();
|
||||
public final ArrayList<ItemStack> mSoundItems = new ArrayList<ItemStack>();
|
||||
public final ArrayList<Integer> mSoundCounts = new ArrayList<Integer>();
|
||||
private final Collection<OreDictEventContainer> mEvents = new HashSet<OreDictEventContainer>();
|
||||
private final Collection<String> mIgnoredItems = new HashSet<String>(Arrays.asList(new String[]{"itemGhastTear", "itemFlint", "itemClay", "itemBucketSaltWater",
|
||||
"itemBucketFreshWater", "itemBucketWater", "itemRock", "itemReed", "itemArrow", "itemSaw", "itemKnife", "itemHammer", "itemChisel", "itemRubber",
|
||||
"itemEssence", "itemIlluminatedPanel", "itemSkull", "itemRawRubber", "itemBacon", "itemJetpackAccelerator", "itemLazurite", "itemIridium",
|
||||
"itemTear", "itemClaw", "itemFertilizer", "itemTar", "itemSlimeball", "itemCoke", "itemBeeswax", "itemBeeQueen", "itemForcicium", "itemForcillium",
|
||||
|
@ -101,7 +96,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
"itemWhippingCream", "itemGlisteningWhippingCream", "itemCleaver", "itemHerbalMedicineWhippingCream", "itemStrangeWhippingCream",
|
||||
"itemBlazeCleaver", "itemBakedCakeSponge", "itemMagmaCake", "itemGlisteningCake", "itemOgreCleaver", "itemFishandPumpkinCake",
|
||||
"itemMagmaWhippingCream", "itemMultimeter", "itemSuperconductor"}));
|
||||
private final Collection<String> mIgnoredNames = new HashSet(Arrays.asList(new String[]{"grubBee", "chainLink", "candyCane", "bRedString", "bVial",
|
||||
private final Collection<String> mIgnoredNames = new HashSet<String>(Arrays.asList(new String[]{"grubBee", "chainLink", "candyCane", "bRedString", "bVial",
|
||||
"bFlask", "anorthositeSmooth", "migmatiteSmooth", "slateSmooth", "travertineSmooth", "limestoneSmooth", "orthogneissSmooth", "marbleSmooth",
|
||||
"honeyDrop", "lumpClay", "honeyEqualssugar", "flourEqualswheat", "bluestoneInsulated", "blockWaterstone", "blockSand", "blockTorch",
|
||||
"blockPumpkin", "blockClothRock", "blockStainedHardenedClay", "blockQuartzPillar", "blockQuartzChiselled", "blockSpawner", "blockCloth", "mobHead",
|
||||
|
@ -119,7 +114,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
"antiBlock", "burntQuartz", "salmonRaw", "blockHopper", "blockEnderObsidian", "blockIcestone", "blockMagicWood", "blockEnderCore", "blockHeeEndium",
|
||||
"oreHeeEndPowder", "oreHeeStardust", "oreHeeIgneousRock", "oreHeeInstabilityOrb", "crystalPureFluix", "shardNether", "gemFluorite",
|
||||
"stickObsidian", "caveCrystal", "shardCrystal", "dyeCrystal","shardFire","shardWater","shardAir","shardEarth","ingotRefinedIron","blockMarble"}));
|
||||
private final Collection<String> mInvalidNames = new HashSet(Arrays.asList(new String[]{"diamondShard", "redstoneRoot", "obsidianStick", "bloodstoneOre",
|
||||
private final Collection<String> mInvalidNames = new HashSet<String>(Arrays.asList(new String[]{"diamondShard", "redstoneRoot", "obsidianStick", "bloodstoneOre",
|
||||
"universalCable", "bronzeTube", "ironTube", "netherTube", "obbyTube", "infiniteBattery", "eliteBattery", "advancedBattery", "10kEUStore",
|
||||
"blueDye", "MonazitOre", "quartzCrystal", "whiteLuminiteCrystal", "darkStoneIngot", "invisiumIngot", "demoniteOrb", "enderGem", "starconiumGem",
|
||||
"osmoniumIngot", "tapaziteGem", "zectiumIngot", "foolsRubyGem", "rubyGem", "meteoriteGem", "adamiteShard", "sapphireGem", "copperIngot",
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package gregtech.loaders.misc;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.enums.Materials;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
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.name();
|
||||
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()
|
||||
{
|
||||
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.valueOf(tMaterialName).mTypes ^= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue