From 3ee18ca5551f4bde620e79082b9854bfbf76ab83 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sun, 25 Sep 2016 00:25:15 +0100 Subject: [PATCH] Cleanup, disable auto TE recipes with config and fixes --- src/main/java/gregtech/GT_Mod.java | 4 - .../java/gregtech/api/enums/Materials.java | 4 +- .../java/gregtech/api/enums/OrePrefixes.java | 89 +++++++++---------- .../api/items/GT_MetaGenerated_Item_X32.java | 4 +- .../java/gregtech/api/objects/ItemData.java | 2 +- .../java/gregtech/api/util/GT_ModHandler.java | 15 ++-- .../api/util/GT_OreDictUnificator.java | 8 +- .../common/GT_Worldgen_GT_Ore_Layer.java | 34 +++---- .../materialprocessing/ProcessingConfig.java | 24 ++--- .../preload/GT_Loader_MaterialProcessing.java | 11 --- 10 files changed, 89 insertions(+), 106 deletions(-) delete mode 100644 src/main/java/gregtech/loaders/preload/GT_Loader_MaterialProcessing.java diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 46b8b1cd..c6c99844 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -262,11 +262,7 @@ public class GT_Mod implements IGT_Mod { } } //GT_Config.troll = (Calendar.getInstance().get(2) + 1 == 4) && (Calendar.getInstance().get(5) >= 1) && (Calendar.getInstance().get(5) <= 2); - new GT_Loader_MaterialProcessing().run(); - long startTime = System.nanoTime(); Materials.init(); - long stopTime = System.nanoTime(); - System.out.println("##### Mats Init: " + (stopTime - startTime)); GT_Log.out.println("GT_Mod: Saving Main Config"); tMainConfig.save(); diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index f6d6d9a2..b015e994 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -11,6 +11,7 @@ import gregtech.api.objects.GT_FluidStack; import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import gregtech.loaders.materialprocessing.ProcessingConfig; import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -1333,6 +1334,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } public static void init() { + new ProcessingConfig(); for (IMaterialHandler aRegistrator : mMaterialHandlers) { aRegistrator.onMaterialsInit(); //This is where addon mods can add/manipulate materials } @@ -1340,7 +1342,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { MATERIALS_ARRAY = MATERIALS_MAP.values().toArray(new Materials[MATERIALS_MAP.size()]); //Generate standard object array. This is a lot faster to loop over. OrePrefixes.initMaterialComponents(); for (Materials aMaterial : MATERIALS_ARRAY) { - if (aMaterial.mMetaItemSubID >= 0 /*&& OrePrefixes.ore.isComponentEnabled(aMaterial)*/) { + if (aMaterial.mMetaItemSubID >= 0) { if (aMaterial.mMetaItemSubID < 1000) { if (GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] == null) { GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] = aMaterial; diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 001b3734..864c4f6e 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -540,7 +540,7 @@ public enum OrePrefixes { * Negative = Undefined Amount */ public final long mMaterialAmount; - public final Collection mDynamicItems = new HashSet(), mDisabledMaterials = new HashSet(), mNotGeneratedItems = new HashSet(), mIgnoredMaterials = new HashSet(), mGeneratedItems = new HashSet(); + public final Collection mDisabledItems = new HashSet(), mNotGeneratedItems = new HashSet(), mIgnoredMaterials = new HashSet(), mGeneratedItems = new HashSet(); private final ArrayList mOreProcessing = new ArrayList(); public ItemStack mContainerItem = null; public ICondition mCondition = null; @@ -640,23 +640,23 @@ public enum OrePrefixes { //TODO Make sure stuff like gem plates / standard plates / paper plates all generate with the current condition for (Materials aMaterial : Materials.values()) { if (aMaterial.mMetaItemSubID >= 0) { - if (aMaterial.mBlastFurnaceTemp <= 1750) ingotHot.mDisabledMaterials.add(aMaterial); //Moved HotIngot code from GT_MetaGenerated_Item_01 so all this is in once place - if (!enableUnusedSprings && (aMaterial != Materials.Titanium)) spring.mDisabledMaterials.add(aMaterial); - if (!enableUnusedSmallSprings) springSmall.mDisabledMaterials.add(aMaterial); - if (!enableUnusedRounds && (aMaterial != Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.HSSG)) round.mDisabledMaterials.add(aMaterial); + if (aMaterial.mBlastFurnaceTemp <= 1750) ingotHot.mDisabledItems.add(aMaterial); //Moved HotIngot code from GT_MetaGenerated_Item_01 so all this is in once place + if (!enableUnusedSprings && (aMaterial != Materials.Titanium)) spring.mDisabledItems.add(aMaterial); + if (!enableUnusedSmallSprings) springSmall.mDisabledItems.add(aMaterial); + if (!enableUnusedRounds && (aMaterial != Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.HSSG)) round.mDisabledItems.add(aMaterial); if (!enableUnusedCrates) { if (!(aMaterial == Materials.DamascusSteel || aMaterial == Materials.Steel || aMaterial == Materials.Bronze || aMaterial == Materials.Manganese)) - crateGtIngot.mDisabledMaterials.add(aMaterial); + crateGtIngot.mDisabledItems.add(aMaterial); if (!(aMaterial == Materials.Neodymium || aMaterial == Materials.Chrome)) - crateGtDust.mDisabledMaterials.add(aMaterial); - crateGtGem.mDisabledMaterials.add(aMaterial); - crateGtPlate.mDisabledMaterials.add(aMaterial); + crateGtDust.mDisabledItems.add(aMaterial); + crateGtGem.mDisabledItems.add(aMaterial); + crateGtPlate.mDisabledItems.add(aMaterial); } if (!enableUnusedArrows) { - toolHeadArrow.mDisabledMaterials.add(aMaterial); - arrowGtPlastic.mDisabledMaterials.add(aMaterial); + toolHeadArrow.mDisabledItems.add(aMaterial); + arrowGtPlastic.mDisabledItems.add(aMaterial); if (!(aMaterial == Materials.DamascusSteel || aMaterial == Materials.SterlingSilver)) - arrowGtWood.mDisabledMaterials.add(aMaterial); + arrowGtWood.mDisabledItems.add(aMaterial); } //Plates if (!enableUnusedPlates && /*(*/((aMaterial.mTypes & 0x40) == 0) /*|| ((aMaterial.mTypes & 0x04)) == 0)*/ && !(aMaterial == Materials.Silicon || aMaterial == Materials.Zinc || @@ -665,60 +665,60 @@ public enum OrePrefixes { aMaterial == Materials.NiobiumTitanium || aMaterial == Materials.CertusQuartz || aMaterial == Materials.NetherQuartz || aMaterial == Materials.Lazurite || aMaterial == Materials.Lapis || aMaterial == Materials.Paper || aMaterial == Materials.Jasper || aMaterial == Materials.Dilithium || aMaterial == Materials.Forcicium || aMaterial == Materials.Forcillium || aMaterial == Materials.EnderPearl || aMaterial == Materials.EnderEye || aMaterial == Materials.Glass || aMaterial == Materials.Copper)) - plate.mDisabledMaterials.add(aMaterial); + plate.mDisabledItems.add(aMaterial); //Ingot/Plate Storage - if (!enableUnusedDoubleIngots) ingotDouble.mDisabledMaterials.add(aMaterial); - if (!enableUnusedTripleIngots) ingotTriple.mDisabledMaterials.add(aMaterial); - if (!enableUnusedQuadIngots) ingotQuadruple.mDisabledMaterials.add(aMaterial); - if (!enableUnusedQuinIngots) ingotQuintuple.mDisabledMaterials.add(aMaterial); + if (!enableUnusedDoubleIngots) ingotDouble.mDisabledItems.add(aMaterial); + if (!enableUnusedTripleIngots) ingotTriple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuadIngots) ingotQuadruple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuinIngots) ingotQuintuple.mDisabledItems.add(aMaterial); if (!enableUnusedDoublePlates && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Paper || aMaterial == Materials.Aluminium || aMaterial == Materials.Steel || aMaterial == Materials.TungstenSteel)) - plateDouble.mDisabledMaterials.add(aMaterial); - if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledMaterials.add(aMaterial); - if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) plateQuadruple.mDisabledMaterials.add(aMaterial); - if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledMaterials.add(aMaterial); + plateDouble.mDisabledItems.add(aMaterial); + if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) plateQuadruple.mDisabledItems.add(aMaterial); + if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledItems.add(aMaterial); if (!enableUnusedDensePlates && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper)) - plateDense.mDisabledMaterials.add(aMaterial); + plateDense.mDisabledItems.add(aMaterial); //Rotors if (!enableUnusedRotors && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Bronze || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) - rotor.mDisabledMaterials.add(aMaterial); + rotor.mDisabledItems.add(aMaterial); //Rings if (!enableUnusedRings && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.Rubber || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.HSSG || aMaterial == Materials.Aluminium)) - ring.mDisabledMaterials.add(aMaterial); + ring.mDisabledItems.add(aMaterial); //Foil if (!enableUnusedFoil && !(aMaterial == Materials.Zinc || aMaterial == Materials.Aluminium || aMaterial == Materials.Silicon || aMaterial == Materials.Gold || aMaterial == Materials.Electrum || aMaterial == Materials.Platinum || aMaterial == Materials.Osmiridium || aMaterial == Materials.Osmium || aMaterial == Materials.AnnealedCopper || aMaterial == Materials.Steel || aMaterial == Materials.Copper)) - foil.mDisabledMaterials.add(aMaterial); + foil.mDisabledItems.add(aMaterial); //Fine Wire if (!enableUnusedFineWires && !(aMaterial == Materials.Steel || aMaterial == Materials.AnnealedCopper || aMaterial == Materials.Platinum || aMaterial == Materials.Osmium)) - wireFine.mDisabledMaterials.add(aMaterial); + wireFine.mDisabledItems.add(aMaterial); //Gears if (!enableUnusedGears && !(aMaterial == Materials.Aluminium || aMaterial == Materials.Titanium || aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Tin || aMaterial == Materials.Gold || aMaterial == Materials.Stone || aMaterial == Materials.Bronze || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.TungstenSteel || aMaterial == Materials.CobaltBrass || aMaterial == Materials.Diamond || aMaterial == Materials.Wood || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) - gearGt.mDisabledMaterials.add(aMaterial); + gearGt.mDisabledItems.add(aMaterial); //Small Gears if (!enableUnusedSmallGears && !(aMaterial == Materials.Aluminium || aMaterial == Materials.Titanium || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium)) - gearGtSmall.mDisabledMaterials.add(aMaterial); + gearGtSmall.mDisabledItems.add(aMaterial); //Bolts if (!enableUnusedBolts && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSE || aMaterial == Materials.HSSG)) - bolt.mDisabledMaterials.add(aMaterial); + bolt.mDisabledItems.add(aMaterial); //Screws if (!enableUnusedScrews && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || aMaterial == Materials.Bronze || aMaterial == Materials.WroughtIron || aMaterial == Materials.Steel || aMaterial == Materials.StainlessSteel || aMaterial == Materials.PigIron || aMaterial == Materials.TungstenSteel || aMaterial == Materials.HSSE || aMaterial == Materials.HSSG)) - screw.mDisabledMaterials.add(aMaterial); + screw.mDisabledItems.add(aMaterial); //Rods if (!enableUnusedRods && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Iron || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || aMaterial == Materials.Iridium || aMaterial == Materials.Neutronium || @@ -730,19 +730,19 @@ public enum OrePrefixes { aMaterial == Materials.Electrum || aMaterial == Materials.NaquadahEnriched || aMaterial == Materials.CobaltBrass || aMaterial == Materials.IronMagnetic || aMaterial == Materials.SteelMagnetic || aMaterial == Materials.NeodymiumMagnetic || aMaterial == Materials.VanadiumGallium || aMaterial == Materials.Diamond || aMaterial == Materials.Wood || aMaterial == Materials.Plastic)) - stick.mDisabledMaterials.add(aMaterial); + stick.mDisabledItems.add(aMaterial); //Long Rods if (!enableUnusedLongRods && ((aMaterial.mTypes & 0x40) == 0) && !(aMaterial == Materials.Titanium || aMaterial == Materials.NeodymiumMagnetic || aMaterial == Materials.HSSG || aMaterial == Materials.HSSE || aMaterial == Materials.Neutronium || aMaterial == Materials.Americium || aMaterial == Materials.WroughtIron || aMaterial == Materials.Magnalium || aMaterial == Materials.TungstenSteel)) - stickLong.mDisabledMaterials.add(aMaterial); + stickLong.mDisabledItems.add(aMaterial); if (!enableUnusedGems && ((aMaterial.mTypes & 0x04) == 0)) { - gem.mDisabledMaterials.add(aMaterial); - gemChipped.mDisabledMaterials.add(aMaterial); - gemFlawless.mDisabledMaterials.add(aMaterial); - gemFlawed.mDisabledMaterials.add(aMaterial); - gemExquisite.mDisabledMaterials.add(aMaterial); + gem.mDisabledItems.add(aMaterial); + gemChipped.mDisabledItems.add(aMaterial); + gemFlawless.mDisabledItems.add(aMaterial); + gemFlawed.mDisabledItems.add(aMaterial); + gemExquisite.mDisabledItems.add(aMaterial); //3685 } @@ -754,11 +754,11 @@ public enum OrePrefixes { aConfigPathSB.append("materialcomponents.").append(aMaterial.mConfigSection).append(".").append(aMaterial.mName); String aConfigPath = aConfigPathSB.toString(); for (OrePrefixes aPrefix : Materials.mDefaultComponents) { - boolean aEnableComponent = GregTech_API.sMaterialComponents.get(aConfigPath, aPrefix.toString(), !aPrefix.mDisabledMaterials.contains(aMaterial)); + boolean aEnableComponent = GregTech_API.sMaterialComponents.get(aConfigPath, aPrefix.toString(), !aPrefix.mDisabledItems.contains(aMaterial)); if (!aEnableComponent) { //Disable component if false and is not already in disabled list - if (!aPrefix.mDisabledMaterials.contains(aMaterial)) aPrefix.mDisabledMaterials.remove(aMaterial); + if (!aPrefix.mDisabledItems.contains(aMaterial)) aPrefix.mDisabledItems.remove(aMaterial); } else if (aEnableComponent) { //Enable component if true and is not already in enabled list - if (aPrefix.mDisabledMaterials.contains(aMaterial)) aPrefix.mDisabledMaterials.remove(aMaterial); + if (aPrefix.mDisabledItems.contains(aMaterial)) aPrefix.mDisabledItems.remove(aMaterial); } } aConfigPathSB.setLength(0); @@ -835,7 +835,7 @@ public enum OrePrefixes { } public boolean doGenerateItem(Materials aMaterial) { - return aMaterial != null && aMaterial != Materials._NULL && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 || mGeneratedItems.contains(aMaterial) /*|| mDynamicItems.contains(aMaterial)*/) && !mNotGeneratedItems.contains(aMaterial) && !mDisabledMaterials.contains(aMaterial) && (mCondition == null || mCondition.isTrue(aMaterial)); + return aMaterial != null && aMaterial != Materials._NULL && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 || mGeneratedItems.contains(aMaterial) /*|| mDynamicItems.contains(aMaterial)*/) && !mNotGeneratedItems.contains(aMaterial) && !mDisabledItems.contains(aMaterial) && (mCondition == null || mCondition.isTrue(aMaterial)); } public boolean ignoreMaterials(Materials... aMaterials) { @@ -860,11 +860,10 @@ public enum OrePrefixes { public void processOre(Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aMaterial != null && (aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { - //if (Materials.mDefaultComponents.contains(this) && this.mDynamicItems.contains(aMaterial)) { - if (Materials.mDefaultComponents.contains(this) && this.mDisabledMaterials.contains(aMaterial)) return; + //if (Materials.mDefaultComponents.contains(this) && !this.mDynamicItems.contains(aMaterial)) return; + if (Materials.mDefaultComponents.contains(this) && this.mDisabledItems.contains(aMaterial)) return; for (IOreRecipeRegistrator tRegistrator : mOreProcessing) { - if (D2) - GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + aMaterial.mName + "' at " + GT_Utility.getClassName(tRegistrator)); + if (D2) GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + aMaterial.mName + "' at " + GT_Utility.getClassName(tRegistrator)); tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); } } diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java index 0106c55f..cadbe685 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item_X32.java @@ -50,7 +50,7 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { if (tPrefix == null) continue; Materials tMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; if (tMaterial == null) continue; - if (doesMaterialAllowGeneration(tPrefix, tMaterial) || (tMaterial == Materials.Cobalt && tPrefix == OrePrefixes.spring)) { + if (doesMaterialAllowGeneration(tPrefix, tMaterial)) { ItemStack tStack = new ItemStack(this, 1, i); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalization(tPrefix, tMaterial, i)); GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / M)); @@ -146,7 +146,7 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item { OrePrefixes aPrefix = mGeneratedPrefixList[i / 1000]; Materials aMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; if (aPrefix != null && aMaterial != null) { - if ((doesMaterialAllowGeneration(aPrefix, aMaterial) || (aMaterial == Materials.Cobalt && aPrefix == OrePrefixes.spring)) && doesShowInCreative(aPrefix, aMaterial, GregTech_API.sDoShowAllItemsInCreative)) { + if (doesMaterialAllowGeneration(aPrefix, aMaterial) && doesShowInCreative(aPrefix, aMaterial, GregTech_API.sDoShowAllItemsInCreative)) { ItemStack tStack = new ItemStack(this, 1, i); isItemStackUsable(tStack); aList.add(tStack); diff --git a/src/main/java/gregtech/api/objects/ItemData.java b/src/main/java/gregtech/api/objects/ItemData.java index 8a47867a..3ca1fad5 100644 --- a/src/main/java/gregtech/api/objects/ItemData.java +++ b/src/main/java/gregtech/api/objects/ItemData.java @@ -119,6 +119,6 @@ public class ItemData { @Override public String toString() { if (mPrefix == null || mMaterial == null || mMaterial.mMaterial == null) return ""; - return String.valueOf(new StringBuilder().append(mPrefix.name()).append(mMaterial.mMaterial.mName())); + return String.valueOf(new StringBuilder().append(mPrefix.name()).append(mMaterial.mMaterial.mName)); } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 070f748b..1bedd81e 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -457,7 +457,7 @@ public class GT_ModHandler { public static boolean addLiquidTransposerRecipe(ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { aFullContainer = GT_OreDictUnificator.get(true, aFullContainer); if (aEmptyContainer == null || aFullContainer == null || aLiquid == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposer, aFullContainer, true)) + if (!GT_Mod.gregtechproxy.mTEMachineRecipes && !GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposer, aFullContainer, true)) return false; try { ThermalExpansion.addTransposerFill(aMJ * 10, aEmptyContainer, aFullContainer, aLiquid, true); @@ -471,7 +471,7 @@ public class GT_ModHandler { public static boolean addLiquidTransposerFillRecipe(ItemStack aEmptyContainer, FluidStack aLiquid, ItemStack aFullContainer, int aMJ) { aFullContainer = GT_OreDictUnificator.get(true, aFullContainer); if (aEmptyContainer == null || aFullContainer == null || aLiquid == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposerfilling, aFullContainer, true)) + if (!GT_Mod.gregtechproxy.mTEMachineRecipes && !GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposerfilling, aFullContainer, true)) return false; try { ThermalExpansion.addTransposerFill(aMJ * 10, aEmptyContainer, aFullContainer, aLiquid, false); @@ -485,7 +485,7 @@ public class GT_ModHandler { public static boolean addLiquidTransposerEmptyRecipe(ItemStack aFullContainer, FluidStack aLiquid, ItemStack aEmptyContainer, int aMJ) { aEmptyContainer = GT_OreDictUnificator.get(true, aEmptyContainer); if (aFullContainer == null || aEmptyContainer == null || aLiquid == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposeremptying, aFullContainer, true)) + if (!GT_Mod.gregtechproxy.mTEMachineRecipes && !GregTech_API.sRecipeFile.get(ConfigCategories.Machines.liquidtransposeremptying, aFullContainer, true)) return false; try { ThermalExpansion.addTransposerExtract(aMJ * 10, aFullContainer, aEmptyContainer, aLiquid, 100, false); @@ -563,8 +563,9 @@ public class GT_ModHandler { RA.addPulveriserRecipe(aInput, new ItemStack[]{aOutput1, aOutput2, aOutput3}, new int[]{10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, 400, 2); if (!OrePrefixes.log.contains(aInput)) { + boolean aEnableTEMachineRecipes = GT_Mod.gregtechproxy.mTEMachineRecipes; if (Materials.Wood.contains(aOutput1)) { - if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.pulverization, aInput, true)) { + if (aEnableTEMachineRecipes && GregTech_API.sRecipeFile.get(ConfigCategories.Machines.pulverization, aInput, true)) { if (aOutput2 == null) ThermalExpansion.addSawmillRecipe(32000, GT_Utility.copy(aInput), GT_Utility.copy(aOutput1)); else @@ -583,7 +584,7 @@ public class GT_ModHandler { } } catch (Throwable e) {/*Do nothing*/} } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.pulverization, aInput, true)) { + if (aEnableTEMachineRecipes && GregTech_API.sRecipeFile.get(ConfigCategories.Machines.pulverization, aInput, true)) { if (aOutput2 == null) ThermalExpansion.addPulverizerRecipe(32000, GT_Utility.copy(aInput), GT_Utility.copy(aOutput1)); else @@ -627,7 +628,7 @@ public class GT_ModHandler { aOutput1 = GT_OreDictUnificator.get(true, aOutput1); aOutput2 = GT_OreDictUnificator.get(true, aOutput2); if (aInput1 == null || aOutput1 == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.sawmill, aInput1, true)) return false; + if (!GT_Mod.gregtechproxy.mTEMachineRecipes && !GregTech_API.sRecipeFile.get(ConfigCategories.Machines.sawmill, aInput1, true)) return false; try { ThermalExpansion.addSawmillRecipe(1600, aInput1, aOutput1, aOutput2, 100); } catch (Throwable e) {/*Do nothing*/} @@ -654,7 +655,7 @@ public class GT_ModHandler { aOutput1 = GT_OreDictUnificator.get(true, aOutput1); aOutput2 = GT_OreDictUnificator.get(true, aOutput2); if (aInput1 == null || aOutput1 == null || GT_Utility.getContainerItem(aInput1, false) != null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.inductionsmelter, aInput2 == null ? aInput1 : aOutput1, true)) + if (!GT_Mod.gregtechproxy.mTEMachineRecipes && !GregTech_API.sRecipeFile.get(ConfigCategories.Machines.inductionsmelter, aInput2 == null ? aInput1 : aOutput1, true)) return false; try { ThermalExpansion.addSmelterRecipe(aEnergy * 10, GT_Utility.copy(aInput1), aInput2 == null ? new ItemStack(Blocks.sand, 1, 0) : aInput2, aOutput1, aOutput2, aChance); diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index 456d8cee..b403f05e 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -94,12 +94,8 @@ public class GT_OreDictUnificator { } public static ItemStack get(OrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) { - //if (aPrefix.mDisabledMaterials.contains((Materials) aMaterial) && !Materials.mTempComponents.contains(aPrefix)) System.out.println("##### Prefix: " + aPrefix); - if (Materials.mDefaultComponents.contains(aPrefix) && aPrefix.mDisabledMaterials.contains(aMaterial)) return null; - /*if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial)) { - aPrefix.mDynamicItems.add((Materials) aMaterial); - System.out.println("##### Added component to dynamic items"); - }*/ + //if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial)) aPrefix.mDynamicItems.add((Materials) aMaterial); + if (Materials.mDefaultComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) return null; return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); } diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java index c362cda3..31e3c7a9 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java @@ -38,23 +38,23 @@ public class GT_Worldgen_GT_Ore_Layer public GT_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, boolean aMoon, boolean aMars, boolean aAsteroid, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { super(aName, sList, aDefault); - this.mOverworld = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Overworld", aOverworld); - this.mNether = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Nether", aNether); - this.mEnd = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "TheEnd", aEnd); - this.mEndAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "EndAsteroid", aEnd); - this.mMoon = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Moon", aMoon); - this.mMars = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Mars", aMars); - this.mAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Asteroid", aAsteroid); - this.mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max(this.mMinY + 5, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Size", aSize))); - this.mPrimaryMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mRestrictBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RestrictToBiomeName", "None"); + this.mOverworld = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mNether = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); + this.mEnd = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); + this.mEndAsteroid = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "EndAsteroid", aEnd); + this.mMoon = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon); + this.mMars = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars); + this.mAsteroid = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid); + this.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + this.mPrimaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mRestrictBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does not exist"); //if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + " does not exist"); diff --git a/src/main/java/gregtech/loaders/materialprocessing/ProcessingConfig.java b/src/main/java/gregtech/loaders/materialprocessing/ProcessingConfig.java index 4f9d3484..84cbbb0d 100644 --- a/src/main/java/gregtech/loaders/materialprocessing/ProcessingConfig.java +++ b/src/main/java/gregtech/loaders/materialprocessing/ProcessingConfig.java @@ -3,7 +3,6 @@ package gregtech.loaders.materialprocessing; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TextureSet; public class ProcessingConfig implements gregtech.api.interfaces.IMaterialHandler { @@ -22,19 +21,20 @@ public class ProcessingConfig implements gregtech.api.interfaces.IMaterialHandle @Override public void onComponentRegistration(Materials aMaterial) { + /** This is just left here as an example of how to add components. switch (aMaterial.mName) { case "Cobalt": - OrePrefixes.spring.mDisabledMaterials.remove(aMaterial); - OrePrefixes.ingotDouble.mDisabledMaterials.remove(aMaterial); - OrePrefixes.ingotTriple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.ingotQuadruple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.ingotQuintuple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.plateDouble.mDisabledMaterials.remove(aMaterial); - OrePrefixes.plateTriple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.plateQuadruple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.plateQuintuple.mDisabledMaterials.remove(aMaterial); - OrePrefixes.plateDense.mDisabledMaterials.remove(aMaterial); + OrePrefixes.spring.mDisabledItems.remove(aMaterial); + OrePrefixes.ingotDouble.mDisabledItems.remove(aMaterial); + OrePrefixes.ingotTriple.mDisabledItems.remove(aMaterial); + OrePrefixes.ingotQuadruple.mDisabledItems.remove(aMaterial); + OrePrefixes.ingotQuintuple.mDisabledItems.remove(aMaterial); + OrePrefixes.plateDouble.mDisabledItems.remove(aMaterial); + OrePrefixes.plateTriple.mDisabledItems.remove(aMaterial); + OrePrefixes.plateQuadruple.mDisabledItems.remove(aMaterial); + OrePrefixes.plateQuintuple.mDisabledItems.remove(aMaterial); + OrePrefixes.plateDense.mDisabledItems.remove(aMaterial); break; - } + }**/ } } diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MaterialProcessing.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MaterialProcessing.java deleted file mode 100644 index d7ec2365..00000000 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MaterialProcessing.java +++ /dev/null @@ -1,11 +0,0 @@ -package gregtech.loaders.preload; - -import gregtech.api.util.GT_Log; -import gregtech.loaders.materialprocessing.ProcessingConfig; - -public class GT_Loader_MaterialProcessing implements Runnable { - public void run() { - GT_Log.out.println("GT_Mod: Register Material processing."); - new ProcessingConfig(); - } -}