diff options
author | Alkalus <Draknyte1@hotmail.com> | 2020-06-02 13:46:43 +0100 |
---|---|---|
committer | Alkalus <Draknyte1@hotmail.com> | 2020-06-02 13:46:43 +0100 |
commit | 96a83ee47f994c922aba625b67645661bc8cb4fe (patch) | |
tree | 1c7cbd37b9273cc1a1152cfe4d0f00fc8390bf5a /src | |
parent | 2f3e724c7746a0cc577e2dab4527d262b1e553d4 (diff) | |
download | GT5-Unofficial-96a83ee47f994c922aba625b67645661bc8cb4fe.tar.gz GT5-Unofficial-96a83ee47f994c922aba625b67645661bc8cb4fe.tar.bz2 GT5-Unofficial-96a83ee47f994c922aba625b67645661bc8cb4fe.zip |
- Removed placeholder map which was used to prevent BW crashes.
% Made the Simple washer ignore certain impure dusts if GTNH is loaded.
% Updated ChemPlant User manual to reflect requirement of Catalyst Bus.
$ Fixed handling of recipe maps which don't use cells.
$ Fixed Chem Plant not actually processing recipes.
$ Made the Catalyst Hatch a lower tier. (Fixes Chem Plant requiring ZPM tier hulls)
Diffstat (limited to 'src')
8 files changed, 565 insertions, 125 deletions
diff --git a/src/Java/gregtech/api/util/GTPP_Recipe.java b/src/Java/gregtech/api/util/GTPP_Recipe.java index 04f593d797..b44b05985b 100644 --- a/src/Java/gregtech/api/util/GTPP_Recipe.java +++ b/src/Java/gregtech/api/util/GTPP_Recipe.java @@ -353,7 +353,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { //Basic Washer Map public static final GTPP_Recipe_Map_Internal sSimpleWasherRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(3), "gt.recipe.simplewasher", "Simple Dust Washer", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sSimpleWasherRecipes_FakeFuckBW = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gt.recipe.simplewasher", "Fuck you Bart", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, false); + //public static final GT_Recipe_Map sSimpleWasherRecipes_FakeFuckBW = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gt.recipe.simplewasher", "Fuck you Bart", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, false); public static final GTPP_Recipe_Map sChemicalPlantRecipes = new GTPP_Recipe_Map( new HashSet<GTPP_Recipe>(100), diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 0b34e77ed1..0df731c548 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -55,6 +55,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; import gtPlusPlus.xmod.gregtech.loaders.GT_Material_Loader; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelterGT_GTNH; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_MultisUsingFluidInsteadOfCells; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects; import net.minecraft.launchwrapper.Launch; @@ -65,12 +66,9 @@ import net.minecraft.util.IIcon; public class GTplusplus implements ActionListener { public static enum INIT_PHASE { - SUPER(null), - PRE_INIT(SUPER), - INIT(PRE_INIT), - POST_INIT(INIT), - SERVER_START(POST_INIT), - STARTED(SERVER_START); + SUPER(null), PRE_INIT(SUPER), INIT(PRE_INIT), POST_INIT( + INIT + ), SERVER_START(POST_INIT), STARTED(SERVER_START); protected boolean mIsPhaseActive = false; private final INIT_PHASE mPrev; @@ -78,7 +76,7 @@ public class GTplusplus implements ActionListener { mPrev = aPreviousPhase; } - public synchronized final boolean isPhaseActive() { + public synchronized final boolean isPhaseActive() { return mIsPhaseActive; } public synchronized final void setPhaseActive(boolean aIsPhaseActive) { @@ -94,17 +92,17 @@ public class GTplusplus implements ActionListener { public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER; - //Mod Instance + // Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; - //Material Loader + // Material Loader public static GT_Material_Loader mGregMatLoader; - //GT_Proxy instance + // GT_Proxy instance protected static Meta_GT_Proxy mGregProxy; - //GT++ Proxy Instances + // GT++ Proxy Instances @SidedProxy(clientSide = "gtPlusPlus.core.proxy.ClientProxy", serverSide = "gtPlusPlus.core.proxy.ServerProxy") public static CommonProxy proxy; @@ -113,14 +111,32 @@ public class GTplusplus implements ActionListener { public static void loadTextures() { Logger.INFO("Loading some textures on the client."); // Tools - Logger.WARNING("Processing texture: " + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); - Logger.WARNING("Processing texture: " + TexturesGtTools.ANGLE_GRINDER.getTextureFile().getResourcePath()); - Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_SNIPS.getTextureFile().getResourcePath()); - Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_LIGHTER.getTextureFile().getResourcePath()); - Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_BUTCHER_KNIFE.getTextureFile().getResourcePath()); + Logger.WARNING( + "Processing texture: " + + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath() + ); + Logger.WARNING( + "Processing texture: " + + TexturesGtTools.ANGLE_GRINDER.getTextureFile().getResourcePath() + ); + Logger.WARNING( + "Processing texture: " + + TexturesGtTools.ELECTRIC_SNIPS.getTextureFile().getResourcePath() + ); + Logger.WARNING( + "Processing texture: " + + TexturesGtTools.ELECTRIC_LIGHTER.getTextureFile().getResourcePath() + ); + Logger.WARNING( + "Processing texture: " + + TexturesGtTools.ELECTRIC_BUTCHER_KNIFE.getTextureFile().getResourcePath() + ); // Blocks - Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); + Logger.WARNING( + "Processing texture: " + + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath() + ); } public GTplusplus() { @@ -132,35 +148,45 @@ public class GTplusplus implements ActionListener { @Mod.EventHandler public void preInit(final FMLPreInitializationEvent event) { INIT_PHASE.PRE_INIT.setPhaseActive(true); - Logger.INFO("Loading " + CORE.name + " "+CORE.VERSION+" on Gregtech "+Utils.getGregtechVersionAsString()); - //Load all class objects within the plugin package. + Logger.INFO( + "Loading " + CORE.name + " " + CORE.VERSION + " on Gregtech " + + Utils.getGregtechVersionAsString() + ); + // Load all class objects within the plugin package. Core_Manager.veryEarlyInit(); PacketHandler.init(); - if(!Utils.isServer()){ + if (!Utils.isServer()) { enableCustomCapes = true; } - //Give this a go mate. - //initAnalytics(); + // Give this a go mate. + // initAnalytics(); setupMaterialBlacklist(); - //setupMaterialWhitelist(); + // setupMaterialWhitelist(); - //HTTP Requests + // HTTP Requests if (CORE.ConfigSwitches.enableUpdateChecker) { - CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); + CORE.MASTER_VERSION = NetworkUtils.getContentFromURL( + "https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt" + ).toLowerCase(); CORE.USER_COUNTRY = GeoUtils.determineUsersCountry(); } // Handle GT++ Config - ConfigHandler.handleConfigFile(event); - - //Check for Dev - CORE.DEVENV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); - if (enableUpdateChecker){ - Logger.INFO("Latest is " + CORE.MASTER_VERSION + ". Updated? " + Utils.isModUpToDate()); + ConfigHandler.handleConfigFile(event); + + // Check for Dev + CORE.DEVENV = (Boolean) Launch.blackboard.get( + "fml.deobfuscatedEnvironment" + ); + if (enableUpdateChecker) { + Logger.INFO( + "Latest is " + CORE.MASTER_VERSION + ". Updated? " + + Utils.isModUpToDate() + ); } - //Utils.LOG_INFO("User's Country: " + CORE.USER_COUNTRY); + // Utils.LOG_INFO("User's Country: " + CORE.USER_COUNTRY); Utils.registerEvent(new LoginEventHandler()); Utils.registerEvent(new MissingMappingsEvent()); @@ -182,7 +208,7 @@ public class GTplusplus implements ActionListener { Meta_GT_Proxy.init(); Core_Manager.init(); - //Used by foreign players to generate .lang files for translation. + // Used by foreign players to generate .lang files for translation. if (CORE.ConfigSwitches.dumpItemAndBlockData) { LocaleUtils.generateFakeLocaleFile(); } @@ -198,21 +224,32 @@ public class GTplusplus implements ActionListener { BookHandler.runLater(); Meta_GT_Proxy.postInit(); Core_Manager.postInit(); - //SprinklerHandler.registerModFerts(); + // SprinklerHandler.registerModFerts(); ItemGiantEgg.postInit(ModItems.itemBigEgg); BlockEventHandler.init(); - GTPP_Recipe.reInit(); - - Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Logger.INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: " - + RegistrationHandler.recipesFailed + " |"); - Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Logger.INFO("Finally, we are finished. Have some cripsy bacon as a reward."); + GTPP_Recipe.reInit(); + + Logger.INFO( + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ); + Logger.INFO( + "| Recipes succesfully Loaded: " + + RegistrationHandler.recipesSuccess + " | Failed: " + + RegistrationHandler.recipesFailed + " |" + ); + Logger.INFO( + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ); + Logger.INFO( + "Finally, we are finished. Have some cripsy bacon as a reward." + ); } @EventHandler - public synchronized void serverStarting(final FMLServerStartingEvent event) { + public synchronized void serverStarting( + final FMLServerStartingEvent event + ) { INIT_PHASE.SERVER_START.setPhaseActive(true); event.registerServerCommand(new CommandMath()); event.registerServerCommand(new CommandEnableDebugWhileRunning()); @@ -228,7 +265,9 @@ public class GTplusplus implements ActionListener { } @Mod.EventHandler - public synchronized void serverStopping(final FMLServerStoppingEvent event) { + public synchronized void serverStopping( + final FMLServerStoppingEvent event + ) { Core_Manager.serverStop(); if (GregtechBufferThread.mBufferThreadAllocation.size() > 0) { for (GregtechBufferThread i : GregtechBufferThread.mBufferThreadAllocation.values()) { @@ -244,11 +283,16 @@ public class GTplusplus implements ActionListener { } - /** - * This {@link EventHandler} is called after the {@link FMLPostInitializationEvent} stages of all loaded mods executes successfully. - * {@link #onLoadComplete(FMLLoadCompleteEvent)} exists to inject recipe generation after Gregtech and all other mods are entirely loaded and initialized. - * @param event - The {@link EventHandler} object passed through from FML to {@link #GTplusplus()}'s {@link #instance}. + * This {@link EventHandler} is called after the + * {@link FMLPostInitializationEvent} stages of all loaded mods executes + * successfully. {@link #onLoadComplete(FMLLoadCompleteEvent)} exists to + * inject recipe generation after Gregtech and all other mods are entirely + * loaded and initialized. + * + * @param event + * - The {@link EventHandler} object passed through from FML to + * {@link #GTplusplus()}'s {@link #instance}. */ @Mod.EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { @@ -259,17 +303,19 @@ public class GTplusplus implements ActionListener { Logger.INFO("Passed verification checks."); } - @Mod.EventHandler - public void onIDChangingEvent(FMLModIdMappingEvent aEvent) { - GTPP_Recipe.reInit(); - } + @Mod.EventHandler + public void onIDChangingEvent(FMLModIdMappingEvent aEvent) { + GTPP_Recipe.reInit(); + } public static void tryPatchTurbineTextures() { if (enableAnimatedTurbines) { BlockIcons h = Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE; BlockIcons h2 = Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE; - try { - Logger.INFO("Trying to patch GT textures to make Turbines animated."); + try { + Logger.INFO( + "Trying to patch GT textures to make Turbines animated." + ); IIcon aIcon = TexturesGtBlock.Overlay_Machine_Turbine_Active.getIcon(); if (ReflectionUtils.setField(h, "mIcon", aIcon)) { Logger.INFO("Patched Gas Turbine Icon."); @@ -286,16 +332,33 @@ public class GTplusplus implements ActionListener { protected void generateGregtechRecipeMaps() { - int[] mValidCount = new int[] {0, 0, 0}; - int[] mInvalidCount = new int[] {0, 0, 0}; - int[] mOriginalCount = new int[] {0, 0, 0}; + int[] mValidCount = new int[]{ + 0, 0, 0 + }; + int[] mInvalidCount = new int[]{ + 0, 0, 0 + }; + int[] mOriginalCount = new int[]{ + 0, 0, 0 + }; RecipeGen_BlastSmelterGT_GTNH.generateGTNHBlastSmelterRecipesFromEBFList(); - FishPondFakeRecipe.generateFishPondRecipes(); + FishPondFakeRecipe.generateFishPondRecipes(); GregtechMiniRaFusion.generateSlowFusionrecipes(); SemiFluidFuelHandler.generateFuels(); GregtechMTE_ChemicalPlant.generateRecipes(); + mInvalidCount[0] = RecipeGen_MultisUsingFluidInsteadOfCells.generateRecipesNotUsingCells( + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes, GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT + ); + mInvalidCount[1] = RecipeGen_MultisUsingFluidInsteadOfCells.generateRecipesNotUsingCells( + GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes, GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT + ); + mInvalidCount[2] = RecipeGen_MultisUsingFluidInsteadOfCells.generateRecipesNotUsingCells( + GT_Recipe.GT_Recipe_Map.sVacuumRecipes, GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT + ); + /* + //Large Centrifuge generation mOriginalCount[0] = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(); for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList) { @@ -320,13 +383,13 @@ public class GTplusplus implements ActionListener { mInvalidCount[0]++; } } - - /*if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mRecipeList.size() < 1) { + + if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mRecipeList.size() < 1) { for (GT_Recipe a : GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mRecipeList) { GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.add(a); } - }*/ - + } + //Large Electrolyzer generation mOriginalCount[1] = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(); for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList) { @@ -351,13 +414,13 @@ public class GTplusplus implements ActionListener { mInvalidCount[1]++; } } - - /*if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList.size() < 1) { + + if (GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList.size() < 1) { for (GT_Recipe a : GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mRecipeList) { GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.add(a); } - }*/ - + } + //Advanced Vacuum Freezer generation mOriginalCount[2] = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.mRecipeList.size(); for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sVacuumRecipes.mRecipeList) { @@ -375,15 +438,15 @@ public class GTplusplus implements ActionListener { mInvalidCount[2]++; } } - + //Redo plasma recipes in Adv. Vac. //Meta_GT_Proxy.generatePlasmaRecipesForAdvVacFreezer(); - - + + String[] machineName = new String[] {"Centrifuge", "Electrolyzer", "Vacuum Freezer"}; for (int i=0;i<3;i++) { Logger.INFO("[Recipe] Generated "+mValidCount[i]+" recipes for the Industrial "+machineName[i]+". The original machine can process "+mOriginalCount[i]+" recipes, meaning "+mInvalidCount[i]+" are invalid for this Multiblock's processing in some way."); - } + }*/ } protected void dumpGtRecipeMap(final GT_Recipe_Map r) { @@ -391,29 +454,43 @@ public class GTplusplus implements ActionListener { Logger.INFO("Dumping " + r.mUnlocalizedName + " Recipes for Debug."); for (final GT_Recipe newBo : x) { Logger.INFO("========================"); - Logger.INFO("Dumping Input: " + ItemUtils.getArrayStackNames(newBo.mInputs)); - Logger.INFO("Dumping Inputs " + ItemUtils.getFluidArrayStackNames(newBo.mFluidInputs)); + Logger.INFO( + "Dumping Input: " + + ItemUtils.getArrayStackNames(newBo.mInputs) + ); + Logger.INFO( + "Dumping Inputs " + ItemUtils.getFluidArrayStackNames( + newBo.mFluidInputs + ) + ); Logger.INFO("Dumping Duration: " + newBo.mDuration); Logger.INFO("Dumping EU/t: " + newBo.mEUt); - Logger.INFO("Dumping Output: " + ItemUtils.getArrayStackNames(newBo.mOutputs)); - Logger.INFO("Dumping Output: " + ItemUtils.getFluidArrayStackNames(newBo.mFluidOutputs)); + Logger.INFO( + "Dumping Output: " + + ItemUtils.getArrayStackNames(newBo.mOutputs) + ); + Logger.INFO( + "Dumping Output: " + ItemUtils.getFluidArrayStackNames( + newBo.mFluidOutputs + ) + ); Logger.INFO("========================"); } } - private static final boolean setupMaterialBlacklist(){ + private static final boolean setupMaterialBlacklist() { Material.invalidMaterials.put(Materials._NULL); Material.invalidMaterials.put(Materials.Clay); Material.invalidMaterials.put(Materials.Phosphorus); Material.invalidMaterials.put(Materials.Steel); Material.invalidMaterials.put(Materials.Bronze); Material.invalidMaterials.put(Materials.Hydrogen); - //Infused TC stuff - Material.invalidMaterials.put(Materials.InfusedAir); - Material.invalidMaterials.put(Materials.InfusedEarth); - Material.invalidMaterials.put(Materials.InfusedFire); + // Infused TC stuff + Material.invalidMaterials.put(Materials.InfusedAir); + Material.invalidMaterials.put(Materials.InfusedEarth); + Material.invalidMaterials.put(Materials.InfusedFire); Material.invalidMaterials.put(Materials.InfusedWater); - //EIO Materials + // EIO Materials Material.invalidMaterials.put(Materials.SoulSand); Material.invalidMaterials.put(Materials.EnderPearl); Material.invalidMaterials.put(Materials.EnderEye); @@ -422,7 +499,7 @@ public class GTplusplus implements ActionListener { Material.invalidMaterials.put(Materials.Soularium); Material.invalidMaterials.put(Materials.PhasedIron); - if (Material.invalidMaterials.size() > 0){ + if (Material.invalidMaterials.size() > 0) { return true; } return false; @@ -434,14 +511,14 @@ public class GTplusplus implements ActionListener { mGregMatLoader = new GT_Material_Loader(); - //Non GTNH Materials - if (!CORE.GTNH){ - //Mithril - Random Dungeon Loot - mGregMatLoader.enableMaterial(Materials.Mithril); - } + // Non GTNH Materials + if (!CORE.GTNH) { + // Mithril - Random Dungeon Loot + mGregMatLoader.enableMaterial(Materials.Mithril); + } - //Force - Alloying - mGregMatLoader.enableMaterial(Materials.Force); + // Force - Alloying + mGregMatLoader.enableMaterial(Materials.Force); } } diff --git a/src/Java/gtPlusPlus/core/handler/BookHandler.java b/src/Java/gtPlusPlus/core/handler/BookHandler.java index 13c57677a0..4bfd39e9a3 100644 --- a/src/Java/gtPlusPlus/core/handler/BookHandler.java +++ b/src/Java/gtPlusPlus/core/handler/BookHandler.java @@ -249,7 +249,8 @@ public class BookHandler { "27x Coils" + "\n" + "18x Pipe Casings" + "\n" + "57x Tiered Machine Casings" + "\n" + - "80+ Solid Casings", + "80+ Solid Casings" + "\n" + + "1x Catalyst Housing (Catalysts cannot go inside an Input Bus)", // Construction Guide "Construction Guide Pt1:" + "\n" + "\n" + diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index d932f17d8f..633c710461 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -344,7 +344,7 @@ public class RECIPES_GREGTECH { new ItemStack[] { CI.getNumberedAdvancedCircuit(12), CI.getTieredMachineCasing(aLaureniumTier-1), - CI.getPlate(aLaureniumTier-1, 8), + ALLOY.LAURENIUM.getPlate(8), CI.getGear(aLaureniumTier, 2) }, new FluidStack[] { @@ -368,7 +368,7 @@ public class RECIPES_GREGTECH { new ItemStack[] { CI.getNumberedAdvancedCircuit(12), CI.getTieredMachineCasing(aBotmiumTier-1), - CI.getPlate(aBotmiumTier-1, 8), + ALLOY.BOTMIUM.getPlate(8), CI.getGear(aBotmiumTier, 2) }, new FluidStack[] { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java index 23f7b2a6a0..ea74e650dd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java @@ -10,15 +10,15 @@ import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_Catalysts extends GT_MetaTileEntity_Hatch_NbtConsumable { public GT_MetaTileEntity_Hatch_Catalysts(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 7, 16, "Dedicated Catalyst Storage", false); + super(aID, aName, aNameRegional, 0, 16, "Dedicated Catalyst Storage", false); } public GT_MetaTileEntity_Hatch_Catalysts(String aName, String aDescription, ITexture[][][] aTextures) { - super(aName, 7, 16, aDescription, false, aTextures); + super(aName, 0, 16, aDescription, false, aTextures); } public GT_MetaTileEntity_Hatch_Catalysts(String aName, String[] aDescription, ITexture[][][] aTextures) { - super(aName, 7, 16, aDescription[0], false, aTextures); + super(aName, 0, 16, aDescription[0], false, aTextures); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index 4119a0df8c..66620e8109 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -48,9 +48,9 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { private int mCoilTier = 0; private ArrayList<GT_MetaTileEntity_Hatch_Catalysts> mCatalystBuses = new ArrayList<GT_MetaTileEntity_Hatch_Catalysts>(); - + private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>(); - + public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } @@ -58,7 +58,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { public GregtechMTE_ChemicalPlant(final String aName) { super(aName); } - + public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) { int aSize = mTieredBlockRegistry.size(); int aSize2 = aSize; @@ -70,7 +70,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { aSize = mTieredBlockRegistry.size(); return aSize > aSize2; } - + private static Block getBlockForTier(int aTier) { if (!mTieredBlockRegistry.containsKey(aTier)) { return Blocks.bedrock; @@ -142,6 +142,9 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { + if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) { + generateRecipes(); + } return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT; } @@ -368,6 +371,10 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { log("Not enough coils. Found "+aCoilCount+", require: 27."); return false; } + /*if (mCatalystBuses.size() != 1) { + log("A Catalyst Bus is Required."); + return false; + }*/ log("Structure Check Complete!"); @@ -761,34 +768,47 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { long tEnergy = getMaxInputEnergy(); log("Running checkRecipeGeneric(0)"); + //GT_Recipe tRecipe = findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + GT_Recipe tRecipe = findRecipe(mLastRecipe, gregtech.api.enums.GT_Values.V[tTier], getSolidCasingTier(), aItemInputs, aFluidInputs); + + + + + if (tRecipe == null) { + log("BAD RETURN - 1"); + return false; + } + // checks if it has a catalyst with enough durability ItemStack tCatalystRecipe = findCatalyst(aItemInputs); - if (tCatalystRecipe == null) { - log("does not have catalyst"); - return false; + boolean aDoesRecipeNeedCatalyst = false; + for (ItemStack aInputItem : tRecipe.mInputs) { + if (ItemUtils.isCatalyst(aInputItem)) { + aDoesRecipeNeedCatalyst = true; + break; + } + } + if (aDoesRecipeNeedCatalyst) { + if (tCatalystRecipe == null) { + log("does not have catalyst"); + return false; + } + if (mCatalystBuses.size() != 1) { + log("does not have correct number of catalyst hatchs. (Required 1, found "+mCatalystBuses.size()+")"); + return false; + } } - - GT_Recipe tRecipe = findRecipe( - getBaseMetaTileEntity(), mLastRecipe, false, - gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; - - if (tRecipe == null) { - log("BAD RETURN - 1"); - return false; - } - if (tRecipe.mSpecialValue > this.mSolidCasingTier) { log("solid tier is too low"); return false; } - aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); @@ -929,7 +949,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { log("damaging catalyst"); damageCatalyst(tCatalystRecipe, parallelRecipes); } - + // Commit outputs this.mOutputItems = tOutputItems; this.mOutputFluids = tOutputFluids; @@ -942,6 +962,159 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { return true; } + private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>(); + private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>(); + private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>(); + private static boolean mInitRecipeCache = false; + + private static void initRecipeCaches() { + if (!mInitRecipeCache) { + mTieredRecipeMap.put((long) 0, aTier0Recipes); + mTieredRecipeMap.put((long) 1, aTier1Recipes); + mTieredRecipeMap.put((long) 2, aTier2Recipes); + mTieredRecipeMap.put((long) 3, aTier3Recipes); + mTieredRecipeMap.put((long) 4, aTier4Recipes); + mTieredRecipeMap.put((long) 5, aTier5Recipes); + mTieredRecipeMap.put((long) 6, aTier6Recipes); + mTieredRecipeMap.put((long) 7, aTier7Recipes); + for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) { + if (aRecipe != null) { + switch (aRecipe.mSpecialValue) { + case 0: + aTier0Recipes.add(aRecipe); + continue; + case 1: + aTier1Recipes.add(aRecipe); + continue; + case 2: + aTier2Recipes.add(aRecipe); + continue; + case 3: + aTier3Recipes.add(aRecipe); + continue; + case 4: + aTier4Recipes.add(aRecipe); + continue; + case 5: + aTier5Recipes.add(aRecipe); + continue; + case 6: + aTier6Recipes.add(aRecipe); + continue; + case 7: + aTier7Recipes.add(aRecipe); + continue; + } + } + } + mInitRecipeCache = true; + } + } + + private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) { + int aInputCount = aComparator.mInputs.length; + if (aInputCount > 0) { + //Logger.INFO("Looking for recipe with "+aInputCount+" Items"); + int aMatchingInputs = 0; + recipe : for (ItemStack a : aComparator.mInputs) { + for (ItemStack b : aInputs) { + if (a.getItem() == b.getItem()) { + if (a.getItemDamage() == b.getItemDamage()) { + //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName()); + aMatchingInputs++; + continue recipe; + } + } + } + } + if (aMatchingInputs != aInputCount) { + return false; + } + } + int aFluidInputCount = aComparator.mFluidInputs.length; + if (aFluidInputCount > 0) { + //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids"); + int aMatchingFluidInputs = 0; + recipe : for (FluidStack b : aComparator.mFluidInputs) { + //Logger.INFO("Checking for fluid "+b.getLocalizedName()); + for (FluidStack a : aFluids) { + if (GT_Utility.areFluidsEqual(a, b)) { + //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName()); + aMatchingFluidInputs++; + continue recipe; + } + else { + //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName()); + } + } + } + if (aMatchingFluidInputs != aFluidInputCount) { + return false; + } + } + Logger.INFO("Recipes Match!"); + return true; + } + + public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) { + if (!mInitRecipeCache) { + initRecipeCaches(); + } + if (this.getRecipeMap().mRecipeList.isEmpty()) { + log("No Recipes in Map to search through."); + return null; + } + else { + log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V."); + log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids."); + // Try check the cached recipe first + if (aRecipe != null) { + if (areInputsEqual(aRecipe, aInputs, aFluids)) { + if (aRecipe.mEUt <= aVoltage) { + Logger.INFO("Using cached recipe."); + return aRecipe; + } + } + } + + // Get all recipes for the tier + AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>(); + for (long i=0;i<=aSpecialValue;i++) { + aMasterMap.add(mTieredRecipeMap.get(i)); + } + GT_Recipe aFoundRecipe = null; + + // Iterate the tiers recipes until we find the one with all inputs matching + master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) { + for (GT_Recipe aRecipeToCheck : aTieredMap) { + if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) { + log("Found recipe with matching inputs!"); + if (aRecipeToCheck.mSpecialValue <= aSpecialValue) { + if (aRecipeToCheck.mEUt <= aVoltage) { + aFoundRecipe = aRecipeToCheck; + break master; + } + } + } + } + } + + // If we found a recipe, return it + if (aFoundRecipe != null) { + log("Found valid recipe."); + return aFoundRecipe; + } + } + log("Did not find valid recipe."); + return null; + } + private int getCatalysts(ItemStack[] aItemInputs, ItemStack aRecipeCatalyst, int aMaxParrallel, ArrayList<ItemStack> aOutPut) { int allowedParrallel = 0; for (final ItemStack aInput : aItemInputs) { @@ -986,8 +1159,8 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { log("not consuming catalyst"); } } - - + + } @@ -1041,18 +1214,18 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { /* * Catalyst Handling */ - - + + @Override - public ArrayList<ItemStack> getStoredInputs() { + public ArrayList<ItemStack> getStoredInputs() { ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_Catalysts tHatch : mCatalystBuses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - tItems.addAll(tHatch.getContentUsageSlots()); - } - } + for (GT_MetaTileEntity_Hatch_Catalysts tHatch : mCatalystBuses) { + tHatch.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + tItems.addAll(tHatch.getContentUsageSlots()); + } + } return tItems; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java new file mode 100644 index 0000000000..b94dbfa51f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java @@ -0,0 +1,182 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.util.GTPP_Recipe; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class RecipeGen_MultisUsingFluidInsteadOfCells { + + + private static ItemStack mEmptyCell; + private static AutoMap<ItemStack> mItemsToIgnore = new AutoMap<ItemStack>(); + private static boolean mInit = false; + + private static void init() { + if (!mInit) { + mInit = true; + mItemsToIgnore.add(ItemUtils.simpleMetaStack(CI.emptyCells(1).getItem(), 8, 1)); + + + } + } + + private static boolean doesItemMatchIgnoringStackSize(ItemStack a, ItemStack b) { + if (a == null || b == null) { + return false; + } + if (a.getItem() == b.getItem()) { + if (a.getItemDamage() == b.getItemDamage()) { + return true; + } + } + return false; + } + + private static boolean isEmptyCell(ItemStack aCell) { + if (aCell == null) { + return false; + } + if (mEmptyCell == null) { + mEmptyCell = CI.emptyCells(1); + } + if (mEmptyCell != null) { + ItemStack aTempStack = mEmptyCell.copy(); + aTempStack.stackSize = aCell.stackSize; + if (GT_Utility.areStacksEqual(aTempStack, aCell)) { + return true; + } + } + return false; + } + + private synchronized static FluidStack getFluidFromItemStack(final ItemStack ingot) { + if (ingot == null) { + return null; + } + FluidStack aFluid = GT_Utility.getFluidForFilledItem(ingot, true); + if (aFluid != null) { + return aFluid; + } + return null; + } + + public synchronized static int generateRecipesNotUsingCells(GT_Recipe_Map aInputs, GTPP_Recipe_Map_Internal aOutputs) { + init(); + int aRecipesHandled = 0; + int aInvalidRecipesToConvert = 0; + int aOriginalCount = aInputs.mRecipeList.size(); + + recipe : for (GT_Recipe x : aInputs.mRecipeList) { + if (x != null) { + + ItemStack[] aInputItems = x.mInputs.clone(); + ItemStack[] aOutputItems = x.mOutputs.clone(); + FluidStack[] aInputFluids = x.mFluidInputs.clone(); + FluidStack[] aOutputFluids = x.mFluidOutputs.clone(); + + AutoMap<ItemStack> aInputItemsMap = new AutoMap<ItemStack>(); + AutoMap<ItemStack> aOutputItemsMap = new AutoMap<ItemStack>(); + AutoMap<FluidStack> aInputFluidsMap = new AutoMap<FluidStack>(); + AutoMap<FluidStack> aOutputFluidsMap = new AutoMap<FluidStack>(); + + // Iterate Inputs, Convert valid items into fluids + inputs : for (ItemStack aInputStack : aInputItems) { + FluidStack aFoundFluid = getFluidFromItemStack(aInputStack); + if (aFoundFluid == null) { + for (ItemStack aBadStack : mItemsToIgnore) { + if (doesItemMatchIgnoringStackSize(aInputStack, aBadStack)) { + continue recipe; // Skip this recipe entirely if we find an item we don't like + } + } + if (!isEmptyCell(aInputStack)) { + aInputItemsMap.add(aInputStack); + } + } + else { + aFoundFluid.amount = aFoundFluid.amount * aInputStack.stackSize; + aInputFluidsMap.add(aFoundFluid); + } + } + // Iterate Outputs, Convert valid items into fluids + outputs: for (ItemStack aOutputStack : aOutputItems) { + FluidStack aFoundFluid = getFluidFromItemStack(aOutputStack); + if (aFoundFluid == null) { + for (ItemStack aBadStack : mItemsToIgnore) { + if (doesItemMatchIgnoringStackSize(aOutputStack, aBadStack)) { + continue recipe; // Skip this recipe entirely if we find an item we don't like + } + } + if (!isEmptyCell(aOutputStack)) { + aOutputItemsMap.add(aOutputStack); + } + } + else { + aFoundFluid.amount = aFoundFluid.amount * aOutputStack.stackSize; + aOutputFluidsMap.add(aFoundFluid); + } + } + // Add Input fluids second + for (FluidStack aInputFluid : aInputFluids) { + aInputFluidsMap.add(aInputFluid); + } + // Add Output fluids second + for (FluidStack aOutputFluid : aOutputFluids) { + aOutputFluidsMap.add(aOutputFluid); + } + + // Make some new Arrays + ItemStack[] aNewItemInputs = new ItemStack[aInputItemsMap.size()]; + ItemStack[] aNewItemOutputs = new ItemStack[aOutputItemsMap.size()]; + FluidStack[] aNewFluidInputs = new FluidStack[aInputFluidsMap.size()]; + FluidStack[] aNewFluidOutputs = new FluidStack[aOutputFluidsMap.size()]; + + // Add AutoMap contents to Arrays + for (int i = 0; i < aInputItemsMap.size(); i++) { + aNewItemInputs[i] = aInputItemsMap.get(i); + } + for (int i = 0; i < aOutputItemsMap.size(); i++) { + aNewItemOutputs[i] = aOutputItemsMap.get(i); + } + for (int i = 0; i < aInputFluidsMap.size(); i++) { + aNewFluidInputs[i] = aInputFluidsMap.get(i); + } + for (int i = 0; i < aOutputFluidsMap.size(); i++) { + aNewFluidOutputs[i] = aOutputFluidsMap.get(i); + } + + // Add Recipe to map + GT_Recipe aNewRecipe = new GTPP_Recipe( + false, + aNewItemInputs, + aNewItemOutputs, + x.mSpecialItems, + x.mChances, + aNewFluidInputs, + aNewFluidOutputs, + x.mDuration, + x.mEUt, + x.mSpecialValue); + aOutputs.add(aNewRecipe); + aRecipesHandled++; + } + else { + aInvalidRecipesToConvert++; + } + } + + Logger.INFO("Generated Recipes for "+aOutputs.mNEIName); + Logger.INFO("Original Map contains "+aOriginalCount+" recipes."); + Logger.INFO("Output Map contains "+aRecipesHandled+" recipes."); + Logger.INFO("There were "+aInvalidRecipesToConvert+" invalid recipes."); + return aRecipesHandled; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java index d3c1368ad3..d2087b22f4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java @@ -41,11 +41,18 @@ public class GregtechSimpleWasher { } private static boolean generateDirtyDustRecipes(){ + boolean disablePlat = CORE.GTNH; int mRecipeCount = 0; // Generate Recipe Map for the Dust Washer. ItemStack dustClean; ItemStack dustDirty; - for (Materials v : Materials.values()) { + for (Materials v : Materials.values()) { + if (disablePlat) { + if (v == Materials.Platinum || v == Materials.Osmium || v == Materials.Iridium || v == Materials.Palladium) { + continue; + } + } + dustClean = GT_OreDictUnificator.get(OrePrefixes.dust, v, 1L); dustDirty = GT_OreDictUnificator.get(OrePrefixes.dustImpure, v, 1L); if (dustClean != null && dustDirty != null) { |