diff options
Diffstat (limited to 'src/main/java/gregtech/GT_Mod.java')
-rw-r--r-- | src/main/java/gregtech/GT_Mod.java | 215 |
1 files changed, 97 insertions, 118 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 55ee8f3c55..5266eb246c 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -1,5 +1,7 @@ package gregtech; +import com.google.common.base.Stopwatch; +import com.gtnewhorizon.structurelib.StructureLib; import cpw.mods.fml.common.*; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.registry.EntityRegistry; @@ -11,6 +13,8 @@ import gregtech.api.enchants.Enchantment_Radioactivity; import gregtech.api.enums.*; import gregtech.api.interfaces.internal.IGT_Mod; import gregtech.api.objects.ItemData; +import gregtech.api.objects.ReverseShapedRecipe; +import gregtech.api.objects.ReverseShapelessRecipe; import gregtech.api.objects.XSTR; import gregtech.api.threads.GT_Runnable_MachineBlockUpdate; import gregtech.api.util.*; @@ -21,11 +25,12 @@ import gregtech.common.GT_RecipeAdder; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.entities.GT_Entity_Arrow_Potion; import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gregtech.common.items.armor.components.LoadArmorComponents; import gregtech.common.items.behaviors.Behaviour_DataOrb; import gregtech.common.misc.GT_Command; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Massfabricator; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase; +import gregtech.loaders.ExtraIcons; import gregtech.loaders.load.GT_CoverBehaviorLoader; import gregtech.loaders.load.GT_FuelLoader; import gregtech.loaders.load.GT_ItemIterator; @@ -50,6 +55,7 @@ import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; @@ -72,6 +78,7 @@ import static gregtech.api.enums.GT_Values.MOD_ID_FR; @SuppressWarnings("ALL") @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = " required-after:IC2;" + + " required-after:" + StructureLib.MOD_ID + ";" + " after:dreamcraft;" + " after:Forestry;" + " after:PFAAGeologica;" + @@ -173,6 +180,10 @@ public class GT_Mod implements IGT_Mod { } } + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + MinecraftForge.EVENT_BUS.register(new ExtraIcons()); + } + File tFile = new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg"); Configuration tMainConfig = new Configuration(tFile); tMainConfig.load(); @@ -188,16 +199,14 @@ public class GT_Mod implements IGT_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.sModularArmor = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "ModularArmor.cfg"))); GregTech_API.sClientDataFile = new GT_Config(new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.cfg"))); GregTech_API.mIC2Classic = Loader.isModLoaded("IC2-Classic-Spmod"); - //GregTech_API.mMagneticraft = Loader.isModLoaded("Magneticraft"); - //GregTech_API.mImmersiveEngineering = Loader.isModLoaded("ImmersiveEngineering"); GregTech_API.mGTPlusPlus = Loader.isModLoaded("miscutils"); GregTech_API.mTranslocator = Loader.isModLoaded("Translocator"); GregTech_API.mTConstruct = Loader.isModLoaded("TConstruct"); GregTech_API.mGalacticraft = Loader.isModLoaded("GalacticraftCore"); + GregTech_API.mAE2 = Loader.isModLoaded(MOD_ID_AE); GT_Log.out.println("GT_Mod: Are you there Translocator? " + GregTech_API.mTranslocator); GT_Log.out.println("GT_Mod: Are you there TConstruct? " + GregTech_API.mTConstruct); GT_Log.out.println("GT_Mod: Are you there GalacticraftCore? " + GregTech_API.mGalacticraft); @@ -264,6 +273,8 @@ public class GT_Mod implements IGT_Mod { GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false); GT_Values.D2 = tMainConfig.get(aTextGeneral, "Debug2", false).getBoolean(false); + GT_Values.hideAssLineRecipes = tMainConfig.get(aTextGeneral, "hide assline recipes", false).getBoolean(false); + GT_Values.updateFluidDisplayItems = tMainConfig.get(aTextGeneral, "update fluid display items", true).getBoolean(true); GT_Values.allow_broken_recipemap = tMainConfig.get(aTextGeneral, "debug allow broken recipemap", false).getBoolean(false); GT_Values.debugCleanroom = tMainConfig.get(aTextGeneral, "debugCleanroom", false).getBoolean(false); GT_Values.debugDriller = tMainConfig.get(aTextGeneral, "debugDriller", false).getBoolean(false); @@ -285,7 +296,7 @@ public class GT_Mod implements IGT_Mod { GT_Values.enableChunkloaders = tMainConfig.get("machines", "enableChunkloaders", true).getBoolean(true); GT_Values.alwaysReloadChunkloaders = tMainConfig.get("machines", "alwaysReloadChunkloaders", false).getBoolean(false); GT_Values.debugChunkloaders = tMainConfig.get("machines", "debugChunkloaders", false).getBoolean(false); - + GT_Values.disableDigitalChestsExternalAccess = tMainConfig.get("machines", "disableDigitalChestsExternalAccess", false).getBoolean(false); GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get(aTextGeneral, "TicksForLagAveragingWithScanner", 25).getInt(25); GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get(aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100); if (tMainConfig.get(aTextGeneral, "disable_STDOUT", false).getBoolean(false)) { @@ -306,6 +317,7 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sMachineThunderExplosions = tMainConfig.get("machines", "lightning_causes_explosions", true).getBoolean(false); GregTech_API.sConstantEnergy = tMainConfig.get("machines", "constant_need_of_energy", true).getBoolean(false); GregTech_API.sColoredGUI = tMainConfig.get("machines", "colored_guis_when_painted", true).getBoolean(false); + GregTech_API.sMachineMetalGUI = tMainConfig.get("machines", "guis_in_consistent_machine_metal_color", false).getBoolean(false); // Implementation for this is actually handled in NewHorizonsCoreMod in MainRegistry.java! GregTech_API.sUseMachineMetal = tMainConfig.get("machines", "use_machine_metal_tint", true).getBoolean(true); @@ -322,6 +334,10 @@ public class GT_Mod implements IGT_Mod { tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mRGBa[2])))); } ); + gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true); + gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true); + gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true); + gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3); gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16); gregtechproxy.mFlintChance = tMainConfig.get(aTextGeneral, "FlintAndSteelChance", 30).getInt(30); @@ -344,7 +360,7 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mSortToTheEnd = tMainConfig.get(aTextGeneral, "EnsureToBeLoadedLast", true).getBoolean(true); gregtechproxy.mDisableIC2Cables = tMainConfig.get(aTextGeneral, "DisableIC2Cables", true).getBoolean(true); gregtechproxy.mAchievements = tMainConfig.get(aTextGeneral, "EnableAchievements", true).getBoolean(true); - gregtechproxy.mAE2Integration = GregTech_API.sSpecialFile.get(ConfigCategories.general, "EnableAE2Integration", Loader.isModLoaded("appliedenergistics2")); + gregtechproxy.mAE2Integration = GregTech_API.sSpecialFile.get(ConfigCategories.general, "EnableAE2Integration", GregTech_API.mAE2); gregtechproxy.mNerfedCombs = tMainConfig.get(aTextGeneral, "NerfCombs", true).getBoolean(true); gregtechproxy.mNerfedCrops = tMainConfig.get(aTextGeneral, "NerfCrops", true).getBoolean(true); gregtechproxy.mHideUnusedOres = tMainConfig.get(aTextGeneral, "HideUnusedOres", true).getBoolean(true); @@ -362,9 +378,10 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mPollutionVegetationLimit = tMainConfig.get("Pollution", "VegetationLimit", 1000000).getInt(1000000); gregtechproxy.mPollutionSourRainLimit = tMainConfig.get("Pollution", "SourRainLimit", 2000000).getInt(2000000); gregtechproxy.mExplosionItemDrop = tMainConfig.get("general", "ExplosionItemDrops", false).getBoolean(false); - gregtechproxy.mAddGTRecipesToIC2Machines = tMainConfig.get("general", "AddGTRecipesToIC2Machines", true).getBoolean(true); gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid"); gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true).getBoolean(true); + if (gregtechproxy.mEnableCleanroom) + GT_MetaTileEntity_Cleanroom.loadConfig(tMainConfig); gregtechproxy.mLowGravProcessing = Loader.isModLoaded(GT_Values.MOD_ID_GC_CORE) && tMainConfig.get("general", "LowGravProcessing", true).getBoolean(true); gregtechproxy.mUseGreatlyShrukenReplacementList = tMainConfig.get("general", "GTNH Optimised Material Loading", true).getBoolean(true); Calendar now = Calendar.getInstance(); @@ -590,40 +607,7 @@ public class GT_Mod implements IGT_Mod { Materials.BandedIron.getDustSmall(1), Materials.Bauxite.getDustSmall(1), Materials.Pyrolusite.getDustTiny(2), Materials.Barite.getDustTiny(1), Materials.Chromite.getDustTiny(1), Materials.Ilmenite.getDustTiny(1), new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 1000, 900); - /* - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanel", true)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SGS", "CPC", 'C', OrePrefixes.circuit.get(Materials.Basic), 'G', new ItemStack(Blocks.glass_pane, 1), 'P', OrePrefixes.plateAlloy.get(Materials.Carbon), 'S', ItemList.Circuit_Silicon_Wafer}); - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_8V.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SGS", "CPC","R R", 'C', OrePrefixes.circuit.get(Materials.Advanced), 'G', new ItemStack(Blocks.glass_pane, 1), 'P', OrePrefixes.wireGt04.get(Materials.Graphene), 'S', ItemList.Circuit_Silicon_Wafer2,'R', OrePrefixes.plate.get(Materials.GalliumArsenide)}); - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_LV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SGS", "CPC","R R", 'C', OrePrefixes.circuit.get(Materials.Master), 'G', GT_ModHandler.getIC2Item("reinforcedGlass", 1L), 'P', OrePrefixes.wireGt16.get(Materials.Graphene), 'S', ItemList.Circuit_Silicon_Wafer3,'R', OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide)}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanel8V", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_8V.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSS", "STS", "SSS", 'S', ItemList.Cover_SolarPanel, 'T', OrePrefixes.circuit.get(Materials.Advanced)}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelLV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_LV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_8V, 'T', ItemList.Transformer_LV_ULV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelMV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_MV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_LV, 'T', ItemList.Transformer_MV_LV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelHV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_HV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_MV, 'T', ItemList.Transformer_HV_MV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelEV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_EV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_HV, 'T', ItemList.Transformer_EV_HV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelIV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_IV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_EV, 'T', ItemList.Transformer_IV_EV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelLuV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_LuV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_IV, 'T', ItemList.Transformer_LuV_IV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelZPM", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_ZPM.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_LuV, 'T', ItemList.Transformer_ZPM_LuV}); - } - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanelUV", false)) { - GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_UV.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_ZPM, 'T', ItemList.Transformer_UV_ZPM}); - } - */ + double outputMultiplier = Math.min(GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "StoneDustOutputMultiplier", 0.6), 1.0); if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "StoneDustCentrifugation", false)) { int fullChance = (int) (10000 * outputMultiplier); @@ -750,6 +734,16 @@ public class GT_Mod implements IGT_Mod { } gregtechproxy.onPostLoad(); + + + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { + if (i >= GregTech_API.METATILEENTITIES.length) + break; + if (GregTech_API.METATILEENTITIES[i] != null) { + GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName()); + } + } + if (gregtechproxy.mSortToTheEnd) { gregtechproxy.registerUnificationEntries(); } else { @@ -768,18 +762,16 @@ public class GT_Mod implements IGT_Mod { new GT_Worldgenloader().run(); new GT_CoverLoader().run(); - LoadArmorComponents.init(); - GT_RecipeRegistrator.registerUsagesForMaterials(null, false, new ItemStack(Blocks.planks, 1), new ItemStack(Blocks.cobblestone, 1), new ItemStack(Blocks.stone, 1), new ItemStack(Items.leather, 1)); GT_OreDictUnificator.addItemData(GT_ModHandler.getRecipeOutput(null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, null, null), new ItemData(Materials.Tin, 10886400L)); if (!GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.storageblockcrafting, "tile.glowstone", false)) { GT_ModHandler.removeRecipe(new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1), null, new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1)); } - GT_ModHandler.removeRecipe(new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)); - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)}); + GT_ModHandler.removeRecipeDelayed(new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)); + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)}); - //Save a copy of these list before activateOreDictHandler(), then loop over them. + // Save a copy of these list before activateOreDictHandler(), then loop over them. Map<IRecipeInput, RecipeOutput> aMaceratorRecipeList = GT_ModHandler.getMaceratorRecipeList(); Map<IRecipeInput, RecipeOutput> aCompressorRecipeList = GT_ModHandler.getCompressorRecipeList(); Map<IRecipeInput, RecipeOutput> aExtractorRecipeList = GT_ModHandler.getExtractorRecipeList(); @@ -788,14 +780,18 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("GT_Mod: Activating OreDictionary Handler, this can take some time, as it scans the whole OreDictionary"); GT_FML_LOGGER.info("If your Log stops here, you were too impatient. Wait a bit more next time, before killing Minecraft with the Task Manager."); - long ms = System.currentTimeMillis(); + + Stopwatch stopwatch = Stopwatch.createStarted(); gregtechproxy.activateOreDictHandler(); - GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake."); + GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + stopwatch.stop() + "). Have a Cake."); GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString()); GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString()); GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString()); - //GT_Log.out.println("GT_Mod: sRodMaterialList cycles: " + GT_RecipeRegistrator.sRodMaterialList_cycles); + Set<Materials> replaceVanillaItemsSet = gregtechproxy.mUseGreatlyShrukenReplacementList ? Arrays.stream(Materials.values()).filter(GT_RecipeRegistrator::hasVanillaRecipes).collect(Collectors.toSet()) : new HashSet<>(Arrays.asList(Materials.values())); + + stopwatch.reset(); + stopwatch.start(); GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait."); ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", replaceVanillaItemsSet.size()); @@ -814,14 +810,26 @@ public class GT_Mod implements IGT_Mod { }); } ProgressManager.pop(progressBar); - GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake."); + GT_FML_LOGGER.info("Replaced Vanilla Materials (" + stopwatch.stop() + "). Have a Cake."); + + + stopwatch.reset(); + stopwatch.start(); + // remove gemIridium exploit + ItemStack iridiumOre = GT_ModHandler.getIC2Item("iridiumOre", 1); + aCompressorRecipeList.entrySet().parallelStream() + .filter(e -> e.getKey().getInputs().size() == 1 && e.getKey().getInputs().get(0).isItemEqual(iridiumOre)) + .findAny() + .ifPresent(e -> aCompressorRecipeList.remove(e.getKey())); //Add default IC2 recipe to GT GT_ModHandler.addIC2RecipesToGT(aMaceratorRecipeList, GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true); GT_ModHandler.addIC2RecipesToGT(aCompressorRecipeList, GT_Recipe.GT_Recipe_Map.sCompressorRecipes, true, true, true); GT_ModHandler.addIC2RecipesToGT(aExtractorRecipeList, GT_Recipe.GT_Recipe_Map.sExtractorRecipes, true, true, true); GT_ModHandler.addIC2RecipesToGT(aOreWashingRecipeList, GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true); GT_ModHandler.addIC2RecipesToGT(aThermalCentrifugeRecipeList, GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true); - + GT_FML_LOGGER.info("IC2 Removal (" + stopwatch.stop() + "). Have a Cake."); + + if (GT_Values.D1) { GT_ModHandler.sSingleNonBlockDamagableRecipeList.forEach(iRecipe -> GT_Log.out.println("=> " + iRecipe.getRecipeOutput().getDisplayName())); } @@ -847,63 +855,18 @@ public class GT_Mod implements IGT_Mod { GT_Forestry_Compat.transferCentrifugeRecipes(); GT_Forestry_Compat.transferSqueezerRecipes(); } - if (Loader.isModLoaded(MOD_ID_AE)) + if (GregTech_API.mAE2) GT_MetaTileEntity_DigitalChestBase.registerAEIntegration(); - String tName = ""; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blastfurnace"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blockcutter"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "inductionFurnace"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "generator"), false)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "windMill"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "waterMill"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "solarPanel"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "centrifuge"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electrolyzer"), false)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "compressor"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electroFurnace"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "extractor"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "macerator"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "recycler"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "metalformer"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "orewashingplant"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "massFabricator"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "replicator"), true)) { - GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); - } + + + Arrays.stream(new String[]{ + "blastfurnace", "blockcutter", "inductionFurnace", "generator", "windMill", "waterMill", "solarPanel", "centrifuge", "electrolyzer", "compressor", + "electroFurnace", "extractor", "macerator", "recycler", "metalformer", "orewashingplant", "massFabricator", "replicator", + }) + .filter(tName -> GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + tName, true)) + .map(tName -> GT_ModHandler.getIC2Item(tName, 1L)).forEach(GT_ModHandler::removeRecipeByOutputDelayed); + + if (gregtechproxy.mNerfedVanillaTools) { GT_Log.out.println("GT_Mod: Nerfing Vanilla Tool Durability"); Items.wooden_sword.setMaxDamage(12); @@ -937,9 +900,20 @@ public class GT_Mod implements IGT_Mod { Items.diamond_hoe.setMaxDamage(768); } new GT_ExtremeDieselFuelLoader().run(); + + + /* + * Until this point most crafting recipe additions, and removals, have been buffered. + * Go through, execute the removals in bulk, and then any deferred additions. The bulk removals in particular significantly speed up the recipe list + * modifications. + */ + + stopwatch.reset(); + stopwatch.start(); GT_Log.out.println("GT_Mod: Adding buffered Recipes."); GT_ModHandler.stopBufferingCraftingRecipes(); - + GT_FML_LOGGER.info("Executed delayed Crafting Recipes (" + stopwatch.stop() + "). Have a Cake."); + GT_Log.out.println("GT_Mod: Saving Lang File."); GT_LanguageManager.sEnglishFile.save(); GregTech_API.sPostloadFinished = true; @@ -1013,9 +987,13 @@ public class GT_Mod implements IGT_Mod { } addSolidFakeLargeBoilerFuels(); + identifyAnySteam(); achievements = new GT_Achievements(); + ReverseShapedRecipe.runReverseRecipes(); + ReverseShapelessRecipe.runReverseRecipes(); + GT_Recipe.GTppRecipeHelper = true; GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables."); GregTech_API.sBeforeGTPreload = null; @@ -1078,15 +1056,6 @@ public class GT_Mod implements IGT_Mod { public void onServerAboutToStart(FMLServerAboutToStartEvent aEvent) { gregtechproxy.onServerAboutToStart(); } -// public void onIDChangingEvent(FMLModIdMappingEvent aEvent) -// { -// GT_Utility.reInit(); -// GT_Recipe.reInit(); -// Map<GT_ItemStack, ?> tMap; -// for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { -// tMap = (Map)i$.next(); -// } -// } @Mod.EventHandler public void onServerStarting(FMLServerStartingEvent aEvent) { @@ -1358,4 +1327,14 @@ public class GT_Mod implements IGT_Mod { GT_Recipe.GT_Recipe_Map.sLargeBoilerFakeFuels.addSolidRecipe(GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1)); } } -}
\ No newline at end of file + + private void identifyAnySteam() { + final String[] steamCandidates = {"steam", "ic2steam"}; + final String[] superHeatedSteamCandidates = {"ic2superheatedsteam"}; + + GT_ModHandler.sAnySteamFluidIDs = Arrays.stream(steamCandidates).map(FluidRegistry::getFluid).filter(Objects::nonNull) + .map(FluidRegistry::getFluidID).collect(Collectors.toList()); + GT_ModHandler.sSuperHeatedSteamFluidIDs = Arrays.stream(superHeatedSteamCandidates).map(FluidRegistry::getFluid).filter(Objects::nonNull) + .map(FluidRegistry::getFluidID).collect(Collectors.toList()); + } +} |