diff options
Diffstat (limited to 'src/main/java/gregtech/GT_Mod.java')
-rw-r--r-- | src/main/java/gregtech/GT_Mod.java | 1044 |
1 files changed, 522 insertions, 522 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 8ac7a75725..e4fedf1fa1 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -5,17 +5,14 @@ import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.recipes.ICentrifugeRecipe; -import forestry.api.recipes.ISqueezerRecipe; -import forestry.api.recipes.RecipeManagers; import gregtech.api.GregTech_API; import gregtech.api.enchants.Enchantment_EnderDamage; 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.MaterialStack; import gregtech.api.objects.XSTR; +import gregtech.api.threads.GT_Runnable_MachineBlockUpdate; import gregtech.api.util.*; import gregtech.common.GT_DummyWorld; import gregtech.common.GT_Network; @@ -26,7 +23,9 @@ 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.storage.GT_MetaTileEntity_DigitalChestBase; import gregtech.loaders.load.GT_CoverBehaviorLoader; import gregtech.loaders.load.GT_FuelLoader; import gregtech.loaders.load.GT_ItemIterator; @@ -61,48 +60,54 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; +import static gregtech.api.enums.GT_Values.MOD_ID_AE; +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;" + - " after:dreamcraft;"+ - " 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;" + - " after:UndergroundBiomes;" + - " after:TConstruct;" + - " after:Translocator;") + dependencies = " required-after:IC2;" + + " after:dreamcraft;" + + " 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;" + + " after:UndergroundBiomes;" + + " after:TConstruct;" + + " after:Translocator;") public class GT_Mod implements IGT_Mod { - public static final int VERSION = 509, SUBVERSION = 31; + public static final int VERSION = 509, SUBVERSION = 33; public static final int TOTAL_VERSION = calculateTotalGTVersion(VERSION, SUBVERSION); public static final int REQUIRED_IC2 = 624; @Mod.Instance("gregtech") @@ -114,7 +119,8 @@ public class GT_Mod implements IGT_Mod { private final String aTextGeneral = "general"; private final String aTextIC2 = "ic2_"; public static final Logger GT_FML_LOGGER = LogManager.getLogger("GregTech GTNH"); - + + static { if ((509 != GregTech_API.VERSION) || (509 != GT_ModHandler.VERSION) || (509 != GT_OreDictUnificator.VERSION) || (509 != GT_Recipe.VERSION) || (509 != GT_Utility.VERSION) || (509 != GT_RecipeRegistrator.VERSION) || (509 != Element.VERSION) || (509 != Materials.VERSION) || (509 != OrePrefixes.VERSION)) { throw new GT_ItsNotMyFaultException("One of your Mods included GregTech-API Files inside it's download, mention this to the Mod Author, who does this bad thing, and tell him/her to use reflection. I have added a Version check, to prevent Authors from breaking my Mod that way."); @@ -124,15 +130,15 @@ public class GT_Mod implements IGT_Mod { public GT_Mod() { try { Class.forName("ic2.core.IC2").getField("enableOreDictCircuit").set(null, Boolean.FALSE); - } catch (Throwable e) { + } catch (Throwable ignored) { } try { Class.forName("ic2.core.IC2").getField("enableCraftingBucket").set(null, Boolean.FALSE); - } catch (Throwable e) { + } catch (Throwable ignored) { } try { Class.forName("ic2.core.IC2").getField("enableEnergyInStorageBlockItems").set(null, Boolean.FALSE); - } catch (Throwable e) { + } catch (Throwable ignored) { } GT_Values.GT = this; GT_Values.DW = new GT_DummyWorld(); @@ -143,19 +149,30 @@ public class GT_Mod implements IGT_Mod { Textures.ItemIcons.VOID.name(); } + public static int calculateTotalGTVersion(int minorVersion) { + return calculateTotalGTVersion(VERSION, minorVersion); + } + + public static int calculateTotalGTVersion(int majorVersion, int minorVersion) { + return majorVersion * 1000 + minorVersion; + + } + @Mod.EventHandler public void onPreLoad(FMLPreInitializationEvent aEvent) { Locale.setDefault(Locale.ENGLISH); if (GregTech_API.sPreloadStarted) { return; } - try { - for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { + + for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } + File tFile = new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg"); Configuration tMainConfig = new Configuration(tFile); tMainConfig.load(); @@ -189,18 +206,18 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mLogFile.exists()) { try { GT_Log.mLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.out = GT_Log.err = new PrintStream(GT_Log.mLogFile); - } catch (FileNotFoundException e) { + } catch (FileNotFoundException ignored) { } GT_Log.mOreDictLogFile = new File(aEvent.getModConfigurationDirectory().getParentFile(), "logs/OreDict.log"); if (!GT_Log.mOreDictLogFile.exists()) { try { GT_Log.mOreDictLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } if (tMainConfig.get(aTextGeneral, "LoggingExplosions", true).getBoolean(true)) { @@ -208,12 +225,12 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mExplosionLog.exists()) { try { GT_Log.mExplosionLog.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.exp = new PrintStream(GT_Log.mExplosionLog); - } catch (Throwable e) { + } catch (Throwable ignored) { } } @@ -222,12 +239,12 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mPlayerActivityLogFile.exists()) { try { GT_Log.mPlayerActivityLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.pal = new PrintStream(GT_Log.mPlayerActivityLogFile); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { @@ -238,11 +255,8 @@ public class GT_Mod implements IGT_Mod { GT_Log.ore.println("* entries and errors are being logged. If you see an error please raise an *"); GT_Log.ore.println("* issue at https://github.com/Blood-Asp/GT5-Unofficial. *"); GT_Log.ore.println("******************************************************************************"); - String tString; - for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Log.ore.println(tString)) { - tString = (String) i$.next(); - } - } catch (Throwable e) { + tList.forEach(GT_Log.ore::println); + } catch (Throwable ignored) { } gregtechproxy.onPreLoad(); @@ -250,19 +264,27 @@ 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.allow_broken_recipemap = tMainConfig.get(aTextGeneral, "debug allow broken recipemap",false).getBoolean(false); + 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); GT_Values.debugWorldGen = tMainConfig.get(aTextGeneral, "debugWorldGen", false).getBoolean(false); GT_Values.debugOrevein = tMainConfig.get(aTextGeneral, "debugOrevein", false).getBoolean(false); GT_Values.debugSmallOres = tMainConfig.get(aTextGeneral, "debugSmallOres", false).getBoolean(false); GT_Values.debugStones = tMainConfig.get(aTextGeneral, "debugStones", false).getBoolean(false); - GT_Values.oreveinPercentage = tMainConfig.get(aTextGeneral, "oreveinPercentage_75",75).getInt(75); - GT_Values.oreveinAttempts = tMainConfig.get(aTextGeneral, "oreveinAttempts_64",64).getInt(64); - GT_Values.oreveinMaxPlacementAttempts = tMainConfig.get(aTextGeneral, "oreveinMaxPlacementAttempts_8",8).getInt(8); + GT_Values.debugBlockMiner = tMainConfig.get(aTextGeneral, "debugBlockMiner", false).getBoolean(false); + GT_Values.debugBlockPump = tMainConfig.get(aTextGeneral, "debugBlockPump", false).getBoolean(false); + GT_Values.debugEntityCramming = tMainConfig.get(aTextGeneral, "debugEntityCramming", false).getBoolean(false); + GT_Values.oreveinPercentage = tMainConfig.get(aTextGeneral, "oreveinPercentage_100", 100).getInt(100); + GT_Values.oreveinAttempts = tMainConfig.get(aTextGeneral, "oreveinAttempts_64", 64).getInt(64); + GT_Values.oreveinMaxPlacementAttempts = tMainConfig.get(aTextGeneral, "oreveinMaxPlacementAttempts_8", 8).getInt(8); + GT_Values.oreveinPlacerOres = tMainConfig.get(aTextGeneral, "oreveinPlacerOres", true).getBoolean(true); + GT_Values.oreveinPlacerOresMultiplier = tMainConfig.get(aTextGeneral, "oreveinPlacerOresMultiplier", 2).getInt(2); //GT_Values.oreveinMaxSize = tMainConfig.get(aTextGeneral, "oreveinMaxSize_64",64).getInt(64); GT_Values.ticksBetweenSounds = tMainConfig.get("machines", "TicksBetweenSounds", 30).getInt(30); - GT_Values.cleanroomGlass= (float) tMainConfig.get("machines","ReinforcedGlassPercentageForCleanroom",5D).getDouble(5D); + GT_Values.cleanroomGlass = (float) tMainConfig.get("machines", "ReinforcedGlassPercentageForCleanroom", 5D).getDouble(5D); + 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); 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); @@ -293,20 +315,19 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sDoShowAllItemsInCreative = tMainConfig.get(aTextGeneral, "show_all_metaitems_in_creative_and_NEI", false).getBoolean(false); GregTech_API.sMultiThreadedSounds = tMainConfig.get(aTextGeneral, "sound_multi_threading", false).getBoolean(false); String SBdye0 = "ColorModulation."; - for (Dyes tDye : Dyes.values()) { - if ((tDye != Dyes._NULL) && (tDye.mIndex < 0)) { - String SBdye1 = new StringBuilder(18).append(SBdye0).append(tDye).toString(); - tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mRGBa[0])))); - tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mRGBa[1])))); - tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mRGBa[2])))); - } - } + Arrays.stream(Dyes.values()).filter(tDye -> (tDye != Dyes._NULL) && (tDye.mIndex < 0)).forEach(tDye -> { + String SBdye1 = SBdye0 + tDye; + tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mRGBa[0])))); + tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mRGBa[1])))); + tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mRGBa[2])))); + } + ); 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); gregtechproxy.mItemDespawnTime = tMainConfig.get(aTextGeneral, "ItemDespawnTime", 6000).getInt(6000); - gregtechproxy.mAllowSmallBoilerAutomation = tMainConfig.get(aTextGeneral,"AllowSmallBoilerAutomation",false).getBoolean(false); - gregtechproxy.mHardMachineCasings= tMainConfig.get(aTextGeneral,"HardMachineCasings",true).getBoolean(true); + gregtechproxy.mAllowSmallBoilerAutomation = tMainConfig.get(aTextGeneral, "AllowSmallBoilerAutomation", false).getBoolean(false); + gregtechproxy.mHardMachineCasings = tMainConfig.get(aTextGeneral, "HardMachineCasings", true).getBoolean(true); gregtechproxy.mDisableVanillaOres = tMainConfig.get(aTextGeneral, "DisableVanillaOres", true).getBoolean(true); gregtechproxy.mNerfDustCrafting = tMainConfig.get(aTextGeneral, "NerfDustCrafting", true).getBoolean(true); gregtechproxy.mIncreaseDungeonLoot = tMainConfig.get(aTextGeneral, "IncreaseDungeonLoot", true).getBoolean(true); @@ -345,6 +366,7 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid"); gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true).getBoolean(true); 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(); gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1); gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true).getBoolean(true); @@ -356,7 +378,7 @@ public class GT_Mod implements IGT_Mod { GregTech_API.mRFtoEU = GregTech_API.sOPStuff.get(ConfigCategories.general, "100RFtoEU", 20); GregTech_API.mRFExplosions = GregTech_API.sOPStuff.get(ConfigCategories.general, "RFExplosions", false); GregTech_API.meIOLoaded = Loader.isModLoaded("EnderIO"); - gregtechproxy.mForceFreeFace = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "forceFreeFace",true); + gregtechproxy.mForceFreeFace = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "forceFreeFace", true); gregtechproxy.mBrickedBlastFurnace = tMainConfig.get("general", "BrickedBlastFurnace", true).getBoolean(true); gregtechproxy.mEasierIVPlusCables = tMainConfig.get("general", "EasierEVPlusCables", false).getBoolean(false); gregtechproxy.mMixedOreOnlyYieldsTwoThirdsOfPureOre = tMainConfig.get("general", "MixedOreOnlyYieldsTwoThirdsOfPureOre", false).getBoolean(false); @@ -372,14 +394,12 @@ public class GT_Mod implements IGT_Mod { GregTech_API.mUseOnlyGoodSolderingMaterials = GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "useonlygoodsolderingmaterials", GregTech_API.mUseOnlyGoodSolderingMaterials); gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("havestLevel", "activateHarvestLevelChange", false);//TODO CHECK - if(gregtechproxy.mChangeHarvestLevels) { - gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); - gregtechproxy.mMaxHarvestLevel = (int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel", 7)); - for (Materials tMaterial : Materials.values()) { - if (tMaterial != null && tMaterial.mToolQuality > 0 && tMaterial.mMetaItemSubID < gregtechproxy.mHarvestLevel.length && tMaterial.mMetaItemSubID >= 0) { - gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality); - } - } + if (gregtechproxy.mChangeHarvestLevels) { + gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); + gregtechproxy.mMaxHarvestLevel = Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel", 7)); + Materials.getMaterialsMap().values().parallelStream().filter(tMaterial -> tMaterial != null && tMaterial.mToolQuality > 0 && tMaterial.mMetaItemSubID < gregtechproxy.mHarvestLevel.length && tMaterial.mMetaItemSubID >= 0).forEach( + tMaterial -> gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality) + ); } if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) { @@ -412,15 +432,12 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("GT_Mod: Generating Lang-File"); GT_LanguageManager.sEnglishFile = new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.lang")); GT_LanguageManager.sEnglishFile.load(); - - for (Materials aMaterial : Materials.values()) { - if (aMaterial != null) - aMaterial.mLocalizedName = GT_LanguageManager.addStringLocalization("Material." + aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName); - } + + Materials.getMaterialsMap().values().parallelStream().filter(Objects::nonNull).forEach(aMaterial -> aMaterial.mLocalizedName = GT_LanguageManager.addStringLocalization("Material." + aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName)); GT_Log.out.println("GT_Mod: Removing all original Scrapbox Drops."); try { - GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true).set(null, Integer.valueOf(0)); + GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true).set(null, 0); ((List) GT_Utility.getFieldContent(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "drops", true, true)).clear(); } catch (Throwable e) { if (GT_Values.D1) { @@ -434,110 +451,126 @@ public class GT_Mod implements IGT_Mod { EntityRegistry.registerModEntity(GT_Entity_Arrow_Potion.class, "GT_Entity_Arrow_Potion", 2, GT_Values.GT, 160, 1, true); GT_FML_LOGGER.info("preReader"); - List<String> oreTags = new ArrayList<String>(); - if(Loader.isModLoaded("MineTweaker3")){ - File globalDir = new File("scripts"); - if (globalDir.exists()){ - List<String> scripts = new ArrayList<String>(); - for (File file : globalDir.listFiles()) { - if (file.getName().endsWith(".zs")) { - try (BufferedReader br = new BufferedReader(new FileReader(file))) { - String line; - while ((line = br.readLine()) != null) { - scripts.add(line); - } - } catch (Exception e) {e.printStackTrace();} - } - } - String pattern1 = "<"; - String pattern2 = ">"; - - Pattern p = Pattern.compile(Pattern.quote(pattern1) + "(.*?)" + Pattern.quote(pattern2)); - for(String text : scripts){ - Matcher m = p.matcher(text); - while (m.find()) { - String hit = m.group(1); - if(hit.startsWith("ore:")){ - hit = hit.substring(4); - if(!oreTags.contains(hit)) oreTags.add(hit); - }else if(hit.startsWith("gregtech:gt.metaitem.0")){ - hit = hit.substring(22); - int mIt = Integer.parseInt(hit.substring(0, 1)); - if(mIt>0){ - int meta = 0; - try{ - hit = hit.substring(2); - meta = Integer.parseInt(hit); - }catch(Exception e){GT_FML_LOGGER.info("parseError: "+hit);} - if(meta>0&&meta<32000){ - int prefix = meta/1000; - int material = meta % 1000; - String tag = ""; - String[] tags = new String[]{}; - if(mIt==1)tags = new String[]{"dustTiny","dustSmall","dust","dustImpure","dustPure","crushed","crushedPurified","crushedCentrifuged","gem","nugget",null,"ingot","ingotHot","ingotDouble","ingotTriple","ingotQuadruple","ingotQuintuple","plate", "plateDouble","plateTriple","plateQuadruple","plateQuintuple","plateDense","stick","lens","round","bolt","screw","ring","foil","cell","cellPlasma","cellMolten"}; - if(mIt==2)tags = new String[]{"toolHeadSword", "toolHeadPickaxe", "toolHeadShovel", "toolHeadAxe", "toolHeadHoe", "toolHeadHammer", "toolHeadFile", "toolHeadSaw", "toolHeadDrill", "toolHeadChainsaw", "toolHeadWrench", "toolHeadUniversalSpade", "toolHeadSense", "toolHeadPlow", "toolHeadArrow", "toolHeadBuzzSaw", "turbineBlade", null, null, "wireFine", "gearGtSmall", "rotor", "stickLong", "springSmall", "spring", "arrowGtWood", "arrowGtPlastic", "gemChipped", "gemFlawed", "gemFlawless", "gemExquisite", "gearGt"}; - if(mIt==3)tags = new String[]{"crateGtDust", "crateGtIngot", "crateGtGem", "crateGtPlate", "itemCasing"}; - if(tags.length>prefix) tag = tags[prefix]; - if(GregTech_API.sGeneratedMaterials[material]!=null){ - tag += GregTech_API.sGeneratedMaterials[material].mName; - if(!oreTags.contains(tag)) oreTags.add(tag); - }else if(material>0){GT_FML_LOGGER.info("MaterialDisabled: "+material+" "+m.group(1));} - } - } - } - } - } - } - } - String[] preS = new String[]{"dustTiny","dustSmall","dust","dustImpure","dustPure","crushed","crushedPurified","crushedCentrifuged","gem","nugget","ingot","ingotHot","ingotDouble","ingotTriple","ingotQuadruple","ingotQuintuple","plate","plateDouble","plateTriple","plateQuadruple","plateQuintuple","plateDense","stick","lens","round","bolt","screw","ring","foil","cell","cellPlasma","toolHeadSword", "toolHeadPickaxe", "toolHeadShovel", "toolHeadAxe", "toolHeadHoe", "toolHeadHammer", "toolHeadFile", "toolHeadSaw", "toolHeadDrill", "toolHeadChainsaw", "toolHeadWrench", "toolHeadUniversalSpade", "toolHeadSense", "toolHeadPlow", "toolHeadArrow", "toolHeadBuzzSaw", "turbineBlade", "wireFine", "gearGtSmall", "rotor", "stickLong", "springSmall", "spring", "arrowGtWood", "arrowGtPlastic", "gemChipped", "gemFlawed", "gemFlawless", "gemExquisite", "gearGt","crateGtDust", "crateGtIngot", "crateGtGem", "crateGtPlate","cellMolten"}; - - List<String> mMTTags = new ArrayList<String>(); - for(String test : oreTags){ - if(StringUtils.startsWithAny(test, preS)){ - mMTTags.add(test); - if(GT_Values.D1) - GT_FML_LOGGER.info("oretag: "+test); - }} - + List<String> oreTags = new ArrayList<>(); + if (Loader.isModLoaded("MineTweaker3")) { + File globalDir = new File("scripts"); + if (globalDir.exists()) { + List<String> scripts = new ArrayList<>(); + for (File file : globalDir.listFiles()) { + if (file.getName().endsWith(".zs")) { + try (BufferedReader br = new BufferedReader(new FileReader(file))) { + String line; + while ((line = br.readLine()) != null) { + scripts.add(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + String pattern1 = "<"; + String pattern2 = ">"; + + Pattern p = Pattern.compile(Pattern.quote(pattern1) + "(.*?)" + Pattern.quote(pattern2)); + for (String text : scripts) { + Matcher m = p.matcher(text); + while (m.find()) { + String hit = m.group(1); + if (hit.startsWith("ore:")) { + hit = hit.substring(4); + if (!oreTags.contains(hit)) oreTags.add(hit); + } else if (hit.startsWith("gregtech:gt.metaitem.0")) { + hit = hit.substring(22); + int mIt = Integer.parseInt(hit.substring(0, 1)); + if (mIt > 0) { + int meta = 0; + try { + hit = hit.substring(2); + meta = Integer.parseInt(hit); + } catch (Exception e) { + GT_FML_LOGGER.info("parseError: " + hit); + } + if (meta > 0 && meta < 32000) { + int prefix = meta / 1000; + int material = meta % 1000; + String tag = ""; + String[] tags = new String[]{}; + if (mIt == 1) + tags = new String[]{"dustTiny", "dustSmall", "dust", "dustImpure", "dustPure", "crushed", "crushedPurified", "crushedCentrifuged", "gem", "nugget", null, "ingot", "ingotHot", "ingotDouble", "ingotTriple", "ingotQuadruple", "ingotQuintuple", "plate", "plateDouble", "plateTriple", "plateQuadruple", "plateQuintuple", "plateDense", "stick", "lens", "round", "bolt", "screw", "ring", "foil", "cell", "cellPlasma", "cellMolten"}; + if (mIt == 2) + tags = new String[]{"toolHeadSword", "toolHeadPickaxe", "toolHeadShovel", "toolHeadAxe", "toolHeadHoe", "toolHeadHammer", "toolHeadFile", "toolHeadSaw", "toolHeadDrill", "toolHeadChainsaw", "toolHeadWrench", "toolHeadUniversalSpade", "toolHeadSense", "toolHeadPlow", "toolHeadArrow", "toolHeadBuzzSaw", "turbineBlade", null, null, "wireFine", "gearGtSmall", "rotor", "stickLong", "springSmall", "spring", "arrowGtWood", "arrowGtPlastic", "gemChipped", "gemFlawed", "gemFlawless", "gemExquisite", "gearGt"}; + if (mIt == 3) + tags = new String[]{"crateGtDust", "crateGtIngot", "crateGtGem", "crateGtPlate", "itemCasing"}; + if (tags.length > prefix) tag = tags[prefix]; + if (GregTech_API.sGeneratedMaterials[material] != null) { + tag += GregTech_API.sGeneratedMaterials[material].mName; + if (!oreTags.contains(tag)) oreTags.add(tag); + } else if (material > 0) { + GT_FML_LOGGER.info("MaterialDisabled: " + material + " " + m.group(1)); + } + } + } + } + } + } + } + } + String[] preS = new String[]{"dustTiny", "dustSmall", "dust", "dustImpure", "dustPure", "crushed", "crushedPurified", "crushedCentrifuged", "gem", "nugget", "ingot", "ingotHot", "ingotDouble", "ingotTriple", "ingotQuadruple", "ingotQuintuple", "plate", "plateDouble", "plateTriple", "plateQuadruple", "plateQuintuple", "plateDense", "stick", "lens", "round", "bolt", "screw", "ring", "foil", "cell", "cellPlasma", "toolHeadSword", "toolHeadPickaxe", "toolHeadShovel", "toolHeadAxe", "toolHeadHoe", "toolHeadHammer", "toolHeadFile", "toolHeadSaw", "toolHeadDrill", "toolHeadChainsaw", "toolHeadWrench", "toolHeadUniversalSpade", "toolHeadSense", "toolHeadPlow", "toolHeadArrow", "toolHeadBuzzSaw", "turbineBlade", "wireFine", "gearGtSmall", "rotor", "stickLong", "springSmall", "spring", "arrowGtWood", "arrowGtPlastic", "gemChipped", "gemFlawed", "gemFlawless", "gemExquisite", "gearGt", "crateGtDust", "crateGtIngot", "crateGtGem", "crateGtPlate", "cellMolten"}; + + List<String> mMTTags = new ArrayList<>(); + oreTags.stream() + .filter(test -> StringUtils.startsWithAny(test, preS)) + .forEach(test -> { + mMTTags.add(test); + if (GT_Values.D1) + GT_FML_LOGGER.info("oretag: " + test); + }); + GT_FML_LOGGER.info("reenableMetaItems"); - for(String reEnable : mMTTags){ - OrePrefixes tPrefix = OrePrefixes.getOrePrefix(reEnable); - if(tPrefix!=null){ - Materials tName = Materials.get(reEnable.replaceFirst(tPrefix.toString(), "")); - if(tName!=null){ - tPrefix.mDisabledItems.remove(tName); - tPrefix.mGeneratedItems.add(tName); - if(tPrefix == OrePrefixes.screw){ - OrePrefixes.bolt.mDisabledItems.remove(tName); - OrePrefixes.bolt.mGeneratedItems.add(tName); - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.round){ - OrePrefixes.nugget.mDisabledItems.remove(tName); - OrePrefixes.nugget.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.spring){ - OrePrefixes.stickLong.mDisabledItems.remove(tName); - OrePrefixes.stickLong.mGeneratedItems.add(tName); - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.springSmall){ - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.stickLong){ - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.rotor){ - OrePrefixes.ring.mDisabledItems.remove(tName); - OrePrefixes.ring.mGeneratedItems.add(tName); - } - }else{GT_FML_LOGGER.info("noMaterial "+reEnable);} - }else{GT_FML_LOGGER.info("noPrefix "+reEnable);}} - + + for (String reEnable : mMTTags) { + OrePrefixes tPrefix = OrePrefixes.getOrePrefix(reEnable); + if (tPrefix != null) { + Materials tName = Materials.get(reEnable.replaceFirst(tPrefix.toString(), "")); + if (tName != null) { + tPrefix.mDisabledItems.remove(tName); + tPrefix.mGeneratedItems.add(tName); + if (tPrefix == OrePrefixes.screw) { + OrePrefixes.bolt.mDisabledItems.remove(tName); + OrePrefixes.bolt.mGeneratedItems.add(tName); + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.round) { + OrePrefixes.nugget.mDisabledItems.remove(tName); + OrePrefixes.nugget.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.spring) { + OrePrefixes.stickLong.mDisabledItems.remove(tName); + OrePrefixes.stickLong.mGeneratedItems.add(tName); + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.springSmall) { + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.stickLong) { + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.rotor) { + OrePrefixes.ring.mDisabledItems.remove(tName); + OrePrefixes.ring.mGeneratedItems.add(tName); + } + } else { + GT_FML_LOGGER.info("noMaterial " + reEnable); + } + } else { + GT_FML_LOGGER.info("noPrefix " + reEnable); + } + } + new GT_Loader_OreProcessing().run(); new GT_Loader_OreDictionary().run(); new GT_Loader_ItemData().run(); @@ -549,62 +582,60 @@ public class GT_Mod implements IGT_Mod { new GT_SonictronLoader().run(); new GT_SpawnEventHandler(); - if (true) { - GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - Materials.Quartzite.getDustSmall(1),Materials.PotassiumFeldspar.getDustSmall(1),Materials.Marble.getDustTiny(2), - Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), - new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 480, 120); - GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - 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); - } - /* + GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + Materials.Quartzite.getDustSmall(1), Materials.PotassiumFeldspar.getDustSmall(1), Materials.Marble.getDustTiny(2), + Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), + new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 480, 120); + GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + 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, new Object[0]), 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, new Object[0]), 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, new Object[0]), 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)}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSS", "STS", "SSS", 'S', ItemList.Cover_SolarPanel, 'T', OrePrefixes.circuit.get(Materials.Advanced)}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_8V, 'T', ItemList.Transformer_LV_ULV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_LV, 'T', ItemList.Transformer_MV_LV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_MV, 'T', ItemList.Transformer_HV_MV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_HV, 'T', ItemList.Transformer_EV_HV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_EV, 'T', ItemList.Transformer_IV_EV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_IV, 'T', ItemList.Transformer_LuV_IV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_LuV, 'T', ItemList.Transformer_ZPM_LuV}); + 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, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{" S ", "STS", " S ", 'S', ItemList.Cover_SolarPanel_ZPM, 'T', ItemList.Transformer_UV_ZPM}); + 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); - int[] chances = new int[]{fullChance, fullChance, fullChance, fullChance, fullChance, (int)(5500 * outputMultiplier)}; - GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - Materials.Quartzite.getDustSmall(1),Materials.PotassiumFeldspar.getDustSmall(1),Materials.Marble.getDustTiny(2), - Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), - chances, 600, 120); - GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - 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, 10000, 6000}, 600, 1920); + int fullChance = (int) (10000 * outputMultiplier); + int[] chances = new int[]{fullChance, fullChance, fullChance, fullChance, fullChance, (int) (5500 * outputMultiplier)}; + GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + Materials.Quartzite.getDustSmall(1), Materials.PotassiumFeldspar.getDustSmall(1), Materials.Marble.getDustTiny(2), + Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), + chances, 600, 120); + GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + 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, 10000, 6000}, 600, 1920); } double ashOutputMultiplier = Math.min(GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "AshOutputMultiplier", 1.0), 1.0); if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "AshYieldsAlkaliMetalOxides", true)) { @@ -612,24 +643,24 @@ public class GT_Mod implements IGT_Mod { (int) (6000 * ashOutputMultiplier), (int) (500 * ashOutputMultiplier), (int) (5000 * ashOutputMultiplier), (int) (2500 * ashOutputMultiplier)}; GT_Values.RA.addCentrifugeRecipe(Materials.Ash.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - Materials.Quicklime.getDustSmall(2), Materials.Potash.getDustSmall(1), Materials.Magnesia.getDustSmall(1), + Materials.Quicklime.getDustSmall(2), Materials.Potash.getDustSmall(1), Materials.Magnesia.getDustSmall(1), Materials.PhosphorousPentoxide.getDustTiny(1), Materials.SodaAsh.getDustTiny(1), Materials.BandedIron.getDustTiny(1), outputChances, 240, 30); } else { GT_Values.RA.addCentrifugeRecipe(Materials.Ash.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, Materials.Carbon.getDust(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[]{(int) (10000 * ashOutputMultiplier), 0, 0, 0, 0, 0}, 40, 16); - } + } if (gregtechproxy.mSortToTheEnd) { try { GT_Log.out.println("GT_Mod: Sorting GregTech to the end of the Mod List for further processing."); LoadController tLoadController = (LoadController) GT_Utility.getFieldContent(Loader.instance(), "modController", true, true); List<ModContainer> tModList = tLoadController.getActiveModList(); - List<ModContainer> tNewModsList = new ArrayList(); + List<ModContainer> tNewModsList = new ArrayList<>(); ModContainer tGregTech = null; - short tModList_sS= (short) tModList.size(); + short tModList_sS = (short) tModList.size(); for (short i = 0; i < tModList_sS; i = (short) (i + 1)) { - ModContainer tMod = (ModContainer) tModList.get(i); + ModContainer tMod = tModList.get(i); if (tMod.getModId().equalsIgnoreCase("gregtech")) { tGregTech = tMod; } else { @@ -649,15 +680,17 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sPreloadFinished = true; GT_Log.out.println("GT_Mod: Preload-Phase finished!"); GT_Log.ore.println("GT_Mod: Preload-Phase finished!"); - try { - for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { + + for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) - GT_Assemblyline_Server.fillMap(aEvent); + GT_Assemblyline_Server.fillMap(aEvent); } @Mod.EventHandler @@ -665,21 +698,20 @@ public class GT_Mod implements IGT_Mod { if (GregTech_API.sLoadStarted) { return; } - try { - for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { + + for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } - new GT_Bees(); - - //Disable Low Grav regardless of config if Cleanroom is disabled. - if (!gregtechproxy.mEnableCleanroom){ - gregtechproxy.mLowGravProcessing = false; - } + if (Loader.isModLoaded(MOD_ID_FR)) + new GT_Bees(); //Disable Low Grav regardless of config if Cleanroom is disabled. - if (!gregtechproxy.mEnableCleanroom){ + if (!gregtechproxy.mEnableCleanroom) { gregtechproxy.mLowGravProcessing = false; } @@ -692,11 +724,15 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sLoadFinished = true; GT_Log.out.println("GT_Mod: Load-Phase finished!"); GT_Log.ore.println("GT_Mod: Load-Phase finished!"); - try { - for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { + + for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + } @Mod.EventHandler @@ -704,11 +740,15 @@ public class GT_Mod implements IGT_Mod { if (GregTech_API.sPostloadStarted) { return; } - try { - for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { + + for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + gregtechproxy.onPostLoad(); if (gregtechproxy.mSortToTheEnd) { gregtechproxy.registerUnificationEntries(); @@ -728,18 +768,16 @@ public class GT_Mod implements IGT_Mod { new GT_Worldgenloader().run(); new GT_CoverLoader().run(); new GT_AE2EnergyTunnelLoader().run(); + LoadArmorComponents.init(); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.planks, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.cobblestone, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.stone, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Items.leather, 1), null, false); + 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(new ItemStack[]{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, new MaterialStack[0])); + 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[]{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(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[]{new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)}); + 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)}); //Save a copy of these list before activateOreDictHandler(), then loop over them. @@ -750,14 +788,34 @@ public class GT_Mod implements IGT_Mod { Map<IRecipeInput, RecipeOutput> aThermalCentrifugeRecipeList = GT_ModHandler.getThermalCentrifugeRecipeList(); 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.", new Object[0]); + 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(); gregtechproxy.activateOreDictHandler(); - GT_FML_LOGGER.info("Congratulations, you have been waiting long enough. Have a Cake.", new Object[0]); - GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: "+GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString()); + GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). 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())); + GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait."); + ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", replaceVanillaItemsSet.size()); + if (GT_Values.cls_enabled){ + try { + GT_CLS_Compat.doActualRegistrationCLS(progressBar,replaceVanillaItemsSet); + GT_CLS_Compat.pushToDisplayProgress(); + } catch (InvocationTargetException | IllegalAccessException e) { + GT_Mod.GT_FML_LOGGER.catching(e); + } + } + else { + replaceVanillaItemsSet.forEach(m -> { + progressBar.step(m.mDefaultLocalName); + doActualRegistration(m); + }); + } + 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."); //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); @@ -766,19 +824,16 @@ public class GT_Mod implements IGT_Mod { GT_ModHandler.addIC2RecipesToGT(aThermalCentrifugeRecipeList, GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true); if (GT_Values.D1) { - IRecipe tRecipe; - for (Iterator i$ = GT_ModHandler.sSingleNonBlockDamagableRecipeList.iterator(); i$.hasNext(); GT_Log.out.println("=> " + tRecipe.getRecipeOutput().getDisplayName())) { - tRecipe = (IRecipe) i$.next(); - } + GT_ModHandler.sSingleNonBlockDamagableRecipeList.forEach(iRecipe -> GT_Log.out.println("=> " + iRecipe.getRecipeOutput().getDisplayName())); } new GT_CraftingRecipeLoader().run(); if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2forgehammer", true)) { - GT_ModHandler.removeRecipeByOutput(ItemList.IC2_ForgeHammer.getWildcard(1L, new Object[0])); + GT_ModHandler.removeRecipeByOutput(ItemList.IC2_ForgeHammer.getWildcard(1L)); } GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("machine", 1L)); GT_ModHandler.addCraftingRecipe(GT_ModHandler.getIC2Item("machine", 1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "RwR", "RRR", 'R', OrePrefixes.plate.get(Materials.Iron)}); ItemStack ISdata0 = new ItemStack(Items.potionitem, 1, 0); - ItemStack ILdata0 = ItemList.Bottle_Empty.get(1L, new Object[0]); + ItemStack ILdata0 = ItemList.Bottle_Empty.get(1L); for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if ((tData.filledContainer.getItem() == Items.potionitem) && (tData.filledContainer.getItemDamage() == 0)) { GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{ILdata0}, new ItemStack[]{ISdata0}, null, new FluidStack[]{Materials.Water.getFluid(250L)}, null, 4, 1, 0); @@ -788,35 +843,13 @@ public class GT_Mod implements IGT_Mod { GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes.addRecipe(true, new ItemStack[]{tData.filledContainer}, new ItemStack[]{GT_Utility.getContainerItem(tData.filledContainer, true)}, null, null, new FluidStack[]{tData.fluid}, tData.fluid.amount / 62, 1, 0); } } - try { - for (ICentrifugeRecipe tRecipe : RecipeManagers.centrifugeManager.recipes()) { - Map<ItemStack, Float> outputs = tRecipe.getAllProducts(); - ItemStack[] tOutputs = new ItemStack[outputs.size()]; - int[] tChances = new int[outputs.size()]; - int i = 0; - for (Map.Entry<ItemStack, Float> entry : outputs.entrySet()) { - tChances[i] = (int) (entry.getValue() * 10000); - tOutputs[i] = entry.getKey().copy(); - i++; - } - GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(true, new ItemStack[]{tRecipe.getInput()}, tOutputs, null, tChances, null, null, 128, 5, 0); - } - } catch (Throwable e) { - if (GT_Values.D1) { - e.printStackTrace(GT_Log.err); - } - } - try { - for (ISqueezerRecipe tRecipe : RecipeManagers.squeezerManager.recipes()) { - if ((tRecipe.getResources().length == 1) && (tRecipe.getFluidOutput() != null)) { - GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(true, new ItemStack[]{tRecipe.getResources()[0]}, new ItemStack[]{tRecipe.getRemnants()}, null, new int[]{(int) (tRecipe.getRemnantsChance() * 10000)}, null, new FluidStack[]{tRecipe.getFluidOutput()}, 32, 8, 0); - } - } - } catch (Throwable e) { - if (GT_Values.D1) { - e.printStackTrace(GT_Log.err); - } + + if (Loader.isModLoaded(MOD_ID_FR)) { + GT_Forestry_Compat.transferCentrifugeRecipes(); + GT_Forestry_Compat.transferSqueezerRecipes(); } + if (Loader.isModLoaded(MOD_ID_AE)) + 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)); @@ -912,87 +945,78 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sPostloadFinished = true; GT_Log.out.println("GT_Mod: PostLoad-Phase finished!"); GT_Log.ore.println("GT_Mod: PostLoad-Phase finished!"); - try { - for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { + for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} - GT_Log.out.println("GT_Mod: Adding Fake Recipes for NEI"); - if (ItemList.FR_Bee_Drone.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Drone.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Bee_Princess.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Princess.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Bee_Princess.getWithName(1L, "Scanned Princess", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Bee_Queen.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Queen.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Bee_Queen.getWithName(1L, "Scanned Queen", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Tree_Sapling.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Tree_Sapling.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Tree_Sapling.getWithName(1L, "Scanned Sapling", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Butterfly.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Butterfly.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Butterfly.getWithName(1L, "Scanned Butterfly", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Larvae.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Larvae.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Larvae.getWithName(1L, "Scanned Larvae", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Serum.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Serum.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Serum.getWithName(1L, "Scanned Serum", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.FR_Caterpillar.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Caterpillar.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Caterpillar.getWithName(1L, "Scanned Caterpillar", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); } - if (ItemList.FR_PollenFertile.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_PollenFertile.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_PollenFertile.getWithName(1L, "Scanned Pollen", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); - } - if (ItemList.IC2_Crop_Seeds.get(1L, new Object[0]) != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.IC2_Crop_Seeds.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.IC2_Crop_Seeds.getWithName(1L, "Scanned Seeds", new Object[0])}, null, null, null, 160, 8, 0); + GT_Log.out.println("GT_Mod: Adding Fake Recipes for NEI"); + + if (Loader.isModLoaded(MOD_ID_FR)) + GT_Forestry_Compat.populateFakeNeiRecipes(); + + if (ItemList.IC2_Crop_Seeds.get(1L) != null) { + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.IC2_Crop_Seeds.getWildcard(1L)}, new ItemStack[]{ItemList.IC2_Crop_Seeds.getWithName(1L, "Scanned Seeds")}, null, null, null, 160, 8, 0); + } + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{new ItemStack(Items.written_book, 1, 32767)}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Book Data")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 128, 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{new ItemStack(Items.filled_map, 1, 32767)}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Map Data")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 128, 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Orb to overwrite")}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Copy of the Orb")}, ItemList.Tool_DataOrb.getWithName(0L, "Orb to copy"), null, null, 512, 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Stick to overwrite")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Copy of the Stick")}, ItemList.Tool_DataStick.getWithName(0L, "Stick to copy"), null, null, 128, 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Raw Prospection Data")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Analyzed Prospection Data")}, null, null, null, 1000, 30, 0); + if (Loader.isModLoaded("GalacticraftCore")) { + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalacticraftCore", "item.schematic", 1, Short.MAX_VALUE).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0); + if (Loader.isModLoaded("GalacticraftMars")) + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalacticraftMars", "item.schematic", 1, Short.MAX_VALUE).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0); + if (Loader.isModLoaded("GalaxySpace")) { + for (int i = 4; i < 9; i++) { + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalaxySpace", "item.SchematicTier" + i, 1).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic")}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to"), null, null, 36000, 480, 0); + } + } } - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{new ItemStack(Items.written_book, 1, 32767)}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Book Data", new Object[0])}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to", new Object[0]), null, null, 128, 30, 0); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{new ItemStack(Items.filled_map, 1, 32767)}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Map Data", new Object[0])}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to", new Object[0]), null, null, 128, 30, 0); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Orb to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Copy of the Orb", new Object[0])}, ItemList.Tool_DataOrb.getWithName(0L, "Orb to copy", new Object[0]), null, null, 512, 30, 0); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Stick to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Copy of the Stick", new Object[0])}, ItemList.Tool_DataStick.getWithName(0L, "Stick to copy", new Object[0]), null, null, 128, 30, 0); - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Raw Prospection Data", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Analyzed Prospection Data", new Object[0])}, null, null, null, 1000, 30, 0); - if (Loader.isModLoaded("GalacticraftCore")) - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_ModHandler.getModItem("GalacticraftCore","item.schematic",1).setStackDisplayName("Any Schematic")}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Scanned Schematic", new Object[0])}, ItemList.Tool_DataStick.getWithName(1L, "Stick to save it to", new Object[0]), null, null, 36000, 480, 0); - for (Materials tMaterial : Materials.values()) { + Materials.getMaterialsMap().values().stream().forEach(tMaterial -> { if ((tMaterial.mElement != null) && (!tMaterial.mElement.mIsIsotope) && (tMaterial != Materials.Magic) && (tMaterial.getMass() > 0L)) { - ItemStack tOutput = ItemList.Tool_DataOrb.get(1L, new Object[0]); + ItemStack tOutput = ItemList.Tool_DataOrb.get(1L); Behaviour_DataOrb.setDataTitle(tOutput, "Elemental-Scan"); Behaviour_DataOrb.setDataName(tOutput, tMaterial.mElement.name()); ItemStack tInput = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L); ItemStack[] ISmat0 = new ItemStack[]{tInput}; ItemStack[] ISmat1 = new ItemStack[]{tOutput}; if (tInput != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L, new Object[0]), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0); GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, ISmat0, ISmat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0); } tInput = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L); ISmat0 = new ItemStack[]{tInput}; if (tInput != null) { - GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L, new Object[0]), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0); + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, ISmat0, ISmat1, ItemList.Tool_DataOrb.get(1L), null, null, (int) (tMaterial.getMass() * 8192L), 30, 0); GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes.addFakeRecipe(false, null, ISmat0, ISmat1, new FluidStack[]{Materials.UUMatter.getFluid(tMaterial.getMass())}, null, (int) (tMaterial.getMass() * 512L), 30, 0); } } - } - if (!GT_MetaTileEntity_Massfabricator.sRequiresUUA) GT_Recipe.GT_Recipe_Map.sMassFabFakeRecipes.addFakeRecipe(false, null, null, null, null, new FluidStack[]{Materials.UUMatter.getFluid(1L)}, GT_MetaTileEntity_Massfabricator.sDurationMultiplier, 256, 0); + }); + + if (!GT_MetaTileEntity_Massfabricator.sRequiresUUA) + GT_Recipe.GT_Recipe_Map.sMassFabFakeRecipes.addFakeRecipe(false, null, null, null, null, new FluidStack[]{Materials.UUMatter.getFluid(1L)}, GT_MetaTileEntity_Massfabricator.sDurationMultiplier, 256, 0); GT_Recipe.GT_Recipe_Map.sMassFabFakeRecipes.addFakeRecipe(false, null, null, null, new FluidStack[]{Materials.UUAmplifier.getFluid(GT_MetaTileEntity_Massfabricator.sUUAperUUM)}, new FluidStack[]{Materials.UUMatter.getFluid(1L)}, GT_MetaTileEntity_Massfabricator.sDurationMultiplier / GT_MetaTileEntity_Massfabricator.sUUASpeedBonus, 256, 0); - GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Side", new Object[0])}, new ItemStack[]{new ItemStack(Blocks.cobblestone, 1)}, null, null, null, 16, 30, 0); - GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Top", new Object[0])}, new ItemStack[]{new ItemStack(Blocks.stone, 1)}, null, null, null, 16, 30, 0); + GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Side")}, new ItemStack[]{new ItemStack(Blocks.cobblestone, 1)}, null, null, null, 16, 30, 0); + GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Display_ITS_FREE.getWithName(0L, "Place Lava on Top")}, new ItemStack[]{new ItemStack(Blocks.stone, 1)}, null, null, null, 16, 30, 0); GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes.addFakeRecipe(false, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L)}, new ItemStack[]{new ItemStack(Blocks.obsidian, 1)}, null, null, null, 128, 30, 0); - if(GregTech_API.mOutputRF||GregTech_API.mInputRF){ + if (GregTech_API.mOutputRF || GregTech_API.mInputRF) { GT_Utility.checkAvailabilities(); - if(!GT_Utility.RF_CHECK){ + if (!GT_Utility.RF_CHECK) { GregTech_API.mOutputRF = false; GregTech_API.mInputRF = false; } } - + addSolidFakeLargeBoilerFuels(); - + achievements = new GT_Achievements(); + + GT_Recipe.GTppRecipeHelper = true; GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables."); GregTech_API.sBeforeGTPreload = null; GregTech_API.sAfterGTPreload = null; @@ -1002,7 +1026,6 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sAfterGTPostload = null; - CreativeTabs mainTab = new CreativeTabs("GTtools") { @SideOnly(Side.CLIENT) @Override @@ -1022,12 +1045,12 @@ public class GT_Mod implements IGT_Mod { if (GT_MetaGenerated_Tool_01.INSTANCE.getToolStats(new ItemStack(GT_MetaGenerated_Tool_01.INSTANCE, 1, i)) != null) { ItemStack tStack = new ItemStack(GT_MetaGenerated_Tool_01.INSTANCE, 1, i); GT_MetaGenerated_Tool_01.INSTANCE.isItemStackUsable(tStack); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1,Materials.Lead,Materials.Lead,null)); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1,Materials.Nickel,Materials.Nickel,null)); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1,Materials.Cobalt,Materials.Cobalt,null)); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1,Materials.Osmium,Materials.Osmium,null)); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1,Materials.Adamantium,Materials.Adamantium,null)); - aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i,1, Materials.Neutronium,Materials.Neutronium,null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Lead, Materials.Lead, null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Nickel, Materials.Nickel, null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Cobalt, Materials.Cobalt, null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Osmium, Materials.Osmium, null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Adamantium, Materials.Adamantium, null)); + aList.add(GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(i, 1, Materials.Neutronium, Materials.Neutronium, null)); } } super.displayAllReleventItems(aList); @@ -1035,13 +1058,47 @@ public class GT_Mod implements IGT_Mod { }; } + public static void doActualRegistration(Materials m){ + String platename = OrePrefixes.plate.get(m).toString(); + boolean noSmash = !m.contains(SubTag.NO_SMASHING); + if ((m.mTypes & 2) != 0) + GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getIngots(1)); + if ((m.mTypes & 4) != 0) + GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getGems(1)); + if (m.getBlocks(1) != null) + GT_RecipeRegistrator.registerUsagesForMaterials(null, noSmash, m.getBlocks(1)); + } + + @Mod.EventHandler + public void onServerStarted(FMLServerStartedEvent aEvent) { + gregtechproxy.onServerStarted(); + } + + @Mod.EventHandler + 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) { - try { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { + + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + gregtechproxy.onServerStarting(); //Check for more IC2 recipes on ServerStart to also catch MineTweaker additions GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getMaceratorRecipeList(), GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true); @@ -1050,68 +1107,20 @@ public class GT_Mod implements IGT_Mod { GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getOreWashingRecipeList(), GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true); GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getThermalCentrifugeRecipeList(), GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true); GT_Log.out.println("GT_Mod: Unificating outputs of all known Recipe Types."); - ArrayList<ItemStack> tStacks = new ArrayList(10000); + ArrayList<ItemStack> tStacks = new ArrayList<>(10000); GT_Log.out.println("GT_Mod: IC2 Machines"); - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.cannerBottle.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.centrifuge.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.compressor.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.extractor.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.macerator.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.metalformerCutting.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.metalformerExtruding.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.metalformerRolling.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.matterAmplifier.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } - for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.oreWashing.getRecipes().values()) { - ItemStack tStack; - for (Iterator i$ = tRecipe.items.iterator(); i$.hasNext(); tStacks.add(tStack)) { - tStack = (ItemStack) i$.next(); - } - } + + ic2.api.recipe.Recipes.cannerBottle.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.centrifuge.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.compressor.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.extractor.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.macerator.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.metalformerCutting.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.metalformerExtruding.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.metalformerRolling.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.matterAmplifier.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + ic2.api.recipe.Recipes.oreWashing.getRecipes().values().stream().map(t -> t.items).forEach(tStacks::addAll); + GT_Log.out.println("GT_Mod: Dungeon Loot"); for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new XSTR())) { tStacks.add(tContent.theItemId); @@ -1144,10 +1153,9 @@ public class GT_Mod implements IGT_Mod { tStacks.add(tContent.theItemId); } GT_Log.out.println("GT_Mod: Smelting"); - Object tStack; - for (Iterator i$ = FurnaceRecipes.smelting().getSmeltingList().values().iterator(); i$.hasNext(); tStacks.add((ItemStack) tStack)) { - tStack = i$.next(); - } + + FurnaceRecipes.smelting().getSmeltingList().values().forEach(k -> tStacks.add((ItemStack) k)); + if (gregtechproxy.mCraftingUnification) { GT_Log.out.println("GT_Mod: Crafting Recipes"); for (Object tRecipe : CraftingManager.getInstance().getRecipeList()) { @@ -1158,21 +1166,21 @@ public class GT_Mod implements IGT_Mod { } for (ItemStack tOutput : tStacks) { if (gregtechproxy.mRegisteredOres.contains(tOutput)) { - GT_FML_LOGGER.error("GT-ERR-01: @ " + tOutput.getUnlocalizedName() + " " + tOutput.getDisplayName(), new Object[0]); - GT_FML_LOGGER.error("A Recipe used an OreDict Item as Output directly, without copying it before!!! This is a typical CallByReference/CallByValue Error", new Object[0]); - GT_FML_LOGGER.error("Said Item will be renamed to make the invalid Recipe visible, so that you can report it properly.", new Object[0]); - GT_FML_LOGGER.error("Please check all Recipes outputting this Item, and report the Recipes to their Owner.", new Object[0]); - GT_FML_LOGGER.error("The Owner of the ==>RECIPE<==, NOT the Owner of the Item, which has been mentioned above!!!", new Object[0]); - GT_FML_LOGGER.error("And ONLY Recipes which are ==>OUTPUTTING<== the Item, sorry but I don't want failed Bug Reports.", new Object[0]); - GT_FML_LOGGER.error("GregTech just reports this Error to you, so you can report it to the Mod causing the Problem.", new Object[0]); - GT_FML_LOGGER.error("Even though I make that Bug visible, I can not and will not fix that for you, that's for the causing Mod to fix.", new Object[0]); - GT_FML_LOGGER.error("And speaking of failed Reports:", new Object[0]); - GT_FML_LOGGER.error("Both IC2 and GregTech CANNOT be the CAUSE of this Problem, so don't report it to either of them.", new Object[0]); - GT_FML_LOGGER.error("I REPEAT, BOTH, IC2 and GregTech CANNOT be the source of THIS BUG. NO MATTER WHAT.", new Object[0]); - GT_FML_LOGGER.error("Asking in the IC2 Forums, which Mod is causing that, won't help anyone, since it is not possible to determine, which Mod it is.", new Object[0]); - GT_FML_LOGGER.error("If it would be possible, then I would have had added the Mod which is causing it to the Message already. But it is not possible.", new Object[0]); - GT_FML_LOGGER.error("Sorry, but this Error is serious enough to justify this Wall-O-Text and the partially allcapsed Language.", new Object[0]); - GT_FML_LOGGER.error("Also it is a Ban Reason on the IC2-Forums to post this seriously.", new Object[0]); + GT_FML_LOGGER.error("GT-ERR-01: @ " + tOutput.getUnlocalizedName() + " " + tOutput.getDisplayName()); + GT_FML_LOGGER.error("A Recipe used an OreDict Item as Output directly, without copying it before!!! This is a typical CallByReference/CallByValue Error"); + GT_FML_LOGGER.error("Said Item will be renamed to make the invalid Recipe visible, so that you can report it properly."); + GT_FML_LOGGER.error("Please check all Recipes outputting this Item, and report the Recipes to their Owner."); + GT_FML_LOGGER.error("The Owner of the ==>RECIPE<==, NOT the Owner of the Item, which has been mentioned above!!!"); + GT_FML_LOGGER.error("And ONLY Recipes which are ==>OUTPUTTING<== the Item, sorry but I don't want failed Bug Reports."); + GT_FML_LOGGER.error("GregTech just reports this Error to you, so you can report it to the Mod causing the Problem."); + GT_FML_LOGGER.error("Even though I make that Bug visible, I can not and will not fix that for you, that's for the causing Mod to fix."); + GT_FML_LOGGER.error("And speaking of failed Reports:"); + GT_FML_LOGGER.error("Both IC2 and GregTech CANNOT be the CAUSE of this Problem, so don't report it to either of them."); + GT_FML_LOGGER.error("I REPEAT, BOTH, IC2 and GregTech CANNOT be the source of THIS BUG. NO MATTER WHAT."); + GT_FML_LOGGER.error("Asking in the IC2 Forums, which Mod is causing that, won't help anyone, since it is not possible to determine, which Mod it is."); + GT_FML_LOGGER.error("If it would be possible, then I would have had added the Mod which is causing it to the Message already. But it is not possible."); + GT_FML_LOGGER.error("Sorry, but this Error is serious enough to justify this Wall-O-Text and the partially allcapsed Language."); + GT_FML_LOGGER.error("Also it is a Ban Reason on the IC2-Forums to post this seriously."); tOutput.setStackDisplayName("ERROR! PLEASE CHECK YOUR LOG FOR 'GT-ERR-01'!"); } else { GT_OreDictUnificator.setStack(tOutput); @@ -1181,16 +1189,42 @@ public class GT_Mod implements IGT_Mod { GregTech_API.mServerStarted = true; GT_Log.out.println("GT_Mod: ServerStarting-Phase finished!"); GT_Log.ore.println("GT_Mod: ServerStarting-Phase finished!"); - try { - for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { + + for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + + aEvent.registerServerCommand(new GT_Command()); + //Sets a new Machine Block Update Thread everytime a world is loaded + GT_Runnable_MachineBlockUpdate.initExecutorService(); } - @Mod.EventHandler - public void onServerStarted(FMLServerStartedEvent aEvent) { - gregtechproxy.onServerStarted(); + public boolean isServerSide() { + return gregtechproxy.isServerSide(); + } + + public boolean isClientSide() { + return gregtechproxy.isClientSide(); + } + + public boolean isBukkitSide() { + return gregtechproxy.isBukkitSide(); + } + + public EntityPlayer getThePlayer() { + return gregtechproxy.getThePlayer(); + } + + public int addArmor(String aArmorPrefix) { + return gregtechproxy.addArmor(aArmorPrefix); + } + + public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + gregtechproxy.doSonictronSound(aStack, aWorld, aX, aY, aZ); } @Mod.EventHandler @@ -1198,30 +1232,25 @@ public class GT_Mod implements IGT_Mod { GT_Utility.reInit(); GT_Recipe.reInit(); try { - for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { - Map tMap = (Map) i$.next(); - GT_Utility.reMap(tMap); + for (Map<gregtech.api.objects.GT_ItemStack, ?> gt_itemStackMap : GregTech_API.sItemStackMappings) { + GT_Utility.reMap((Map) gt_itemStackMap); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } } -// 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 onServerStopping(FMLServerStoppingEvent aEvent) { - try { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + gregtechproxy.onServerStopping(); try { if ((GT_Values.D1) || (GT_Log.out != System.out)) { @@ -1245,7 +1274,7 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("*"); GT_Log.out.println("*"); - tList = (String[]) FluidRegistry.getRegisteredFluids().keySet().toArray(new String[FluidRegistry.getRegisteredFluids().keySet().size()]); + tList = FluidRegistry.getRegisteredFluids().keySet().toArray(new String[0]); Arrays.sort(tList); for (String tFluidName : tList) { GT_Log.out.println(tFluidName); @@ -1289,73 +1318,44 @@ public class GT_Mod implements IGT_Mod { e.printStackTrace(GT_Log.err); } } - try { - for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { + for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { + try { tRunnable.run(); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); } - } catch (Throwable e) {e.printStackTrace(GT_Log.err);} - } - - public boolean isServerSide() { - return gregtechproxy.isServerSide(); - } - - public boolean isClientSide() { - return gregtechproxy.isClientSide(); - } - - public boolean isBukkitSide() { - return gregtechproxy.isBukkitSide(); - } - - public EntityPlayer getThePlayer() { - return gregtechproxy.getThePlayer(); - } - - public int addArmor(String aArmorPrefix) { - return gregtechproxy.addArmor(aArmorPrefix); + } + //Interrupt IDLE Threads to close down cleanly + GT_Runnable_MachineBlockUpdate.shutdownExecutorService(); } - public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ) { - gregtechproxy.doSonictronSound(aStack, aWorld, aX, aY, aZ); - } - - private void addSolidFakeLargeBoilerFuels(){ + private void addSolidFakeLargeBoilerFuels() { GT_Recipe.GT_Recipe_Map.sLargeBoilerFakeFuels.addSolidRecipes( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Charcoal, 1), - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 1), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Charcoal, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1), - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Coal, 1), - GT_OreDictUnificator.get(OrePrefixes.crushed, Materials.Coal, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lignite, 1), - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Lignite, 1), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Lignite, 1), - GT_OreDictUnificator.get(OrePrefixes.crushed, Materials.Lignite, 1), - GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1), - GT_OreDictUnificator.get(OrePrefixes.plank, Materials.Wood, 1), - GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Wood, 1), - GT_OreDictUnificator.get(OrePrefixes.slab, Materials.Wood, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sodium, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lithium, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Caesium, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1), - GT_OreDictUnificator.get(ItemList.Block_SSFUEL.get(1, new Object[0])), - GT_OreDictUnificator.get(ItemList.Block_MSSFUEL.get(1, new Object[0])), - GT_OreDictUnificator.get(OrePrefixes.rod, Materials.Blaze, 1)); + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Charcoal, 1), + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 1), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Charcoal, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1), + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Coal, 1), + GT_OreDictUnificator.get(OrePrefixes.crushed, Materials.Coal, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lignite, 1), + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Lignite, 1), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Lignite, 1), + GT_OreDictUnificator.get(OrePrefixes.crushed, Materials.Lignite, 1), + GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1), + GT_OreDictUnificator.get(OrePrefixes.plank, Materials.Wood, 1), + GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Wood, 1), + GT_OreDictUnificator.get(OrePrefixes.slab, Materials.Wood, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sodium, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lithium, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Caesium, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1), + GT_OreDictUnificator.get(ItemList.Block_SSFUEL.get(1)), + GT_OreDictUnificator.get(ItemList.Block_MSSFUEL.get(1)), + GT_OreDictUnificator.get(OrePrefixes.rod, Materials.Blaze, 1)); if (Loader.isModLoaded("Thaumcraft")) { - GT_Recipe.GT_Recipe_Map.sLargeBoilerFakeFuels.addSolidRecipe(GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1)); + GT_Recipe.GT_Recipe_Map.sLargeBoilerFakeFuels.addSolidRecipe(GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1)); } } - - public static int calculateTotalGTVersion(int minorVersion){ - return calculateTotalGTVersion(VERSION, minorVersion); - } - - public static int calculateTotalGTVersion(int majorVersion, int minorVersion){ - return majorVersion * 1000 + minorVersion; - - } -} +}
\ No newline at end of file |