diff --git a/.gitignore b/.gitignore index 6eb0fba3..27501eda 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,7 @@ local.properties gradle/wrapper/gradle-wrapper.properties gradlew gradlew.bat + +# Linux +*~ + diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index c9284f80..f4dcd278 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -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;") @@ -250,7 +251,7 @@ public class GT_Mod gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality); } }} - + if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) { Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F); } @@ -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(); @@ -671,7 +674,7 @@ public class GT_Mod } } } - + if(GregTech_API.mOutputRF||GregTech_API.mInputRF){ GT_Utility.checkAvailabilities(); if(!GT_Utility.RF_CHECK){ @@ -679,7 +682,7 @@ public class GT_Mod GregTech_API.mInputRF = false; } } - + achievements = new GT_Achievements(); Map.Entry tRecipe; GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables."); diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index c0a55e36..00015b91 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -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 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 mRegisteredOres = new HashSet(10000); - public final ArrayList mSoundNames = new ArrayList(); - public final ArrayList mSoundItems = new ArrayList(); - public final ArrayList mSoundCounts = new ArrayList(); - private final Collection mEvents = new HashSet(); - private final Collection mIgnoredItems = new HashSet(Arrays.asList(new String[]{"itemGhastTear", "itemFlint", "itemClay", "itemBucketSaltWater", + public final HashSet mRegisteredOres = new HashSet(10000); + public final ArrayList mSoundNames = new ArrayList(); + public final ArrayList mSoundItems = new ArrayList(); + public final ArrayList mSoundCounts = new ArrayList(); + private final Collection mEvents = new HashSet(); + private final Collection mIgnoredItems = new HashSet(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 mIgnoredNames = new HashSet(Arrays.asList(new String[]{"grubBee", "chainLink", "candyCane", "bRedString", "bVial", + private final Collection mIgnoredNames = new HashSet(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 mInvalidNames = new HashSet(Arrays.asList(new String[]{"diamondShard", "redstoneRoot", "obsidianStick", "bloodstoneOre", + private final Collection mInvalidNames = new HashSet(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", @@ -1128,14 +1123,14 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { tReRegisteredMaterial = (Materials) i$.next(); } aMaterial.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); - + if (GregTech_API.sThaumcraftCompat != null && aPrefix.doGenerateItem(aMaterial) && !aPrefix.isIgnored(aMaterial)) { List tAspects = new ArrayList(); for (TC_AspectStack tAspect : aPrefix.mAspects) tAspect.addToAspectList(tAspects); if (aPrefix.mMaterialAmount >= 3628800 || aPrefix.mMaterialAmount < 0) for (TC_AspectStack tAspect : aMaterial.mAspects) tAspect.addToAspectList(tAspects); GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(GT_Utility.copyAmount(1, aEvent.Ore), tAspects, aEvent.Name); } - + switch (aPrefix) { case crystal: if ((aMaterial == Materials.CertusQuartz) || (aMaterial == Materials.NetherQuartz) || (aMaterial == Materials.Fluix)) { @@ -1540,11 +1535,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } return null; } - + public Object getRightItem(EntityPlayer player, int ID){ ItemStack mStack = player.getEquipmentInSlot(ID/100); if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null; - + switch(ID % 100){ case 0: return new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack)); @@ -1559,7 +1554,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public Object getClientGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { if(aID>=1000){ - int ID = aID-1000; + int ID = aID-1000; switch(ID){ case 0: return new GuiModularArmor(new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer); @@ -1580,11 +1575,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } return null; } - + public Object getRightItemGui(EntityPlayer player, int ID){ ItemStack mStack = player.getEquipmentInSlot(ID/100); if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null; - + switch(ID % 100){ case 0: return new GuiModularArmor(new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack)),player); @@ -1902,9 +1897,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { tEvent = (OreDictEventContainer) i$.next(); } } - + public static final HashMap chunkData = new HashMap(5000); - + @SubscribeEvent public void handleChunkSaveEvent(ChunkDataEvent.Save event) { @@ -1913,7 +1908,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { int[] tInts = chunkData.get(tPos); if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}} } - + @SubscribeEvent public void handleChunkLoadEvent(ChunkDataEvent.Load event) { @@ -1924,7 +1919,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if(chunkData.containsKey(tPos)){ chunkData.remove(tPos);} chunkData.put(tPos, new int[]{ tOil}); - } + } public static class OreDictEventContainer { public final OreDictionary.OreRegisterEvent mEvent; diff --git a/src/main/java/gregtech/loaders/misc/OreProcessingConfiguration.java b/src/main/java/gregtech/loaders/misc/OreProcessingConfiguration.java new file mode 100644 index 00000000..cafde848 --- /dev/null +++ b/src/main/java/gregtech/loaders/misc/OreProcessingConfiguration.java @@ -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 mEnabledMaterials; + public OreProcessingConfiguration(File aModConfigurationDirectory) + { + this.mEnabledMaterials = new HashMap(); + 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; + } + } + } +} +