From de9ade9d779c06a979490ecb8327f374427e3783 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sun, 9 Oct 2016 22:00:40 +0100 Subject: [PATCH] Fix TGreg & Remove unneeded config entries --- .../java/gregtech/api/enums/Materials.java | 3 +- .../java/gregtech/api/enums/OrePrefixes.java | 43 +++++++++---------- .../api/util/GT_OreDictUnificator.java | 2 +- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 6e46febc..75f9367d 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -250,7 +250,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials FierySteel = new Materials(346, TextureSet.SET_FIERY, 8.0F, 256, 3, 1|2 |16|64|128, 64, 0, 0, 0, "FierySteel", "Fiery Steel", 5, 2048, 1811, 1000, true, false, 1, 1, 1, Dyes.dyeRed, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 3), new TC_AspectStack(TC_Aspects.CORPUS, 3))); public static Materials Firestone = new Materials(347, TextureSet.SET_QUARTZ, 6.0F, 1280, 3, 1|4|8 |64, 200, 20, 0, 0, "Firestone", "Firestone", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed); public static Materials Fluorite = new Materials(-1, TextureSet.SET_NONE, 1.0F, 0, 2, 1, 255, 255, 255, 0, "Fluorite", "Fluorite", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen); - public static Materials FoolsRuby = new Materials(512, TextureSet.SET_RUBY, 1.0F, 0, 2, 1|4|8, 255, 100, 100, 127, "Ruby", "Ruby", 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials FoolsRuby = new Materials(512, TextureSet.SET_RUBY, 1.0F, 0, 2, 1|4|8, 255, 100, 100, 127, "FoolsRuby", "Ruby", 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); public static Materials Force = new Materials(521, TextureSet.SET_DIAMOND, 10.0F, 128, 3, 1|2|4|8 |64|128, 255, 255, 0, 0, "Force", "Force", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 5))); public static Materials Forcicium = new Materials(518, TextureSet.SET_DIAMOND, 1.0F, 0, 1, 1|4|16, 50, 50, 70, 0, "Forcicium", "Forcicium", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 2))); public static Materials Forcillium = new Materials(519, TextureSet.SET_DIAMOND, 1.0F, 0, 1, 1|4|16, 50, 50, 70, 0, "Forcillium", "Forcillium", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 2))); @@ -741,7 +741,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public byte mToolQuality = 0; public boolean mHasParentMod = true, mEnableFluid = true, mHasPlasma = false, mHasGas = false, mCustomOre = false; public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null; - public static List mDefaultComponents = new LinkedList<>(Arrays.asList(OrePrefixes.ore, OrePrefixes.dustTiny, OrePrefixes.dustSmall, OrePrefixes.dust, OrePrefixes.dustImpure, OrePrefixes.dustPure, OrePrefixes.crushed, OrePrefixes.crushedPurified, OrePrefixes.crushedCentrifuged, OrePrefixes.gem, OrePrefixes.nugget, OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.ingotDouble, OrePrefixes.ingotTriple, OrePrefixes.ingotQuadruple, OrePrefixes.ingotQuintuple, OrePrefixes.plate, OrePrefixes.plateDouble, OrePrefixes.plateTriple, OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.plateDense, OrePrefixes.stick, OrePrefixes.lens, OrePrefixes.round, OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.foil, OrePrefixes.toolHeadSword, OrePrefixes.toolHeadPickaxe, OrePrefixes.toolHeadShovel, OrePrefixes.toolHeadAxe, OrePrefixes.toolHeadHoe, OrePrefixes.toolHeadHammer, OrePrefixes.toolHeadFile, OrePrefixes.toolHeadSaw, OrePrefixes.toolHeadDrill, OrePrefixes.toolHeadChainsaw, OrePrefixes.toolHeadWrench, OrePrefixes.toolHeadUniversalSpade, OrePrefixes.toolHeadSense, OrePrefixes.toolHeadPlow, OrePrefixes.toolHeadArrow, OrePrefixes.toolHeadBuzzSaw, OrePrefixes.turbineBlade, OrePrefixes.wireFine, OrePrefixes.gearGtSmall, OrePrefixes.rotor, OrePrefixes.stickLong, OrePrefixes.springSmall, OrePrefixes.spring, OrePrefixes.arrowGtWood, OrePrefixes.arrowGtPlastic, OrePrefixes.gemChipped, OrePrefixes.gemFlawed, OrePrefixes.gemFlawless, OrePrefixes.gemExquisite, OrePrefixes.gearGt, OrePrefixes.crateGtDust, OrePrefixes.crateGtIngot, OrePrefixes.crateGtGem, OrePrefixes.crateGtPlate)); /** * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, that means 144 is one Material Unit worth of fluid. diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 26c14573..483d3ab1 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -13,10 +13,7 @@ import gregtech.api.util.GT_Utility; import gregtech.loaders.materialprocessing.ProcessingModSupport; import net.minecraft.item.ItemStack; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; +import java.util.*; import static gregtech.api.enums.GT_Values.*; @@ -549,6 +546,7 @@ public enum OrePrefixes { public MaterialStack mSecondaryMaterial = null; public OrePrefixes mPrefixInto = this; public float mHeatDamage = 0.0F; // Negative for Frost Damage + public static List mPreventableComponents = new LinkedList<>(Arrays.asList(OrePrefixes.gem, OrePrefixes.ingotHot, OrePrefixes.ingotDouble, OrePrefixes.ingotTriple, OrePrefixes.ingotQuadruple, OrePrefixes.ingotQuintuple, OrePrefixes.plate, OrePrefixes.plateDouble, OrePrefixes.plateTriple, OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.plateDense, OrePrefixes.stick, OrePrefixes.round, OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.foil, OrePrefixes.toolHeadSword, OrePrefixes.toolHeadPickaxe, OrePrefixes.toolHeadShovel, OrePrefixes.toolHeadAxe, OrePrefixes.toolHeadHoe, OrePrefixes.toolHeadHammer, OrePrefixes.toolHeadFile, OrePrefixes.toolHeadSaw, OrePrefixes.toolHeadDrill, OrePrefixes.toolHeadChainsaw, OrePrefixes.toolHeadWrench, OrePrefixes.toolHeadUniversalSpade, OrePrefixes.toolHeadSense, OrePrefixes.toolHeadPlow, OrePrefixes.toolHeadArrow, OrePrefixes.toolHeadBuzzSaw, OrePrefixes.turbineBlade, OrePrefixes.wireFine, OrePrefixes.gearGtSmall, OrePrefixes.rotor, OrePrefixes.stickLong, OrePrefixes.springSmall, OrePrefixes.spring, OrePrefixes.arrowGtWood, OrePrefixes.arrowGtPlastic, OrePrefixes.gemChipped, OrePrefixes.gemFlawed, OrePrefixes.gemFlawless, OrePrefixes.gemExquisite, OrePrefixes.gearGt, OrePrefixes.crateGtDust, OrePrefixes.crateGtIngot, OrePrefixes.crateGtGem, OrePrefixes.crateGtPlate)); /** * Yes this Value can be changed to add Bits for the MetaGenerated-Item-Check. */ @@ -640,7 +638,7 @@ public enum OrePrefixes { //TODO possibly use OrePrefix mNotGeneratedItems/mGeneratedItems instead of a static List for every material instance? //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.mMetaItemSubID > 0) { 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); @@ -752,22 +750,24 @@ public enum OrePrefixes { aRegistrator.onComponentInit(); } for (Materials aMaterial : Materials.values()) { - for (IMaterialHandler aRegistrator : Materials.mMaterialHandlers) { - aRegistrator.onComponentIteration(aMaterial); - } - if (enablePerItemSettings) { - StringBuilder aConfigPathSB = new StringBuilder(); - 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.mDisabledItems.contains(aMaterial)); - if (!aEnableComponent) { //Disable component if false and is not already in disabled list - aPrefix.disableComponent(aMaterial); - } else if (aEnableComponent) { //Enable component if true and is not already in enabled list - aPrefix.enableComponent(aMaterial); - } + if (aMaterial.mMetaItemSubID > 0) { + for (IMaterialHandler aRegistrator : Materials.mMaterialHandlers) { + aRegistrator.onComponentIteration(aMaterial); + } + if (enablePerItemSettings) { + StringBuilder aConfigPathSB = new StringBuilder(); + aConfigPathSB.append("materialcomponents.").append(aMaterial.mConfigSection).append(".").append(aMaterial.mName); + String aConfigPath = aConfigPathSB.toString(); + for (OrePrefixes aPrefix : mPreventableComponents) { + 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 + aPrefix.disableComponent(aMaterial); + } else if (aEnableComponent) { //Enable component if true and is not already in enabled list + aPrefix.enableComponent(aMaterial); + } + } + aConfigPathSB.setLength(0); } - aConfigPathSB.setLength(0); } } } @@ -873,8 +873,7 @@ 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)) return; - if (Materials.mDefaultComponents.contains(this) && this.mDisabledItems.contains(aMaterial)) return; + //if (Materials.mPreventableComponents.contains(this) && !this.mDynamicItems.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)); tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index b403f05e..9910b2ab 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -95,7 +95,7 @@ public class GT_OreDictUnificator { public static ItemStack get(OrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) { //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; + if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial)) return null; return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); }