diff options
Diffstat (limited to 'src/main/java')
131 files changed, 6139 insertions, 6841 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_Layer_Space.java b/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_Layer_Space.java index fa994b939d..9dc8d2c070 100644 --- a/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_Layer_Space.java +++ b/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_Layer_Space.java @@ -13,15 +13,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import bloodasp.galacticgreg.api.ModContainer; import bloodasp.galacticgreg.api.ModDimensionDef; import bloodasp.galacticgreg.auxiliary.GTOreGroup; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_Layer_Space; -import bloodasp.galacticgreg.dynconfig.DynamicOreMixWorldConfig; import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; import gregtech.api.util.GT_Log; import gregtech.api.world.GT_Worldgen; +import gregtech.common.OreMixBuilder; public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { @@ -38,61 +36,40 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { private long mProfilingStart; private long mProfilingEnd; + private Map<String, Boolean> allowedDims; + + public GT_Worldgen_GT_Ore_Layer_Space(OreMixBuilder mix) { + super(mix.oreMixName, GalacticGreg.oreVeinWorldgenList, mix.enabledByDefault); + + mMinY = (short) mix.minY; + mMaxY = (short) Math.max(this.mMinY + 5, mix.maxY); + mWeight = (short) mix.weight; + mDensity = (short) mix.density; + mSize = (short) Math.max(1, mix.size); + mPrimaryMeta = (short) mix.primary.mMetaItemSubID; + mSecondaryMeta = (short) mix.secondary.mMetaItemSubID; + mBetweenMeta = (short) mix.between.mMetaItemSubID; + mSporadicMeta = (short) mix.sporadic.mMetaItemSubID; + + allowedDims = new HashMap<>(); + + for (ModContainer mc : GalacticGregRegistry.getModContainers()) { + if (!mc.getEnabled()) continue; + + for (ModDimensionDef mdd : mc.getDimensionList()) { + String tDimIdentifier = mdd.getDimIdentifier(); + if (allowedDims.containsKey(tDimIdentifier)) GalacticGreg.Logger.error( + "Found 2 Dimensions with the same Identifier: %s Dimension will not generate Ores", + tDimIdentifier); + else { + boolean tFlag = mix.dimsEnabled.getOrDefault(mdd.getDimensionName(), false); + allowedDims.put(tDimIdentifier, tFlag); + } + } + } - private DynamicOreMixWorldConfig _mDynWorldConfig; - - public GT_Worldgen_GT_Ore_Layer_Space(String pName, boolean pDefault, int pMinY, int pMaxY, int pWeight, - int pDensity, int pSize, Materials pPrimary, Materials pSecondary, Materials pBetween, Materials pSporadic) { - super(pName, GalacticGreg.oreVeinWorldgenList, pDefault); - mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math - .max(this.mMinY + 5, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", pMaxY))); - mWeight = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RandomWeight", pWeight)); - mDensity = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Density", pDensity)); - mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Size", pSize))); - mPrimaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OrePrimaryLayer", pPrimary.mMetaItemSubID)); - mSecondaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSecondaryLayer", pSecondary.mMetaItemSubID)); - mBetweenMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSporadiclyInbetween", pBetween.mMetaItemSubID)); - mSporadicMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSporaticlyAround", pSporadic.mMetaItemSubID)); - - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName); - _mDynWorldConfig.InitDynamicConfig(); - - GalacticGreg.Logger.trace("Initialized new OreLayer: %s", pName); - - if (mEnabled) GT_Worldgen_GT_Ore_Layer_Space.sWeight += this.mWeight; - - } - - public GT_Worldgen_GT_Ore_Layer_Space(String pName, boolean pDefault, int pMinY, int pMaxY, int pWeight, - int pDensity, int pSize, short pPrimary, short pSecondary, short pBetween, short pSporadic) { - super(pName, GalacticGreg.oreVeinWorldgenList, pDefault); - mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math - .max(this.mMinY + 5, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", pMaxY))); - mWeight = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RandomWeight", pWeight)); - mDensity = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Density", pDensity)); - mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Size", pSize))); - mPrimaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OrePrimaryLayer", pPrimary)); - mSecondaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSecondaryLayer", pSecondary)); - mBetweenMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSporadiclyInbetween", pBetween)); - mSporadicMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "OreSporaticlyAround", pSporadic)); - - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName); - _mDynWorldConfig.InitDynamicConfig(); - - GalacticGreg.Logger.trace("Initialized new OreLayer: %s", pName); - + GalacticGreg.Logger.trace("Initialized new OreLayer: %s", mix.oreMixName); if (mEnabled) sWeight += this.mWeight; - } /** @@ -102,31 +79,7 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { * @return */ public boolean isEnabledForDim(ModDimensionDef pDimensionDef) { - return _mDynWorldConfig.isEnabledInDim(pDimensionDef); - } - - private static Map<String, Integer> _mBufferedVeinCountList = new HashMap<>(); - - /** - * Get the number of enabled OreMixes for given Dimension. This query is buffered and will only consume calculation - * time on the first run for each dimension - * - * @param pDimensionDef - * @return - */ - private static int getNumOremixedForDim(ModDimensionDef pDimensionDef) { - int tVal = 0; - if (_mBufferedVeinCountList.containsKey(pDimensionDef.getDimIdentifier())) - tVal = _mBufferedVeinCountList.get(pDimensionDef.getDimIdentifier()); - else { - for (GT_Worldgen tWorldGen : GalacticGreg.oreVeinWorldgenList) - if (tWorldGen instanceof GT_Worldgen_GT_Ore_Layer_Space - && ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).isEnabledForDim(pDimensionDef)) tVal++; - - _mBufferedVeinCountList.put(pDimensionDef.getDimIdentifier(), tVal); - } - - return tVal; + return allowedDims.getOrDefault(pDimensionDef.getDimIdentifier(), false); } private static Map<String, List<String>> _mBufferedVeinList = new HashMap<>(); @@ -148,9 +101,6 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { if (tWorldGen instanceof GT_Worldgen_GT_Ore_Layer_Space && ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).isEnabledForDim(pDimensionDef)) tReturn.add(tWorldGen.mWorldGenName); - else if (tWorldGen instanceof BW_Worldgen_Ore_Layer_Space - && ((BW_Worldgen_Ore_Layer_Space) tWorldGen).isEnabledForDim(pDimensionDef)) - tReturn.add(tWorldGen.mWorldGenName); _mBufferedVeinList.put(pDimensionDef.getDimIdentifier(), tReturn); } @@ -158,17 +108,6 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { return tReturn; } - private static short getMaxWeightForDim(ModDimensionDef pDimensionDef) { - short tVal = 0; - for (GT_Worldgen tWorldGen : GalacticGreg.oreVeinWorldgenList) - if (tWorldGen instanceof GT_Worldgen_GT_Ore_Layer_Space - && ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).isEnabledForDim(pDimensionDef) - && tVal < ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).mWeight) - tVal = ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).mWeight; - - return tVal; - } - /** * Select a random ore-vein from the list * @@ -182,8 +121,6 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { short betweenMeta = 0; short sporadicMeta = 0; - // int tRangeSplit = getMaxWeightForDim(pDimensionDef) / 2; - if (pIgnoreWeight) { List<String> tEnabledVeins = getOreMixIDsForDim(pDimensionDef); int tRnd = pRandom.nextInt(tEnabledVeins.size()); @@ -249,7 +186,7 @@ public class GT_Worldgen_GT_Ore_Layer_Space extends GT_Worldgen { return false; } - if (!_mDynWorldConfig.isEnabledInDim(tMDD)) { + if (!isEnabledForDim(tMDD)) { GalacticGreg.Logger .trace("OreGen for %s is disallowed in dimension %s, skipping", mWorldGenName, tMDD.getDimensionName()); return false; diff --git a/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_SmallPieces_Space.java b/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_SmallPieces_Space.java index 11e264b4fb..f5def8e0fd 100644 --- a/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_SmallPieces_Space.java +++ b/src/main/java/bloodasp/galacticgreg/GT_Worldgen_GT_Ore_SmallPieces_Space.java @@ -1,16 +1,17 @@ package bloodasp.galacticgreg; +import java.util.HashMap; +import java.util.Map; import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import bloodasp.galacticgreg.api.ModContainer; import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.dynconfig.DynamicOreMixWorldConfig; import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; import gregtech.api.world.GT_Worldgen; +import gregtech.common.SmallOreBuilder; public class GT_Worldgen_GT_Ore_SmallPieces_Space extends GT_Worldgen { @@ -21,51 +22,43 @@ public class GT_Worldgen_GT_Ore_SmallPieces_Space extends GT_Worldgen { private long mProfilingStart; private long mProfilingEnd; - private DynamicOreMixWorldConfig _mDynWorldConfig; - - public GT_Worldgen_GT_Ore_SmallPieces_Space(String pName, boolean pDefault, int pMinY, int pMaxY, int pAmount, - Materials pPrimary) { - super(pName, GalacticGreg.smallOreWorldgenList, pDefault); - - mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math - .max(this.mMinY + 1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", pMaxY))); - mAmount = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Amount", pAmount))); - mMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen." + this.mWorldGenName, "Ore", pPrimary.mMetaItemSubID)); - - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName); - _mDynWorldConfig.InitDynamicConfig(); - - GalacticGreg.Logger.trace("Initialized new OreLayer: %s", pName); - } - - public GT_Worldgen_GT_Ore_SmallPieces_Space(String pName, boolean pDefault, int pMinY, int pMaxY, int pAmount, - short pPrimary) { - super(pName, GalacticGreg.smallOreWorldgenList, pDefault); - - mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math - .max(this.mMinY + 1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", pMaxY))); - mAmount = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Amount", pAmount))); - mMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Ore", pPrimary)); - - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName); - _mDynWorldConfig.InitDynamicConfig(); + private Map<String, Boolean> allowedDims; + + public GT_Worldgen_GT_Ore_SmallPieces_Space(SmallOreBuilder ore) { + super(ore.smallOreName, GalacticGreg.smallOreWorldgenList, ore.enabledByDefault); + + mMinY = (short) ore.minY; + mMaxY = (short) Math.max(this.mMinY + 1, ore.maxY); + mAmount = (short) Math.max(1, ore.amount); + mMeta = (short) ore.ore.mMetaItemSubID; + + allowedDims = new HashMap<>(); + for (ModContainer mc : GalacticGregRegistry.getModContainers()) { + if (!mc.getEnabled()) continue; + + for (ModDimensionDef mdd : mc.getDimensionList()) { + String tDimIdentifier = mdd.getDimIdentifier(); + if (allowedDims.containsKey(tDimIdentifier)) GalacticGreg.Logger.error( + "Found 2 Dimensions with the same Identifier: %s Dimension will not generate Ores", + tDimIdentifier); + else { + boolean tFlag = ore.dimsEnabled.getOrDefault(mdd.getDimensionName(), false); + allowedDims.put(tDimIdentifier, tFlag); + } + } + } - GalacticGreg.Logger.trace("Initialized new OreLayer: %s", pName); + GalacticGreg.Logger.trace("Initialized new OreLayer: %s", ore.smallOreName); } /** * Check if *this* orelayer is enabled for pDimensionDef - * + * * @param pDimensionDef the ChunkProvider in question * @return */ public boolean isEnabledForDim(ModDimensionDef pDimensionDef) { - return _mDynWorldConfig.isEnabledInDim(pDimensionDef); + return allowedDims.getOrDefault(pDimensionDef.getDimIdentifier(), false); } @Override @@ -79,7 +72,7 @@ public class GT_Worldgen_GT_Ore_SmallPieces_Space extends GT_Worldgen { return false; } - if (!_mDynWorldConfig.isEnabledInDim(tMDD)) { + if (!isEnabledForDim(tMDD)) { GalacticGreg.Logger .trace("OreGen for %s is disallowed in dimension %s, skipping", mWorldGenName, tMDD.getDimensionName()); return false; diff --git a/src/main/java/bloodasp/galacticgreg/GT_Worldgenerator_Space.java b/src/main/java/bloodasp/galacticgreg/GT_Worldgenerator_Space.java index d2060ca71e..e76bc9bbcc 100644 --- a/src/main/java/bloodasp/galacticgreg/GT_Worldgenerator_Space.java +++ b/src/main/java/bloodasp/galacticgreg/GT_Worldgenerator_Space.java @@ -23,8 +23,6 @@ import bloodasp.galacticgreg.api.ModDimensionDef; import bloodasp.galacticgreg.api.SpecialBlockComb; import bloodasp.galacticgreg.api.StructureInformation; import bloodasp.galacticgreg.auxiliary.GTOreGroup; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_Layer_Space; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_SmallOre_Space; import bloodasp.galacticgreg.dynconfig.DynamicDimensionConfig; import bloodasp.galacticgreg.dynconfig.DynamicDimensionConfig.AsteroidConfig; import bloodasp.galacticgreg.registry.GalacticGregRegistry; @@ -450,48 +448,38 @@ public class GT_Worldgenerator_Space implements IWorldGenerator { int tRandomWeight; boolean continueSearch = true; int tFoundOreMeta = -1; - BW_Worldgen_Ore_SmallOre_Space bwOreGen = null; // First find a small ore... for (int i = 0; (i < 256) && (continueSearch); i++) { tRandomWeight = pRandom.nextInt(GT_Worldgen_GT_Ore_Layer_Space.sWeight); for (GT_Worldgen tWorldGen : GalacticGreg.smallOreWorldgenList) { - if (tWorldGen instanceof BW_Worldgen_Ore_SmallOre_Space) { - tRandomWeight = ((BW_Worldgen_Ore_SmallOre_Space) tWorldGen).mDensity; - if (tRandomWeight <= 0) { - tFoundOreMeta = ((BW_Worldgen_Ore_SmallOre_Space) tWorldGen).mPrimaryMeta; - continueSearch = false; - bwOreGen = ((BW_Worldgen_Ore_SmallOre_Space) tWorldGen); - } - } else if (tWorldGen instanceof GT_Worldgen_GT_Ore_SmallPieces_Space) { - // That is enabled for *this* dim... - if (!((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).isEnabledForDim(pDimDef)) continue; - - // And in the correct y-level, of ObeyLimits is true... - if (pAConf.ObeyHeightLimits - && !((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).isAllowedForHeight(pY)) continue; - - // Care about weight - tRandomWeight -= ((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).mAmount; - if (tRandomWeight <= 0) { - // And return found ore meta - tFoundOreMeta = ((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).mMeta; - continueSearch = false; - } + + if (!(tWorldGen instanceof GT_Worldgen_GT_Ore_SmallPieces_Space)) { + continue; + } + // That is enabled for *this* dim... + if (!((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).isEnabledForDim(pDimDef)) continue; + + // And in the correct y-level, of ObeyLimits is true... + if (pAConf.ObeyHeightLimits + && !((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).isAllowedForHeight(pY)) continue; + + // Care about weight + tRandomWeight -= ((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).mAmount; + if (tRandomWeight <= 0) { + // And return found ore meta + tFoundOreMeta = ((GT_Worldgen_GT_Ore_SmallPieces_Space) tWorldGen).mMeta; + continueSearch = false; } } } if (tFoundOreMeta > -1) { - if (bwOreGen == null) { - // Make the oreID a small ore with correct type - int tCustomOffset = (GTOreTypes.SmallOres.getOffset() + pTargetBlockOffset); + // Make the oreID a small ore with correct type + int tCustomOffset = (GTOreTypes.SmallOres.getOffset() + pTargetBlockOffset); - // Set the smallOre block - GT_TileEntity_Ores_Space - .setOuterSpaceOreBlock(pDimDef, pWorld, pX, pY, pZ, tFoundOreMeta, true, tCustomOffset); - tFlag = false; - } else { - bwOreGen.setOreBlock(pWorld, pX, pY, pZ, tFoundOreMeta, true); - } + // Set the smallOre block + GT_TileEntity_Ores_Space + .setOuterSpaceOreBlock(pDimDef, pWorld, pX, pY, pZ, tFoundOreMeta, true, tCustomOffset); + tFlag = false; } } } @@ -524,8 +512,7 @@ public class GT_Worldgenerator_Space implements IWorldGenerator { for (GT_Worldgen tWorldGen : GalacticGreg.oreVeinWorldgenList) { if (tWorldGen instanceof GT_Worldgen_GT_Ore_Layer_Space) tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer_Space) tWorldGen).mWeight; - else if (tWorldGen instanceof BW_Worldgen_Ore_Layer_Space) - tRandomWeight -= ((BW_Worldgen_Ore_Layer_Space) tWorldGen).mWeight; + if (tRandomWeight <= 0) { try { if (tWorldGen.executeWorldgen( diff --git a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java index 760564c741..2e566dca1d 100644 --- a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java +++ b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java @@ -9,8 +9,6 @@ import java.util.Random; import bloodasp.galacticgreg.auxiliary.GalacticGregConfig; import bloodasp.galacticgreg.auxiliary.LogHelper; import bloodasp.galacticgreg.auxiliary.ProfilingStorage; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_Layer_Space; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_SmallOre_Space; import bloodasp.galacticgreg.command.AEStorageCommand; import bloodasp.galacticgreg.command.ProfilingCommand; import bloodasp.galacticgreg.registry.GalacticGregRegistry; @@ -21,7 +19,6 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import gregtech.GT_Version; -import gregtech.api.GregTech_API; import gregtech.api.world.GT_Worldgen; @Mod( @@ -84,25 +81,6 @@ public class GalacticGreg { if (!GalacticGregRegistry.InitRegistry()) throw new RuntimeException( "GalacticGreg registry has been finalized from a 3rd-party mod, this is forbidden!"); - // new WorldGenGaGT().run(); DO NOT UNCOMMENT, was moved to gregtech.loaders.postload.GT_Worldgenloader - - for (int f = 0, - j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomLargeVeinSlots", 0); f - < j; f++) { - new BW_Worldgen_Ore_Layer_Space( - "mix.custom." + (f < 10 ? "0" : "") + f, - GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + "mix.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); - } - - for (int f = 0, j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomSmallSlots", 0); f - < j; f++) { - new BW_Worldgen_Ore_SmallOre_Space( - "small.custom." + (f < 10 ? "0" : "") + f, - GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + "small.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); - } - for (Runnable r : ADDITIONALVEINREGISTER) { try { r.run(); diff --git a/src/main/java/bloodasp/galacticgreg/ModRegisterer.java b/src/main/java/bloodasp/galacticgreg/ModRegisterer.java deleted file mode 100644 index 889cee0ca6..0000000000 --- a/src/main/java/bloodasp/galacticgreg/ModRegisterer.java +++ /dev/null @@ -1,283 +0,0 @@ -package bloodasp.galacticgreg; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.init.Blocks; -import net.minecraft.world.gen.ChunkProviderEnd; - -import bloodasp.galacticgreg.api.AsteroidBlockComb; -import bloodasp.galacticgreg.api.Enums; -import bloodasp.galacticgreg.api.Enums.AllowedBlockPosition; -import bloodasp.galacticgreg.api.Enums.DimensionType; -import bloodasp.galacticgreg.api.GTOreTypes; -import bloodasp.galacticgreg.api.ModContainer; -import bloodasp.galacticgreg.api.ModDBMDef; -import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.api.SpecialBlockComb; - -/** - * In this class, you'll find everything you need in order to tell GGreg what to do and where. Everything is done in - * here. If you're trying to use anything else, you're probably doing something wrong (Or I forgot to add it. In that - * case, find me on github and create an issue please) - */ -public class ModRegisterer { - - /** - * Just a helper to convert a single element to a list - * - * @param pDef - * @return - */ - private static List<ModDBMDef> singleToList(ModDBMDef pDef) { - List<ModDBMDef> tLst = new ArrayList<>(); - tLst.add(pDef); - return tLst; - } - - private static Method registerModContainer; - - /** - * Use loose binding of the register-method. Should be enough to provide support for GGreg without the requirement - * to have it in a modpack at all - * - * @param pModContainer - */ - public static void registerModContainer(ModContainer pModContainer) { - /* - * try { registerModContainer.invoke(null, pModContainer); } catch (Exception e) { e.printStackTrace(); } - */ - } - - /** - * Try to get the instance of GalacticGregs registry in order to register stuff - * - * @return - */ - public boolean Init() { - return false; - /* - * try { Class gGregRegistry = Class.forName("bloodasp.galacticgreg.registry.GalacticGregRegistry"); - * registerModContainer = gGregRegistry.getMethod("registerModContainer", ModContainer.class); return true; } - * catch (Exception e) { // GalacticGreg is not installed or something is wrong return false; } - */ - } - - public void Register() { - /* - * if (GalacticGreg.GalacticConfig.RegisterVanillaDim) registerModContainer(Setup_Vanilla()); if - * (GalacticGreg.GalacticConfig.RegisterGalacticCraftCore) registerModContainer(Setup_GalactiCraftCore()); if - * (GalacticGreg.GalacticConfig.RegisterGalacticCraftPlanets) registerModContainer(Setup_GalactiCraftPlanets()); - * if (GalacticGreg.GalacticConfig.RegisterGalaxySpace) registerModContainer(Setup_GalaxySpace()); - */ - } - - /** - * Vanilla MC (End Asteroids) - */ - private ModContainer Setup_Vanilla() { - // --- Mod Vanilla (Heh, "mod") - ModContainer modMCVanilla = new ModContainer("Vanilla"); - - // If you happen to have an asteroid dim, just skip the blocklist, and setDimensionType() to - // DimensionType.Asteroid - // also don't forget to add at least one asteroid type, or nothing will generate! - ModDimensionDef dimEndAsteroids = new ModDimensionDef( - "EndAsteroids", - ChunkProviderEnd.class, - DimensionType.Asteroid); - - dimEndAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.Netherrack)); - dimEndAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); - dimEndAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); - dimEndAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.EndStone)); - - // These Blocks will randomly be generated - dimEndAsteroids.addSpecialAsteroidBlock(new SpecialBlockComb(Blocks.glowstone)); - dimEndAsteroids.addSpecialAsteroidBlock(new SpecialBlockComb(Blocks.lava, AllowedBlockPosition.AsteroidCore)); - - modMCVanilla.addDimensionDef(dimEndAsteroids); - - return modMCVanilla; - } - - /** - * Mod GalactiCraft Just another setup based on existing classes, due the fact that we're working with GalactiCraft - */ - public static ModContainer Setup_GalactiCraftCore() { - ModContainer modGCraftCore = new ModContainer("GalacticraftCore"); - ModDBMDef DBMMoon = new ModDBMDef("tile.moonBlock", 4); - - ModDimensionDef tMoonDim = new ModDimensionDef( - "Moon", - "micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon", - Enums.DimensionType.Planet, - singleToList(DBMMoon)); - modGCraftCore.addDimensionDef(tMoonDim); - - return modGCraftCore; - } - - /** - * As GalactiCraftPlanets is an optional mod, don't hardlink it here - * - * @return - */ - private ModContainer Setup_GalactiCraftPlanets() { - ModContainer modGCraftPlanets = new ModContainer("GalacticraftMars"); - ModDBMDef DBMMars = new ModDBMDef("tile.mars", 9); - ModDimensionDef dimMars = new ModDimensionDef( - "Mars", - "micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars", - DimensionType.Planet, - singleToList(DBMMars)); - - // Overwrite ore blocks on mars with red granite ones. This will default to regular stone if not set - dimMars.setStoneType(GTOreTypes.RedGranite); - modGCraftPlanets.addDimensionDef(dimMars); - - ModDimensionDef dimAsteroids = new ModDimensionDef( - "Asteroids", - "micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids", - DimensionType.Asteroid); - dimAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); - dimAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); - dimAsteroids.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.Netherrack)); - modGCraftPlanets.addDimensionDef(dimAsteroids); - - return modGCraftPlanets; - } - - /** - * Mod GalaxySpace by BlesseNtumble - */ - private ModContainer Setup_GalaxySpace() { - // First, we create a mod-container that will be populated with dimensions later. - // The Name must match your modID, as it is checked if this mod is loaded, in order - // to enable/disable the parsing/registering of dimensions - ModContainer modCGalaxySpace = new ModContainer("GalaxySpace"); - - // Now lets first define a block here for our dimension. You can add the modID, but you don't have to. - // It will automatically add the mods name that is defined in the modcontainer. - ModDBMDef DBMPhobos = new ModDBMDef("phobosstone"); - ModDBMDef DBMDeimos = new ModDBMDef("deimossubgrunt"); - ModDBMDef DBMCeres = new ModDBMDef("ceressubgrunt"); - ModDBMDef DBMIO = new ModDBMDef("iorock", 4); // This meta-4 is a copy&paste bug in GSpace and might not work in - // further versions - ModDBMDef DBMGanymede = new ModDBMDef("ganymedesubgrunt"); - ModDBMDef DBMCallisto = new ModDBMDef("callistosubice"); - ModDBMDef DBMVenus = new ModDBMDef("venussubgrunt"); - ModDBMDef DBMMercury = new ModDBMDef("mercurycore"); - ModDBMDef DBMEnceladus = new ModDBMDef("enceladusrock"); - ModDBMDef DBMTitan = new ModDBMDef("titanstone"); - ModDBMDef DBMOberon = new ModDBMDef("oberonstone"); - ModDBMDef DBMProteus = new ModDBMDef("proteusstone"); - ModDBMDef DBMTriton = new ModDBMDef("tritonstone"); - ModDBMDef DBMPluto = new ModDBMDef("plutostone"); - - // Now define the available dimensions, and their chunkprovider. - // Same as above, to not have any dependency in your code, you can just give it a string. - // But it's better to use the actual ChunkProvider class. The Name is used for the GalacticGreg config file. - // The resulting config setting will be: <ModID>_<Name you give here as arg0>_false = false - // make sure to never change this name once you've generated your config files, as it will overwrite everything! - - // 25.10.2015 GSpace v2.5 - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Pluto", - "blessentumble.planets.SolarSystem.pluto.dimension.ChunkProviderPluto", - DimensionType.Planet, - singleToList(DBMPluto))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Triton", - "blessentumble.moons.triton.dimension.ChunkProviderTriton", - DimensionType.Planet, - singleToList(DBMTriton))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Proteus", - "blessentumble.moons.proteus.dimension.ChunkProviderProteus", - DimensionType.Planet, - singleToList(DBMProteus))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Oberon", - "blessentumble.moons.oberon.dimension.ChunkProviderOberon", - DimensionType.Planet, - singleToList(DBMOberon))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Titan", - "blessentumble.moons.titan.dimension.ChunkProviderTitan", - DimensionType.Planet, - singleToList(DBMTitan))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Callisto", - "blessentumble.moons.SolarSystem.callisto.dimension.ChunkProviderCallisto", - DimensionType.Planet, - singleToList(DBMCallisto))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Ganymede", - "blessentumble.moons.ganymede.dimension.ChunkProviderGanymede", - DimensionType.Planet, - singleToList(DBMGanymede))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Ceres", - "blessentumble.planets.SolarSystem.ceres.dimension.ChunkProviderCeres", - DimensionType.Planet, - singleToList(DBMCeres))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Deimos", - "blessentumble.moons.SolarSystem.deimos.dimension.ChunkProviderDeimos", - DimensionType.Planet, - singleToList(DBMDeimos))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Enceladus", - "blessentumble.moons.SolarSystem.enceladus.dimension.ChunkProviderEnceladus", - DimensionType.Planet, - singleToList(DBMEnceladus))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Io", - "blessentumble.moons.io.dimension.ChunkProviderIo", - DimensionType.Planet, - singleToList(DBMIO))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Phobos", - "blessentumble.moons.phobos.dimension.ChunkProviderPhobos", - DimensionType.Planet, - singleToList(DBMPhobos))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Venus", - "blessentumble.planets.SolarSystem.venus.dimension.ChunkProviderVenus", - DimensionType.Planet, - singleToList(DBMVenus))); - modCGalaxySpace.addDimensionDef( - new ModDimensionDef( - "Mercury", - "blessentumble.planets.SolarSystem.mercury.dimension.ChunkProviderMercury", - DimensionType.Planet, - singleToList(DBMMercury))); - - // GSpace 2.2-Beta: Kupierbelt - ModDimensionDef dimKupierBelt = new ModDimensionDef( - "Kuiperbelt", - "blessentumble.planets.SolarSystem.kuiperbelt.dimension.ChunkProviderKuiper", - DimensionType.Asteroid); - dimKupierBelt.setDimensionType(DimensionType.Asteroid); - dimKupierBelt.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); - dimKupierBelt.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); - modCGalaxySpace.addDimensionDef(dimKupierBelt); - - return modCGalaxySpace; - } -} diff --git a/src/main/java/bloodasp/galacticgreg/SpaceDimRegisterer.java b/src/main/java/bloodasp/galacticgreg/SpaceDimRegisterer.java new file mode 100644 index 0000000000..360d7f1bda --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/SpaceDimRegisterer.java @@ -0,0 +1,179 @@ +package bloodasp.galacticgreg; + +import static bloodasp.galacticgreg.api.enums.DimensionDef.Anubis; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Asteroids; +import static bloodasp.galacticgreg.api.enums.DimensionDef.BarnardC; +import static bloodasp.galacticgreg.api.enums.DimensionDef.BarnardE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.BarnardF; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Callisto; +import static bloodasp.galacticgreg.api.enums.DimensionDef.CentauriAlpha; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Ceres; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Deimos; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Enceladus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.EndAsteroids; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Europa; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Ganymede; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Haumea; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Horus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Io; +import static bloodasp.galacticgreg.api.enums.DimensionDef.KuiperBelt; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Maahes; +import static bloodasp.galacticgreg.api.enums.DimensionDef.MakeMake; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Mars; +import static bloodasp.galacticgreg.api.enums.DimensionDef.MehenBelt; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Mercury; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Miranda; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Moon; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Neper; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Oberon; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Phobos; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Pluto; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Proteus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Seth; +import static bloodasp.galacticgreg.api.enums.DimensionDef.TcetiE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Titan; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Triton; +import static bloodasp.galacticgreg.api.enums.DimensionDef.VegaB; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Venus; +import static bloodasp.galacticgreg.api.enums.ModContainers.AmunRa; +import static bloodasp.galacticgreg.api.enums.ModContainers.GalactiCraftCore; +import static bloodasp.galacticgreg.api.enums.ModContainers.GalacticraftMars; +import static bloodasp.galacticgreg.api.enums.ModContainers.GalaxySpace; +import static bloodasp.galacticgreg.api.enums.ModContainers.Vanilla; + +import net.minecraft.init.Blocks; + +import bloodasp.galacticgreg.api.AsteroidBlockComb; +import bloodasp.galacticgreg.api.Enums; +import bloodasp.galacticgreg.api.GTOreTypes; +import bloodasp.galacticgreg.api.ModContainer; +import bloodasp.galacticgreg.api.SpecialBlockComb; +import bloodasp.galacticgreg.registry.GalacticGregRegistry; + +/** + * In this class, you'll find everything you need in order to tell GGreg what to do and where. Everything is done in + * here. If you're trying to use anything else, you're probably doing something wrong (Or I forgot to add it. In that + * case, find me on github and create an issue please) + */ +public class SpaceDimRegisterer { + + public static void register() { + GalacticGregRegistry.registerModContainer(setupVanilla()); + GalacticGregRegistry.registerModContainer(setupGalactiCraftCore()); + GalacticGregRegistry.registerModContainer(setupGalactiCraftPlanets()); + GalacticGregRegistry.registerModContainer(setupGalaxySpace()); + GalacticGregRegistry.registerModContainer(setupAmunRa()); + } + + /** + * Vanilla MC (End Asteroids) + */ + private static ModContainer setupVanilla() { + + // If you happen to have an asteroid dim, just skip the blocklist, and setDimensionType() to + // DimensionType.Asteroid + // also don't forget to add at least one asteroid type, or nothing will generate! + EndAsteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.Netherrack)); + EndAsteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); + EndAsteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); + EndAsteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.EndStone)); + + // These Blocks will randomly be generated + EndAsteroids.modDimensionDef.addSpecialAsteroidBlock(new SpecialBlockComb(Blocks.glowstone)); + EndAsteroids.modDimensionDef + .addSpecialAsteroidBlock(new SpecialBlockComb(Blocks.lava, Enums.AllowedBlockPosition.AsteroidCore)); + + Vanilla.modContainer.addDimensionDef(EndAsteroids.modDimensionDef); + + return Vanilla.modContainer; + } + + /** + * Mod GalactiCraft + */ + private static ModContainer setupGalactiCraftCore() { + GalactiCraftCore.modContainer.addDimensionDef(Moon.modDimensionDef); + return GalactiCraftCore.modContainer; + } + + /** + * As GalactiCraftPlanets is an optional mod, don't hardlink it here + */ + private static ModContainer setupGalactiCraftPlanets() { + // Overwrite ore blocks on mars with red granite ones. This will default to regular stone if not set + Mars.modDimensionDef.setStoneType(GTOreTypes.RedGranite); + GalacticraftMars.modContainer.addDimensionDef(Mars.modDimensionDef); + + Asteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); + Asteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); + Asteroids.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.Netherrack)); + GalacticraftMars.modContainer.addDimensionDef(Asteroids.modDimensionDef); + + return GalacticraftMars.modContainer; + } + + /** + * Mod GalaxySpace by BlesseNtumble + */ + private static ModContainer setupGalaxySpace() { + // First, we create a mod-container that will be populated with dimensions later. + // The Name must match your ID, as it is checked if this mod is loaded, in order + // to enable/disable the parsing/registering of dimensions + // See enum ModContainers + + // Now lets first define a block here for our dimension. You can add the ID, but you don't have to. + // It will automatically add the mods name that is defined in the modcontainer. + // See enum DimensionBlockMetaDefinitionList + + // Now define the available dimensions, and their chunkprovider. + // Same as above, to not have any dependency in your code, you can just give it a string. + // But it's better to use the actual ChunkProvider class. The Name is used for the GalacticGreg config file. + // The resulting config setting will be: <ModID>_<Name you give here as arg0>_false = false + // make sure to never change this name once you've generated your config files, as it will overwrite everything! + + // 30.11.2016 GSpace v1.1.3 Stable + GalaxySpace.modContainer.addDimensionDef(Pluto.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Triton.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Proteus.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Oberon.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Titan.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Callisto.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Ganymede.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Ceres.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Deimos.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Enceladus.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Io.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Europa.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Phobos.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Venus.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Mercury.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(MakeMake.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Haumea.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(CentauriAlpha.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(VegaB.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(BarnardC.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(BarnardE.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(BarnardF.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(TcetiE.modDimensionDef); + GalaxySpace.modContainer.addDimensionDef(Miranda.modDimensionDef); + KuiperBelt.modDimensionDef.setDimensionType(Enums.DimensionType.Asteroid); + KuiperBelt.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.RedGranite)); + KuiperBelt.modDimensionDef.addAsteroidMaterial(new AsteroidBlockComb(GTOreTypes.BlackGranite)); + GalaxySpace.modContainer.addDimensionDef(KuiperBelt.modDimensionDef); + return GalaxySpace.modContainer; + } + + /** + * Mod Amun-Ra + */ + private static ModContainer setupAmunRa() { + AmunRa.modContainer.addDimensionDef(Neper.modDimensionDef); + AmunRa.modContainer.addDimensionDef(Maahes.modDimensionDef); + AmunRa.modContainer.addDimensionDef(Anubis.modDimensionDef); + AmunRa.modContainer.addDimensionDef(Horus.modDimensionDef); + AmunRa.modContainer.addDimensionDef(Seth.modDimensionDef); + MehenBelt.modDimensionDef.addAsteroidMaterial(GTOreTypes.BlackGranite); + AmunRa.modContainer.addDimensionDef(MehenBelt.modDimensionDef); + return AmunRa.modContainer; + } +} diff --git a/src/main/java/bloodasp/galacticgreg/WorldGenGaGT.java b/src/main/java/bloodasp/galacticgreg/WorldGenGaGT.java index 90f51ec7e1..f5577c9295 100644 --- a/src/main/java/bloodasp/galacticgreg/WorldGenGaGT.java +++ b/src/main/java/bloodasp/galacticgreg/WorldGenGaGT.java @@ -1,7 +1,7 @@ package bloodasp.galacticgreg; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; -import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; +import gregtech.api.enums.OreMixes; +import gregtech.api.enums.SmallOres; public class WorldGenGaGT implements Runnable { @@ -10,80 +10,19 @@ public class WorldGenGaGT implements Runnable { new GT_Worldgenerator_Space(); /* - * new GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.copper", true, 60, 120, 32, Materials.Copper); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.tin", true, 60, 120, 32, Materials.Tin); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.bismuth", true, 80, 120, 8, Materials.Bismuth); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.coal", true, 60, 100, 24, Materials.Coal); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.iron", true, 40, 80, 16, Materials.Iron); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.lead", true, 40, 80, 16, Materials.Lead); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.zinc", true, 30, 60, 12, Materials.Zinc); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.gold", true, 20, 40, 8, Materials.Gold); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.silver", true, 20, 40, 8, Materials.Silver); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.nickel", true, 20, 40, 8, Materials.Nickel); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.lapis", true, 20, 40, 4, Materials.Lapis); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.diamond", true, 5, 10, 2, Materials.Diamond); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.redstone", true, 5, 20, 8, Materials.Redstone); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.platinum", true, 20, 40, 8, Materials.Platinum); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.iridium", true, 20, 40, 8, Materials.Iridium); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.netherquartz", true, 30, 120, 64, Materials.NetherQuartz); - * new GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.saltpeter", true, 10, 60, 8, Materials.Saltpeter); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.sulfur_n", true, 10, 60, 32, Materials.Sulfur); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.sulfur_o", true, 5, 15, 8, Materials.Sulfur); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.emerald", true, 5, 250, 1, Materials.Emerald); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.ruby", true, 5, 250, 1, Materials.Ruby); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.sapphire", true, 5, 250, 1, Materials.Sapphire); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.greensapphire", true, 5, 250, 1, Materials.GreenSapphire); - * new GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.olivine", true, 5, 250, 1, Materials.Olivine); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.topaz", true, 5, 250, 1, Materials.Topaz); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.tanzanite", true, 5, 250, 1, Materials.Tanzanite); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.amethyst", true, 5, 250, 1, Materials.Amethyst); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.opal", true, 5, 250, 1, Materials.Opal); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.jasper", true, 5, 250, 1, Materials.Jasper); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.bluetopaz", true, 5, 250, 1, Materials.BlueTopaz); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.amber", true, 5, 250, 1, Materials.Amber); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.foolsruby", true, 5, 250, 1, Materials.FoolsRuby); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.garnetred", true, 5, 250, 1, Materials.GarnetRed); new - * GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.garnetyellow", true, 5, 250, 1, Materials.GarnetYellow); - */ - /* * This part here enables every GT Small Ore for Space Dims. */ - for (int k = 0; k < GT_Worldgen_GT_Ore_SmallPieces.sList.size(); ++k) { - new GT_Worldgen_GT_Ore_SmallPieces_Space( - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mWorldGenName, - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mEnabled, - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mMinY, - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mMaxY, - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mAmount, - GT_Worldgen_GT_Ore_SmallPieces.sList.get(k).mMeta); + for (SmallOres ore : SmallOres.values()) { + ore.addGaGregSmallOre(); } /* * This part here enables every GT Ore for Space Dims. */ - for (int k = 0; k < GT_Worldgen_GT_Ore_Layer.sList.size(); ++k) { - new GT_Worldgen_GT_Ore_Layer_Space( - GT_Worldgen_GT_Ore_Layer.sList.get(k).mWorldGenName, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mEnabled, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mMinY, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mMaxY, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mWeight, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mDensity, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mSize, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mPrimaryMeta, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mSecondaryMeta, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mBetweenMeta, - GT_Worldgen_GT_Ore_Layer.sList.get(k).mSporadicMeta); - } - /* - * int f = 0; for (int j = GregTech_API.sWorldgenFile.get("worldgen", "AmountOfCustomSmallOreSlots", 16); f < j; - * f++) { new GT_Worldgen_GT_Ore_SmallPieces_Space("ore.small.custom." + (f < 10 ? "0" : "") + f, false, 0, 0, - * 0, Materials._NULL); } int i = 0; for (int j = GregTech_API.sWorldgenFile.get("worldgen", - * "AmountOfCustomLargeVeinSlots", 16); i < j; i++) { new GT_Worldgen_GT_Ore_Layer_Space("ore.mix.custom." + (i - * < 10 ? "0" : "") + i, false, 0, 0, 0, 0, 0, Materials._NULL, Materials._NULL, Materials._NULL, - * Materials._NULL); } - */ + for (OreMixes mix : OreMixes.values()) { + mix.addGaGregOreLayer(); + } } } diff --git a/src/main/java/bloodasp/galacticgreg/api/Enums.java b/src/main/java/bloodasp/galacticgreg/api/Enums.java index 0c8afaf243..0d864e54c9 100644 --- a/src/main/java/bloodasp/galacticgreg/api/Enums.java +++ b/src/main/java/bloodasp/galacticgreg/api/Enums.java @@ -46,12 +46,6 @@ public class Enums { * The Dimension is a planet, and only ores shall be generated in the ground */ Planet, - - /** - * The Dimension is a special dim where Asteroids *and* ores shall spawn. Additional config values will be - * generated in worldconfig - */ - AsteroidAndPlanet } } diff --git a/src/main/java/bloodasp/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java b/src/main/java/bloodasp/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java new file mode 100644 index 0000000000..279360d2d9 --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/enums/DimensionBlockMetaDefinitionList.java @@ -0,0 +1,57 @@ +package bloodasp.galacticgreg.api.enums; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.init.Blocks; + +import bloodasp.galacticgreg.api.ModDBMDef; + +public enum DimensionBlockMetaDefinitionList { + + Moon(new ModDBMDef("tile.moonBlock", 4)), + Mars(new ModDBMDef("tile.mars", 9)), + Phobos(new ModDBMDef("phobosblocks", 2)), + Deimos(new ModDBMDef("deimosblocks", 1)), + Ceres(new ModDBMDef("ceresblocks", 1)), + Io(new ModDBMDef("ioblocks", 2)), + Ganymede(new ModDBMDef("ganymedeblocks", 1)), + Callisto(new ModDBMDef("callistoblocks", 1)), + Venus(new ModDBMDef("venusblocks", 1)), + Mercury(new ModDBMDef("mercuryblocks", 2)), + Enceladus(new ModDBMDef("enceladusblocks", 1)), + Titan(new ModDBMDef("titanblocks", 2)), + Oberon(new ModDBMDef("oberonblocks", 2)), + Proteus(new ModDBMDef("proteusblocks", 2)), + Triton(new ModDBMDef("tritonblocks", 2)), + Pluto(new ModDBMDef("plutoblocks", 5)), + MakeMake(new ModDBMDef("makemakegrunt", 1)), + Haumea(new ModDBMDef("haumeablocks")), + CentauriAlpha(new ModDBMDef("acentauribbsubgrunt")), + VegaB(new ModDBMDef("vegabsubgrunt")), + BarnardaC(new ModDBMDef("barnardaCdirt"), new ModDBMDef(Blocks.stone)), + BarnardaE(new ModDBMDef("barnardaEsubgrunt")), + BarnardaF(new ModDBMDef("barnardaFsubgrunt")), + TcetiE(new ModDBMDef("tcetieblocks", 2)), + Miranda(new ModDBMDef("mirandablocks", 2)), + Europa( + // Europa top layer turned off bc ores are too easy to spot + new ModDBMDef("europagrunt", 1), // Europa Ice Layer ~55-65 without top layer + new ModDBMDef(Blocks.water), new ModDBMDef(Blocks.flowing_water), new ModDBMDef(Blocks.ice), // Generates + // directly over + // bedrock + new ModDBMDef(Blocks.packed_ice), // Generates directly over bedrock + new ModDBMDef("europaunderwatergeyser") // Generates directly over bedrock + ), + Neper(new ModDBMDef(Blocks.stone), new ModDBMDef("tile.baseBlockRock", 10)), + Maahes(new ModDBMDef("tile.baseBlockRock", 1)), + Anubis(new ModDBMDef("tile.baseBlockRock", 1)), + Horus(new ModDBMDef(Blocks.obsidian)), + Seth(new ModDBMDef(Blocks.hardened_clay)); + + public final List<ModDBMDef> DBMDefList; + + private DimensionBlockMetaDefinitionList(ModDBMDef... DBMDefArray) { + DBMDefList = Arrays.asList(DBMDefArray); + } +} diff --git a/src/main/java/bloodasp/galacticgreg/api/enums/DimensionDef.java b/src/main/java/bloodasp/galacticgreg/api/enums/DimensionDef.java new file mode 100644 index 0000000000..d5e766b9f7 --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/enums/DimensionDef.java @@ -0,0 +1,228 @@ +package bloodasp.galacticgreg.api.enums; + +import net.minecraft.world.gen.ChunkProviderEnd; + +import bloodasp.galacticgreg.api.Enums; +import bloodasp.galacticgreg.api.ModDimensionDef; + +public enum DimensionDef { + + EndAsteroids(new ModDimensionDef(DimNames.ENDASTEROIDS, ChunkProviderEnd.class, Enums.DimensionType.Asteroid)), + Moon(new ModDimensionDef( + DimNames.MOON, + "micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Moon.DBMDefList)), + Mars(new ModDimensionDef( + DimNames.MARS, + "micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Mars.DBMDefList)), + Asteroids(new ModDimensionDef( + DimNames.ASTEROIDS, + "micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids", + Enums.DimensionType.Asteroid)), + Pluto(new ModDimensionDef( + DimNames.PLUTO, + "galaxyspace.SolarSystem.planets.pluto.dimension.ChunkProviderPluto", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Pluto.DBMDefList)), + Triton(new ModDimensionDef( + DimNames.TRITON, + "galaxyspace.SolarSystem.moons.triton.dimension.ChunkProviderTriton", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Triton.DBMDefList)), + Proteus(new ModDimensionDef( + DimNames.PROTEUS, + "galaxyspace.SolarSystem.moons.proteus.dimension.ChunkProviderProteus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Proteus.DBMDefList)), + Oberon(new ModDimensionDef( + DimNames.OBERON, + "galaxyspace.SolarSystem.moons.oberon.dimension.ChunkProviderOberon", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Oberon.DBMDefList)), + Titan(new ModDimensionDef( + DimNames.TITAN, + "galaxyspace.SolarSystem.moons.titan.dimension.ChunkProviderTitan", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Titan.DBMDefList)), + Callisto(new ModDimensionDef( + DimNames.CALLISTO, + "galaxyspace.SolarSystem.moons.callisto.dimension.ChunkProviderCallisto", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Callisto.DBMDefList)), + Ganymede(new ModDimensionDef( + DimNames.GANYMEDE, + "galaxyspace.SolarSystem.moons.ganymede.dimension.ChunkProviderGanymede", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Ganymede.DBMDefList)), + Ceres(new ModDimensionDef( + DimNames.CERES, + "galaxyspace.SolarSystem.planets.ceres.dimension.ChunkProviderCeres", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Ceres.DBMDefList)), + Deimos(new ModDimensionDef( + DimNames.DEIMOS, + "galaxyspace.SolarSystem.moons.deimos.dimension.ChunkProviderDeimos", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Deimos.DBMDefList)), + Enceladus(new ModDimensionDef( + DimNames.ENCELADUS, + "galaxyspace.SolarSystem.moons.enceladus.dimension.ChunkProviderEnceladus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Enceladus.DBMDefList)), + Io(new ModDimensionDef( + DimNames.IO, + "galaxyspace.SolarSystem.moons.io.dimension.ChunkProviderIo", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Io.DBMDefList)), + Europa(new ModDimensionDef( + DimNames.EUROPA, + "galaxyspace.SolarSystem.moons.europa.dimension.ChunkProviderEuropa", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Europa.DBMDefList)), + Phobos(new ModDimensionDef( + DimNames.PHOBOS, + "galaxyspace.SolarSystem.moons.phobos.dimension.ChunkProviderPhobos", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Phobos.DBMDefList)), + Venus(new ModDimensionDef( + DimNames.VENUS, + "galaxyspace.SolarSystem.planets.venus.dimension.ChunkProviderVenus", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Venus.DBMDefList)), + Mercury(new ModDimensionDef( + DimNames.MERCURY, + "galaxyspace.SolarSystem.planets.mercury.dimension.ChunkProviderMercury", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Mercury.DBMDefList)), + MakeMake(new ModDimensionDef( + DimNames.MAKEMAKE, + "galaxyspace.SolarSystem.planets.makemake.dimension.ChunkProviderMakemake", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.MakeMake.DBMDefList)), + Haumea(new ModDimensionDef( + DimNames.HAUMEA, + "galaxyspace.SolarSystem.planets.haumea.dimension.ChunkProviderHaumea", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Haumea.DBMDefList)), + CentauriAlpha(new ModDimensionDef( + DimNames.CENTAURIA, + "galaxyspace.ACentauriSystem.planets.aCentauriBb.dimension.ChunkProviderACentauri", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.CentauriAlpha.DBMDefList)), + VegaB(new ModDimensionDef( + DimNames.VEGAB, + "galaxyspace.VegaSystem.planets.vegaB.dimension.ChunkProviderVegaB", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.VegaB.DBMDefList)), + BarnardC(new ModDimensionDef( + DimNames.BARNARDC, + "galaxyspace.BarnardsSystem.planets.barnardaC.dimension.ChunkProviderBarnardaC", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaC.DBMDefList)), + BarnardE(new ModDimensionDef( + DimNames.BARNARDE, + "galaxyspace.BarnardsSystem.planets.barnardaE.dimension.ChunkProviderBarnardaE", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaE.DBMDefList)), + BarnardF(new ModDimensionDef( + DimNames.BARNARDF, + "galaxyspace.BarnardsSystem.planets.barnardaF.dimension.ChunkProviderBarnardaF", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.BarnardaF.DBMDefList)), + TcetiE(new ModDimensionDef( + DimNames.TCETIE, + "galaxyspace.TCetiSystem.planets.tcetiE.dimension.ChunkProviderTCetiE", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.TcetiE.DBMDefList)), + Miranda(new ModDimensionDef( + DimNames.MIRANDA, + "galaxyspace.SolarSystem.moons.miranda.dimension.ChunkProviderMiranda", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Miranda.DBMDefList)), + KuiperBelt(new ModDimensionDef( + DimNames.KUIPERBELT, + "galaxyspace.SolarSystem.planets.kuiperbelt.dimension.ChunkProviderKuiper", + Enums.DimensionType.Asteroid)), + + Neper(new ModDimensionDef( + DimNames.NEPER, + "de.katzenpapst.amunra.world.neper.NeperChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Neper.DBMDefList)), + Maahes(new ModDimensionDef( + DimNames.MAAHES, + "de.katzenpapst.amunra.world.maahes.MaahesChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Maahes.DBMDefList)), + Anubis(new ModDimensionDef( + DimNames.ANUBIS, + "de.katzenpapst.amunra.world.anubis.AnubisChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Anubis.DBMDefList)), + Horus(new ModDimensionDef( + DimNames.HORUS, + "de.katzenpapst.amunra.world.horus.HorusChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Horus.DBMDefList)), + Seth(new ModDimensionDef( + DimNames.SETH, + "de.katzenpapst.amunra.world.seth.SethChunkProvider", + Enums.DimensionType.Planet, + DimensionBlockMetaDefinitionList.Seth.DBMDefList)), + MehenBelt(new ModDimensionDef( + DimNames.MEHENBELT, + "de.katzenpapst.amunra.world.mehen.MehenChunkProvider", + Enums.DimensionType.Asteroid)); + + public static class DimNames { + + public static final String ENDASTEROIDS = "EndAsteroids"; + public static final String MOON = "Moon"; + public static final String MARS = "Mars"; + public static final String ASTEROIDS = "Asteroids"; + public static final String PLUTO = "Pluto"; + public static final String TRITON = "Triton"; + public static final String PROTEUS = "Proteus"; + public static final String OBERON = "Oberon"; + public static final String TITAN = "Titan"; + public static final String ROSS128B = "Ross128b"; + public static final String ROSS128BA = "Ross128ba"; + public static final String CALLISTO = "Callisto"; + public static final String GANYMEDE = "Ganymede"; + public static final String CERES = "Ceres"; + public static final String DEIMOS = "Deimos"; + public static final String ENCELADUS = "Enceladus"; + public static final String IO = "Io"; + public static final String EUROPA = "Europa"; + public static final String PHOBOS = "Phobos"; + public static final String VENUS = "Venus"; + public static final String MERCURY = "Mercury"; + public static final String MAKEMAKE = "MakeMake"; + public static final String HAUMEA = "Haumea"; + public static final String CENTAURIA = "CentauriA"; + public static final String VEGAB = "VegaB"; + public static final String BARNARDC = "BarnardC"; + public static final String BARNARDE = "BarnardE"; + public static final String BARNARDF = "BarnardF"; + public static final String TCETIE = "TcetiE"; + public static final String MIRANDA = "Miranda"; + public static final String KUIPERBELT = "Kuiperbelt"; + public static final String NEPER = "Neper"; + public static final String MAAHES = "Maahes"; + public static final String ANUBIS = "Anubis"; + public static final String HORUS = "Horus"; + public static final String SETH = "Seth"; + public static final String MEHENBELT = "MehenBelt"; + public static final String DEEPDARK = "Underdark"; + + } + + public final ModDimensionDef modDimensionDef; + + private DimensionDef(ModDimensionDef modDimDef) { + this.modDimensionDef = modDimDef; + } +} diff --git a/src/main/java/bloodasp/galacticgreg/api/enums/ModContainers.java b/src/main/java/bloodasp/galacticgreg/api/enums/ModContainers.java new file mode 100644 index 0000000000..ed81f56f04 --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/enums/ModContainers.java @@ -0,0 +1,19 @@ +package bloodasp.galacticgreg.api.enums; + +import bloodasp.galacticgreg.api.ModContainer; +import gregtech.api.enums.Mods; + +public enum ModContainers { + + GalactiCraftCore(new ModContainer(Mods.GalacticraftCore.ID)), + GalacticraftMars(new ModContainer(Mods.GalacticraftMars.ID)), + GalaxySpace(new ModContainer(Mods.GalaxySpace.ID)), + AmunRa(new ModContainer("GalacticraftAmunRa")), + Vanilla(new ModContainer("Vanilla")); + + public final ModContainer modContainer; + + private ModContainers(ModContainer modContainer) { + this.modContainer = modContainer; + } +} diff --git a/src/main/java/bloodasp/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java b/src/main/java/bloodasp/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java new file mode 100644 index 0000000000..82d8b99b41 --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/enums/properties/AsteroidPropertyBuilder.java @@ -0,0 +1,105 @@ +package bloodasp.galacticgreg.api.enums.properties; + +public class AsteroidPropertyBuilder { + + public int probability; + public int sizeMin, sizeMax; + public int specialBlockChance; + public OreSpawnPropertyBuilder oreSpawn; + public LootPropertyBuilder loot; + + public static class OreSpawnPropertyBuilder { + + public int baseOreChance; + public boolean obeyHeighLimits; + public boolean oresOnlyInsideAsteroids; + public int primaryToRareOreOffset; + public int smallOreChance; + + public OreSpawnPropertyBuilder baseOreChance(int baseOreChance) { + this.baseOreChance = baseOreChance; + return this; + } + + public OreSpawnPropertyBuilder doesObeyingHeightLimits(boolean obeyHeighLimits) { + this.obeyHeighLimits = obeyHeighLimits; + return this; + } + + public OreSpawnPropertyBuilder AreOresOnlyInsideAsteroids(boolean oresOnlyInsideAsteroids) { + this.oresOnlyInsideAsteroids = oresOnlyInsideAsteroids; + return this; + } + + public OreSpawnPropertyBuilder primaryToRareOreOffset(int primaryToRareOreOffset) { + this.primaryToRareOreOffset = primaryToRareOreOffset; + return this; + } + + public OreSpawnPropertyBuilder smallOreChance(int smallOreChance) { + this.smallOreChance = smallOreChance; + return this; + } + + } + + public static class LootPropertyBuilder { + + public int lootChestChance; + public int lootChestItemCount; + public int lootChestTable; + public boolean randomizeLootItemCount; + + public LootPropertyBuilder lootChestChance(int lootChestChance) { + this.lootChestChance = lootChestChance; + return this; + } + + public LootPropertyBuilder lootChestItemCount(int lootChestItemCount) { + this.lootChestItemCount = lootChestItemCount; + return this; + } + + public LootPropertyBuilder lootChestTable(int lootChestTable) { + this.lootChestTable = lootChestTable; + return this; + } + + public LootPropertyBuilder isLootItemCountRandomized(boolean randomizeLootItemCount) { + this.randomizeLootItemCount = randomizeLootItemCount; + return this; + } + + } + + public AsteroidPropertyBuilder() { + oreSpawn = new OreSpawnPropertyBuilder(); + loot = new LootPropertyBuilder(); + } + + public AsteroidPropertyBuilder probability(int probability) { + this.probability = probability; + return this; + } + + public AsteroidPropertyBuilder sizeRange(int sizeMin, int sizeMax) { + this.sizeMin = sizeMin; + this.sizeMax = sizeMax; + return this; + } + + public AsteroidPropertyBuilder specialBlockChance(int specialBlockChance) { + this.specialBlockChance = specialBlockChance; + return this; + } + + public AsteroidPropertyBuilder oreSpawn(OreSpawnPropertyBuilder oreSpawnPropertyBuilder) { + this.oreSpawn = oreSpawnPropertyBuilder; + return this; + } + + public AsteroidPropertyBuilder loot(LootPropertyBuilder lootPropertyBuilder) { + this.loot = lootPropertyBuilder; + return this; + } +} diff --git a/src/main/java/bloodasp/galacticgreg/api/enums/properties/Asteroids.java b/src/main/java/bloodasp/galacticgreg/api/enums/properties/Asteroids.java new file mode 100644 index 0000000000..6a305407cd --- /dev/null +++ b/src/main/java/bloodasp/galacticgreg/api/enums/properties/Asteroids.java @@ -0,0 +1,78 @@ +package bloodasp.galacticgreg.api.enums.properties; + +import bloodasp.galacticgreg.api.enums.DimensionDef; +import bloodasp.galacticgreg.api.enums.ModContainers; + +public enum Asteroids { + + // spotless : off + EndAsteroids(ModContainers.Vanilla, DimensionDef.EndAsteroids, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + KuiperBelt(ModContainers.GalaxySpace, DimensionDef.KuiperBelt, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + MehenBelt(ModContainers.AmunRa, DimensionDef.MehenBelt, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))), + Asteroids(ModContainers.GalacticraftMars, DimensionDef.Asteroids, new AsteroidPropertyBuilder().probability(200) + .sizeRange(5, 15) + .specialBlockChance(5) + .oreSpawn( + new AsteroidPropertyBuilder.OreSpawnPropertyBuilder().baseOreChance(5) + .doesObeyingHeightLimits(false) + .AreOresOnlyInsideAsteroids(false) + .primaryToRareOreOffset(5) + .smallOreChance(10)) + .loot( + new AsteroidPropertyBuilder.LootPropertyBuilder().lootChestChance(1) + .lootChestItemCount(10) + .lootChestTable(3) + .isLootItemCountRandomized(true))),; + + // spotless : on + + public ModContainers modContainers; + public DimensionDef dimensionDef; + public AsteroidPropertyBuilder asteroidPropertyBuilder; + + private Asteroids(ModContainers modContainers, DimensionDef dimensionDef, + AsteroidPropertyBuilder asteroidPropertyBuilder) { + this.modContainers = modContainers; + this.dimensionDef = dimensionDef; + this.asteroidPropertyBuilder = asteroidPropertyBuilder; + } +} diff --git a/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_Layer_Space.java b/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_Layer_Space.java deleted file mode 100644 index 822c9dfa59..0000000000 --- a/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_Layer_Space.java +++ /dev/null @@ -1,253 +0,0 @@ -package bloodasp.galacticgreg.bartworks; - -import static bloodasp.galacticgreg.GalacticGreg.oreVeinWorldgenList; - -import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres; -import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; - -import bloodasp.galacticgreg.GT_TileEntity_Ores_Space; -import bloodasp.galacticgreg.api.Enums; -import bloodasp.galacticgreg.api.ModDBMDef; -import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.dynconfig.DynamicOreMixWorldConfig; -import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.ISubTagContainer; -import gregtech.common.blocks.GT_TileEntity_Ores; - -public class BW_Worldgen_Ore_Layer_Space extends BW_OreLayer { - - private ModDimensionDef pDimensionDef; - private String name; - private DynamicOreMixWorldConfig _mDynWorldConfig; - - /** - * Code-only Constructor Will work with NEI - * - * @param aName veinname, should start with mix. - * @param pDefault enabled? - * @param pMinY - * @param pMaxY - * @param pWeight - * @param pDensity - * @param pSize 5-32 at max - * @param primaryBW either a werkstoff or a materials - * @param secondaryBW either a werkstoff or a materials - * @param betweenBW either a werkstoff or a materials - * @param sporadicBW either a werkstoff or a materials - */ - public BW_Worldgen_Ore_Layer_Space(String aName, boolean pDefault, int pMinY, int pMaxY, int pWeight, int pDensity, - int pSize, ISubTagContainer primaryBW, ISubTagContainer secondaryBW, ISubTagContainer betweenBW, - ISubTagContainer sporadicBW) { - super(aName, pDefault, 0, 0, 0, 0, 0, primaryBW, secondaryBW, betweenBW, sporadicBW); - mMinY = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math.max( - this.mMinY + 5, - GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "MaxHeight", pMaxY))); - mWeight = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "RandomWeight", pWeight)); - mDensity = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "Density", pDensity)); - mSize = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "Size", pSize))); - if (mEnabled) { - sWeight += this.mWeight; - oreVeinWorldgenList.add(this); - } - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName, true); - _mDynWorldConfig.InitDynamicConfig(); - - StringBuilder ret = new StringBuilder(); - for (Map.Entry<String, Boolean> key : _mDynWorldConfig.get_mDynWorldConfigMap() - .entrySet() - .stream() - .filter(Map.Entry::getValue) - .collect(Collectors.toSet())) - ret.append( - key.getKey() - .split("_")[1]) - .append("; "); - name = ret.substring(0, ret.length() - 1); - } - - /** - * Script Friendly Constructor, WONT WORK WITH NEI - * - * @param aName - * @param pDefault - * @param pMinY - * @param pMaxY - * @param pWeight - * @param pDensity - * @param pSize - * @param pPrimary - * @param pSecondary - * @param pBetween - * @param pSporadic - * @param primaryBW - * @param secondaryBW - * @param betweenBW - * @param sporadicBW - */ - public BW_Worldgen_Ore_Layer_Space(String aName, boolean pDefault, int pMinY, int pMaxY, int pWeight, int pDensity, - int pSize, int pPrimary, int pSecondary, int pBetween, int pSporadic, boolean primaryBW, boolean secondaryBW, - boolean betweenBW, boolean sporadicBW) { - super( - aName, - pDefault, - 0, - 0, - 0, - 0, - 0, - primaryBW ? Werkstoff.default_null_Werkstoff : Materials._NULL, - secondaryBW ? Werkstoff.default_null_Werkstoff : Materials._NULL, - betweenBW ? Werkstoff.default_null_Werkstoff : Materials._NULL, - sporadicBW ? Werkstoff.default_null_Werkstoff : Materials._NULL); - mMinY = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math.max( - this.mMinY + 5, - GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "MaxHeight", pMaxY))); - mWeight = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "RandomWeight", pWeight)); - mDensity = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "Density", pDensity)); - mSize = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "Size", pSize))); - mPrimaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "OrePrimaryLayer", pPrimary)); - mSecondaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "OreSecondaryLayer", pSecondary)); - mBetweenMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "OreSporadiclyInbetween", pBetween)); - mSporadicMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "OreSporaticlyAround", pSporadic)); - bwOres = ((byte) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "BWGTlogic", bwOres)); - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName, true); - _mDynWorldConfig.InitDynamicConfig(); - StringBuilder ret = new StringBuilder(); - for (Map.Entry<String, Boolean> key : _mDynWorldConfig.get_mDynWorldConfigMap() - .entrySet() - .stream() - .filter(Map.Entry::getValue) - .collect(Collectors.toSet())) - ret.append( - key.getKey() - .split("_")[1]) - .append("; "); - name = ret.length() == 0 ? "" : ret.substring(0, ret.length() - 1); - if (mEnabled) { - sWeight += this.mWeight; - oreVeinWorldgenList.add(this); - } - } - - /** - * Script Friendly Constructor, WONT WORK WITH NEI - * - * @param aName - * @param enabled - */ - public BW_Worldgen_Ore_Layer_Space(String aName, boolean enabled) { - this(aName, enabled, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, true, true, true); - } - - public boolean isEnabledForDim(ModDimensionDef pDimensionDef) { - return _mDynWorldConfig.isEnabledInDim(pDimensionDef); - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - ModDimensionDef tMDD = GalacticGregRegistry.getDimensionTypeByChunkGenerator(aChunkGenerator); - if (tMDD == null) return false; - pDimensionDef = tMDD; - return super.executeWorldgen( - aWorld, - aRandom, - aBiome, - aDimensionType, - aChunkX, - aChunkZ, - aChunkGenerator, - aChunkProvider); - } - - public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { - TileEntity te = aWorld.getTileEntity(aX, aY, aZ); - if (!(te instanceof BW_MetaGeneratedOreTE) && !(te instanceof GT_TileEntity_Ores)) { - if (aMetaData == this.mSporadicMeta && (this.bwOres & 1) != 0 - || aMetaData == this.mBetweenMeta && (this.bwOres & 2) != 0 - || aMetaData == this.mPrimaryMeta && (this.bwOres & 8) != 0 - || aMetaData == this.mSecondaryMeta && (this.bwOres & 4) != 0) { - boolean wasSet; - for (ModDBMDef e : pDimensionDef.getReplaceableBlocks()) { - wasSet = isSmallOre - ? BW_MetaGenerated_SmallOres.setOreBlock( - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir, - (Block) Block.blockRegistry.getObject(e.getBlockName()), - new int[] { e.getMeta() }) - : BW_MetaGenerated_Ores.setOreBlock( - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir, - (Block) Block.blockRegistry.getObject(e.getBlockName()), - new int[] { e.getMeta() }); - if (wasSet) return true; - } - return false; - } else { - return GT_TileEntity_Ores_Space.setOuterSpaceOreBlock( - pDimensionDef, - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir); - } - } else { - return true; - } - } - - @Override - public Block getDefaultBlockToReplace() { - return null; - } - - @Override - public int[] getDefaultDamageToReplace() { - return null; - } - - @Override - public String getDimName() { - return name; - } - -} diff --git a/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_SmallOre_Space.java b/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_SmallOre_Space.java deleted file mode 100644 index 78f169e054..0000000000 --- a/src/main/java/bloodasp/galacticgreg/bartworks/BW_Worldgen_Ore_SmallOre_Space.java +++ /dev/null @@ -1,165 +0,0 @@ -package bloodasp.galacticgreg.bartworks; - -import static bloodasp.galacticgreg.GalacticGreg.smallOreWorldgenList; - -import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres; -import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; - -import bloodasp.galacticgreg.GT_TileEntity_Ores_Space; -import bloodasp.galacticgreg.api.Enums; -import bloodasp.galacticgreg.api.ModDBMDef; -import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.dynconfig.DynamicOreMixWorldConfig; -import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.ISubTagContainer; -import gregtech.common.blocks.GT_TileEntity_Ores; - -public class BW_Worldgen_Ore_SmallOre_Space extends BW_OreLayer { - - private ModDimensionDef pDimensionDef; - private DynamicOreMixWorldConfig _mDynWorldConfig; - private String name; - - public BW_Worldgen_Ore_SmallOre_Space(String aName, boolean pDefault, int pMinY, int pMaxY, int pDensity, - int pPrimary, ISubTagContainer primaryBW) { - super(aName, pDefault, 0, 0, 0, 0, 0, primaryBW, Materials._NULL, Materials._NULL, Materials._NULL); - mMinY = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "MinHeight", pMinY)); - mMaxY = ((short) Math.max( - this.mMinY + 1, - GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "MaxHeight", pMaxY))); - mDensity = ((short) Math.max( - 1, - GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + this.mWorldGenName, "Amount", pDensity))); - mPrimaryMeta = ((short) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "Meta", pPrimary)); - bwOres = ((byte) GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + this.mWorldGenName, "BWGTlogic", bwOres)); - _mDynWorldConfig = new DynamicOreMixWorldConfig(mWorldGenName, true); - _mDynWorldConfig.InitDynamicConfig(); - StringBuilder ret = new StringBuilder(); - for (Map.Entry<String, Boolean> key : _mDynWorldConfig.get_mDynWorldConfigMap() - .entrySet() - .stream() - .filter(Map.Entry::getValue) - .collect(Collectors.toSet())) - ret.append( - key.getKey() - .split("_")[1]) - .append("; "); - name = ret.length() == 0 ? "" : ret.substring(0, ret.length() - 1); - if (mEnabled) { - smallOreWorldgenList.add(this); - } - - } - - /** - * Script Friendly Constructor, WONT WORK WITH NEI - * - * @param aName - * @param enabled - */ - public BW_Worldgen_Ore_SmallOre_Space(String aName, boolean enabled) { - this(aName, enabled, 0, 0, 0, 0, enabled ? Werkstoff.default_null_Werkstoff : Materials._NULL); - } - - public boolean isEnabledForDim(ModDimensionDef pDimensionDef) { - return _mDynWorldConfig.isEnabledInDim(pDimensionDef); - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - ModDimensionDef tMDD = GalacticGregRegistry.getDimensionTypeByChunkGenerator(aChunkGenerator); - if (tMDD == null) return false; - pDimensionDef = tMDD; - if (this.mPrimaryMeta > 0) - for (int i = 0, j = Math.max(1, this.mDensity / 2 + aRandom.nextInt(this.mDensity) / 2); i < j; i++) { - this.setOreBlock( - aWorld, - aChunkX + aRandom.nextInt(16), - this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), - aChunkZ + aRandom.nextInt(16), - this.mPrimaryMeta, - true); - } - return true; - } - - @Override - public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { - TileEntity te = aWorld.getTileEntity(aX, aY, aZ); - if (!(te instanceof BW_MetaGeneratedOreTE) && !(te instanceof GT_TileEntity_Ores)) { - if (aMetaData == this.mSporadicMeta && (this.bwOres & 1) != 0 - || aMetaData == this.mBetweenMeta && (this.bwOres & 2) != 0 - || aMetaData == this.mPrimaryMeta && (this.bwOres & 8) != 0 - || aMetaData == this.mSecondaryMeta && (this.bwOres & 4) != 0) { - boolean wasSet; - for (ModDBMDef e : pDimensionDef.getReplaceableBlocks()) { - wasSet = isSmallOre - ? BW_MetaGenerated_SmallOres.setOreBlock( - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir, - (Block) Block.blockRegistry.getObject(e.getBlockName()), - new int[] { e.getMeta() }) - : BW_MetaGenerated_Ores.setOreBlock( - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir, - (Block) Block.blockRegistry.getObject(e.getBlockName()), - new int[] { e.getMeta() }); - if (wasSet) return true; - } - return false; - } else { - return GT_TileEntity_Ores_Space.setOuterSpaceOreBlock( - pDimensionDef, - aWorld, - aX, - aY, - aZ, - aMetaData, - pDimensionDef.getAirSetting() == Enums.AirReplaceRule.AllowReplaceAir); - } - } else { - return true; - } - } - - @Override - public Block getDefaultBlockToReplace() { - return null; - } - - @Override - public int[] getDefaultDamageToReplace() { - return null; - } - - @Override - public String getDimName() { - return name; - } -} diff --git a/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicDimensionConfig.java b/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicDimensionConfig.java index 5c419c7c13..0c57c961af 100644 --- a/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicDimensionConfig.java +++ b/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicDimensionConfig.java @@ -9,14 +9,9 @@ import bloodasp.galacticgreg.GalacticGreg; import bloodasp.galacticgreg.api.Enums.DimensionType; import bloodasp.galacticgreg.api.ModContainer; import bloodasp.galacticgreg.api.ModDimensionDef; +import bloodasp.galacticgreg.api.enums.properties.Asteroids; import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; -/** - * This dynamic config is different to the OreMix one. This is used/bound to the ModDimensionDef, and the - * OreMixWorldConfig is bound to the veins. Don't get confused! - * - */ public class DynamicDimensionConfig { public static class AsteroidConfig { @@ -29,8 +24,6 @@ public class DynamicDimensionConfig { public int SpecialBlockChance; public int SmallOreChance; public boolean ObeyHeightLimits; - public int OreGenMaxY; - public int FloatingAsteroidMinY; public boolean HiddenOres; public int LootChestChance; public int LootChestTable; @@ -40,14 +33,6 @@ public class DynamicDimensionConfig { private static Map<String, AsteroidConfig> _mDynamicAsteroidMap = new HashMap<>(); - private static String getConfigKeyName(ModContainer pMC, ModDimensionDef pMDD) { - return String.format("galacticgreg.asteroids.%s.%s", pMC.getModName(), pMDD.getDimensionName()); - } - - private static String getConfigKeyName(ModContainer pMC, ModDimensionDef pMDD, String pSubCat) { - return String.format("%s.%s", getConfigKeyName(pMC, pMDD), pSubCat); - } - public static AsteroidConfig getAsteroidConfig(ModDimensionDef pDimDef) { return _mDynamicAsteroidMap.getOrDefault(pDimDef.getDimIdentifier(), null); } @@ -59,62 +44,69 @@ public class DynamicDimensionConfig { for (ModDimensionDef mdd : mc.getDimensionList()) { DimensionType dt = mdd.getDimensionType(); - if (dt == DimensionType.Asteroid || dt == DimensionType.AsteroidAndPlanet) { - String tDimIdentifier = mdd.getDimIdentifier(); - if (_mDynamicAsteroidMap.containsKey(tDimIdentifier)) GalacticGreg.Logger.warn( + if (dt != DimensionType.Asteroid) { + continue; + } + String tDimIdentifier = mdd.getDimIdentifier(); + if (_mDynamicAsteroidMap.containsKey(tDimIdentifier)) { + GalacticGreg.Logger.warn( "Found 2 Dimensions with the same Identifier! This should never happen, and you should report this to me. Identifier in question: %s", tDimIdentifier); - else { - AsteroidConfig aConf = new AsteroidConfig(); - aConf.MinSize = GregTech_API.sWorldgenFile.get(getConfigKeyName(mc, mdd), "SizeMin", 5); - aConf.MaxSize = GregTech_API.sWorldgenFile.get(getConfigKeyName(mc, mdd), "SizeMax", 15); - aConf.Probability = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd), "Probability", 200); - aConf.SpecialBlockChance = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd), "SpecialBlockChance", 5); - - aConf.OreChance = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "orespawn"), "BaseOreChance", 5); - aConf.OrePrimaryOffset = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "orespawn"), "PrimaryToRareOreOffset", 5); - aConf.SmallOreChance = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "orespawn"), "SmallOreChance", 10); - aConf.ObeyHeightLimits = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "orespawn"), "ObeyHeightLimits", false); - aConf.HiddenOres = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "orespawn"), "OresOnlyInsideAsteroids", false); - - if (GalacticGreg.GalacticConfig.LootChestsEnabled) { - aConf.LootChestChance = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "loot"), "LootChestChance", 1); - aConf.LootChestTable = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "loot"), "LootChestTable", 3); - aConf.NumLootItems = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "loot"), "LootChestItemCount", 10); - aConf.RandomizeNumLootItems = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "loot"), "RandomizeLootItemCount", true); - } else { - aConf.LootChestChance = 0; - aConf.LootChestTable = 1; - aConf.NumLootItems = 0; - aConf.RandomizeNumLootItems = false; - } - - if (dt == DimensionType.AsteroidAndPlanet) { - int tDefaultMaxY = mdd.getPreConfiguratedGroundOreMaxY(); - int tDefaultMinY = mdd.getPreConfiguratedFloatingAsteroidMinY(); - aConf.OreGenMaxY = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "floating"), "OreGenMaxY", tDefaultMaxY); - aConf.FloatingAsteroidMinY = GregTech_API.sWorldgenFile - .get(getConfigKeyName(mc, mdd, "floating"), "FloatingAsteroidMinY", tDefaultMinY); - } - - if (aConf.MaxSize > 50) GalacticGreg.Logger.warn( - "Asteroid-MaxSize for dimID [%s] is larger than 50. This might cause memory-problems, as the maximum asteroid size will be larger than 50*50*50 blocks", - tDimIdentifier); - _mDynamicAsteroidMap.put(tDimIdentifier, aConf); + continue; + } + + Asteroids AsteroidProperties = null; + for (Asteroids asteroidsConfig : Asteroids.values()) { + if (!asteroidsConfig.modContainers.modContainer.getModName() + .equals(mc.getModName())) { + continue; } + if (!asteroidsConfig.dimensionDef.modDimensionDef.getDimensionName() + .equals(mdd.getDimensionName())) { + continue; + } + AsteroidProperties = asteroidsConfig; + break; + } + if (AsteroidProperties == null) { + GalacticGreg.Logger.error( + "Something went wrong! no properties are existing for Asteroid dim: " + + mdd.getDimensionName() + + " from mod container " + + mc.getModName()); + continue; + } + + AsteroidConfig aConf = new AsteroidConfig(); + + aConf.MinSize = AsteroidProperties.asteroidPropertyBuilder.sizeMin; + aConf.MaxSize = AsteroidProperties.asteroidPropertyBuilder.sizeMax; + aConf.Probability = AsteroidProperties.asteroidPropertyBuilder.probability; + aConf.SpecialBlockChance = AsteroidProperties.asteroidPropertyBuilder.specialBlockChance; + + aConf.OreChance = AsteroidProperties.asteroidPropertyBuilder.oreSpawn.baseOreChance; + aConf.OrePrimaryOffset = AsteroidProperties.asteroidPropertyBuilder.oreSpawn.primaryToRareOreOffset; + aConf.SmallOreChance = AsteroidProperties.asteroidPropertyBuilder.oreSpawn.smallOreChance; + aConf.ObeyHeightLimits = AsteroidProperties.asteroidPropertyBuilder.oreSpawn.obeyHeighLimits; + aConf.HiddenOres = AsteroidProperties.asteroidPropertyBuilder.oreSpawn.oresOnlyInsideAsteroids; + + if (GalacticGreg.GalacticConfig.LootChestsEnabled) { + aConf.LootChestChance = AsteroidProperties.asteroidPropertyBuilder.loot.lootChestChance; + aConf.LootChestTable = AsteroidProperties.asteroidPropertyBuilder.loot.lootChestTable; + aConf.NumLootItems = AsteroidProperties.asteroidPropertyBuilder.loot.lootChestItemCount; + aConf.RandomizeNumLootItems = AsteroidProperties.asteroidPropertyBuilder.loot.randomizeLootItemCount; + } else { + aConf.LootChestChance = 0; + aConf.LootChestTable = 1; + aConf.NumLootItems = 0; + aConf.RandomizeNumLootItems = false; } + + if (aConf.MaxSize > 50) GalacticGreg.Logger.warn( + "Asteroid-MaxSize for dimID [%s] is larger than 50. This might cause memory-problems, as the maximum asteroid size will be larger than 50*50*50 blocks", + tDimIdentifier); + _mDynamicAsteroidMap.put(tDimIdentifier, aConf); + } } return true; @@ -126,7 +118,7 @@ public class DynamicDimensionConfig { /** * Convert numbers to actual loot-table entries - * + * * @param pACfg * @return */ diff --git a/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicOreMixWorldConfig.java b/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicOreMixWorldConfig.java deleted file mode 100644 index 862bfd4e4e..0000000000 --- a/src/main/java/bloodasp/galacticgreg/dynconfig/DynamicOreMixWorldConfig.java +++ /dev/null @@ -1,93 +0,0 @@ -package bloodasp.galacticgreg.dynconfig; - -import java.util.HashMap; -import java.util.Map; - -import bloodasp.galacticgreg.GalacticGreg; -import bloodasp.galacticgreg.api.ModContainer; -import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.registry.GalacticGregRegistry; -import gregtech.api.GregTech_API; - -/** - * This is the dynamic config class for every ore-vein that will generate config values according to the dimension and - * mod name - */ -public class DynamicOreMixWorldConfig { - - private String _mWorldGenName; - - public Map<String, Boolean> get_mDynWorldConfigMap() { - return new HashMap<>(_mDynWorldConfigMap != null ? _mDynWorldConfigMap : new HashMap<>()); - } - - private Map<String, Boolean> _mDynWorldConfigMap; - private final String _mConfigName; - - private String getConfigKeyName(ModContainer pMC, ModDimensionDef pMDD) { - return getConfigKeyName(pMC, pMDD, ""); - } - - private String getConfigKeyName(ModContainer pMC, ModDimensionDef pMDD, String pAdditionalName) { - String tRet = String.format("%s_%s", pMC.getModName(), pMDD.getDimensionName()); - if (pAdditionalName.length() > 1) tRet = String.format("%s_%s", tRet, pAdditionalName); - - return tRet; - } - - /** - * Init a new dynamic config for a given world-generator - * - * @param pWorldGenName - */ - public DynamicOreMixWorldConfig(String pWorldGenName) { - _mWorldGenName = pWorldGenName; - _mDynWorldConfigMap = new HashMap<>(); - _mConfigName = String.format("worldgen.%s", _mWorldGenName); - } - - public DynamicOreMixWorldConfig(String pWorldGenName, boolean bw) { - _mWorldGenName = pWorldGenName; - _mDynWorldConfigMap = new HashMap<>(); - _mConfigName = String.format("worldgen.gagregbartworks.%s", _mWorldGenName); - } - - /** - * Check if this OreGen is enabled for a given Dimension, represented by pMDD - * - * @param pMDD The dimension in question - * @return true or false if *this* oregen is enabled in the worldgen config - */ - public boolean isEnabledInDim(ModDimensionDef pMDD) { - String tDimIdentifier = pMDD.getDimIdentifier(); - return _mDynWorldConfigMap.getOrDefault(tDimIdentifier, false); - } - - /** - * Initializes the dynamic oregen config. This must be called *AFTER* InitModContainers() has done its work - * - * @return true or false if the config init was successfull - */ - public boolean InitDynamicConfig() { - try { - for (ModContainer mc : GalacticGregRegistry.getModContainers()) { - if (!mc.getEnabled()) continue; - - for (ModDimensionDef mdd : mc.getDimensionList()) { - String tDimIdentifier = mdd.getDimIdentifier(); - if (_mDynWorldConfigMap.containsKey(tDimIdentifier)) GalacticGreg.Logger.error( - "Found 2 Dimensions with the same Identifier: %s Dimension will not generate Ores", - tDimIdentifier); - else { - boolean tFlag = GregTech_API.sWorldgenFile.get(_mConfigName, getConfigKeyName(mc, mdd), false); - _mDynWorldConfigMap.put(tDimIdentifier, tFlag); - } - } - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } -} diff --git a/src/main/java/bloodasp/galacticgreg/registry/GalacticGregRegistry.java b/src/main/java/bloodasp/galacticgreg/registry/GalacticGregRegistry.java index b45353da6e..cc0a8146ab 100644 --- a/src/main/java/bloodasp/galacticgreg/registry/GalacticGregRegistry.java +++ b/src/main/java/bloodasp/galacticgreg/registry/GalacticGregRegistry.java @@ -1,5 +1,7 @@ package bloodasp.galacticgreg.registry; +import static bloodasp.galacticgreg.api.enums.ModContainers.Vanilla; + import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -27,7 +29,7 @@ public class GalacticGregRegistry { /** * Register new ModContainer in the registry. Call this after you've populated it with Dimensions and Blocks Must be * called from your own PreInit or Init event - * + * * @param pModContainer * @return */ @@ -55,7 +57,7 @@ public class GalacticGregRegistry { /** * Lookup the registered dimensions and try to find the DimensionDefinition that has the ChunkProvider that we have * here - * + * * @param pChunkProvider * @return */ @@ -86,7 +88,7 @@ public class GalacticGregRegistry { /** * Get all registered modcontainers. Can only be done after the initialization process is done - * + * * @return */ public static Collection<ModContainer> getModContainers() { @@ -113,8 +115,9 @@ public class GalacticGregRegistry { */ private static void InitModContainers() { for (ModContainer mc : _mModContainers.values()) { + // todo: rename Vanilla mod container name from "Vanilla" to "minecraft" if (!Loader.isModLoaded(mc.getModName()) && !mc.getModName() - .equalsIgnoreCase("vanilla")) { + .equals(Vanilla.modContainer.getModName())) { GalacticGreg.Logger.warn( "Ignoring ModRegistration for OreGen: [%s], because mod is not loaded. Did you misspell the name?", mc.getModName()); @@ -134,8 +137,7 @@ public class GalacticGregRegistry { .size()); // Register default generator if dimension is asteroid and no generator was added - if (md.getDimensionType() == DimensionType.AsteroidAndPlanet - || md.getDimensionType() == DimensionType.Asteroid) { + if (md.getDimensionType() == DimensionType.Asteroid) { if (md.getSpaceObjectGenerators() .size() == 0) { GalacticGreg.Logger.debug("No generators found, adding build-in ellipsoid generator"); @@ -156,7 +158,7 @@ public class GalacticGregRegistry { /** * Returns ModContainer for given DimensionDefinition - * + * * @param pDimensionDefinition * @return */ diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java index f394089fb0..015d736321 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_DEHP.java @@ -34,7 +34,6 @@ import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -59,7 +58,7 @@ public class GT_TileEntity_DEHP extends GT_MetaTileEntity_DrillerBase { @Override @SuppressWarnings("rawtypes") - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad() { try { Class c = TileEntityNuclearReactorElectric.class; Field f = c.getDeclaredField("huOutputModifier"); @@ -69,7 +68,7 @@ public class GT_TileEntity_DEHP extends GT_MetaTileEntity_DrillerBase { | IllegalAccessException | NoSuchFieldException e) { e.printStackTrace(); } - super.onConfigLoad(aConfig); + super.onConfigLoad(); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java index 6e0f0543e4..7b70fedfbf 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java @@ -36,7 +36,6 @@ import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.Thorianit; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.VanadioOxyDravit; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.Wittichenit; -import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; import static gregtech.api.enums.Materials.Bismuth; import static gregtech.api.enums.Materials.Coal; import static gregtech.api.enums.Materials.Diamond; @@ -51,8 +50,6 @@ import static gregtech.api.enums.Materials.Uraninite; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidRegistry; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; @@ -193,19 +190,6 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { FuchsitCR); } - public static void initundergroundFluids() { - String ross128b = StatCollector.translateToLocal("planet.Ross128b"); - uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); - uo_dimensionList - .SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 820, 5, 5); - uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); - } - - @Override - public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return aDimensionType == ConfigHandler.ross128BID; - } - @Override public boolean isGenerationAllowed(String aDimName, int aDimensionType, int aAllowedDimensionType) { return aDimensionType == ConfigHandler.ross128BID; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java index 7454b0dd93..b854f771ca 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128ba.java @@ -32,21 +32,17 @@ import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.Tiberium; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.VanadioOxyDravit; import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.Wittichenit; -import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; import static gregtech.api.enums.Materials.Amethyst; import static gregtech.api.enums.Materials.Barite; import static gregtech.api.enums.Materials.Galena; -import static gregtech.api.enums.Materials.Helium_3; import static gregtech.api.enums.Materials.NaquadahEnriched; import static gregtech.api.enums.Materials.Olivine; -import static gregtech.api.enums.Materials.SaltWater; import static gregtech.api.enums.Materials.Scheelite; import static gregtech.api.enums.Materials.Sphalerite; import static gregtech.api.enums.Materials.Tetrahedrite; import net.minecraft.block.Block; import net.minecraft.util.StatCollector; -import net.minecraft.world.World; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; @@ -178,41 +174,6 @@ public class BW_WorldGenRoss128ba extends BW_OreLayer { Barite); } - public static void init_undergroundFluids() { - String ross128b = StatCollector.translateToLocal("moon.Ross128ba"); - uo_dimensionList.SetConfigValues( - ross128b, - ross128b, - SaltWater.getFluid(1) - .getFluid() - .getName(), - SaltWater.getFluid(1) - .getFluid() - .getName(), - 0, - 1250, - 40, - 5); - uo_dimensionList.SetConfigValues( - ross128b, - ross128b, - Helium_3.getGas(1) - .getFluid() - .getName(), - Helium_3.getGas(1) - .getFluid() - .getName(), - 0, - 1250, - 60, - 5); - } - - @Override - public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return aDimensionType == ConfigHandler.ross128BAID; - } - @Override public boolean isGenerationAllowed(String aDimName, int aDimensionType, int aAllowedDimensionType) { return aDimensionType == ConfigHandler.ross128BAID; diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/VoidMinerUtility.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/VoidMinerUtility.java index 5254da24f1..6fb6eb3b18 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/VoidMinerUtility.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/VoidMinerUtility.java @@ -23,8 +23,6 @@ import bloodasp.galacticgreg.GT_Worldgen_GT_Ore_SmallPieces_Space; import bloodasp.galacticgreg.GalacticGreg; import bloodasp.galacticgreg.api.ModContainer; import bloodasp.galacticgreg.api.ModDimensionDef; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_Layer_Space; -import bloodasp.galacticgreg.bartworks.BW_Worldgen_Ore_SmallOre_Space; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -182,11 +180,7 @@ public class VoidMinerUtility { case -1 -> gt_worldgen -> gt_worldgen.mNether; case 0 -> gt_worldgen -> gt_worldgen.mOverworld; case 1 -> gt_worldgen -> gt_worldgen.mEnd || gt_worldgen.mEndAsteroid; - /* - * explicitly giving different dim numbers so that it default to false in the config, keeping compat with - * the current worldgen config - */ - case 7 -> gt_worldgen -> gt_worldgen.isGenerationAllowed("Twilight Forest", 0, 7); + case 7 -> gt_worldgen -> gt_worldgen.twilightForest; default -> throw new IllegalStateException(); }; } @@ -201,11 +195,7 @@ public class VoidMinerUtility { case -1 -> gt_worldgen -> gt_worldgen.mNether; case 0 -> gt_worldgen -> gt_worldgen.mOverworld; case 1 -> gt_worldgen -> gt_worldgen.mEnd; - /* - * explicitly giving different dim numbers so that it default to false in the config, keeping compat with - * the current worldgen config - */ - case 7 -> gt_worldgen -> gt_worldgen.isGenerationAllowed("Twilight Forest", 0, 7); + case 7 -> gt_worldgen -> gt_worldgen.twilightForest; default -> throw new IllegalStateException(); }; } @@ -259,34 +249,6 @@ public class VoidMinerUtility { && oreSmallPiecesSpace.isEnabledForDim(finalDef)) .map(gt_worldgen -> (GT_Worldgen_GT_Ore_SmallPieces_Space) gt_worldgen) .forEach(element -> dropMap.addDrop(element.mMeta, element.mAmount, false)); - - // BW Ore Veins - try { - GalacticGreg.oreVeinWorldgenList.stream() - .filter( - gt_worldgen -> gt_worldgen.mEnabled - && gt_worldgen instanceof BW_Worldgen_Ore_Layer_Space oreLayerSpace - && oreLayerSpace.isEnabledForDim(finalDef)) - .map(gt_worldgen -> (BW_Worldgen_Ore_Layer_Space) gt_worldgen) - .forEach(oreLayer -> { - List<ItemStack> data = oreLayer.getStacks(); - dropMap.addDrop(data.get(0), oreLayer.mWeight); - dropMap.addDrop(data.get(1), oreLayer.mWeight); - dropMap.addDrop(data.get(2), oreLayer.mWeight / 8f); - dropMap.addDrop(data.get(3), oreLayer.mWeight / 8f); - }); - } catch (NullPointerException ignored) {} - - // BW Small Ores - try { - GalacticGreg.smallOreWorldgenList.stream() - .filter( - gt_worldgen -> gt_worldgen.mEnabled - && gt_worldgen instanceof BW_Worldgen_Ore_SmallOre_Space smallOreSpace - && smallOreSpace.isEnabledForDim(finalDef)) - .map(gt_worldgen -> (BW_Worldgen_Ore_SmallOre_Space) gt_worldgen) - .forEach(element -> dropMap.addDrop(element.mPrimaryMeta, element.mDensity, element.bwOres != 0)); - } catch (NullPointerException ignored) {} return dropMap; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java index 972254e2d9..e203246058 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -13,10 +13,7 @@ package com.github.bartimaeusnek.crossmod.galacticraft; -import java.io.File; - import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; import com.github.bartimaeusnek.bartworks.API.SideReference; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; @@ -28,13 +25,9 @@ import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarS import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import gregtech.api.objects.GT_UO_DimensionList; public class GalacticraftProxy { - public static GT_UO_DimensionList uo_dimensionList = new GT_UO_DimensionList(); - static Configuration gtConf; - private GalacticraftProxy() {} public static void postInit(FMLPostInitializationEvent e) { @@ -60,12 +53,6 @@ public class GalacticraftProxy { private static void clientpreInit(FMLPreInitializationEvent e) {} private static void commonpreInit(FMLPreInitializationEvent e) { - GalacticraftProxy.gtConf = new Configuration( - new File(new File(e.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg")); - GalacticraftProxy.uo_dimensionList.getConfig(GalacticraftProxy.gtConf, "undergroundfluid"); - BW_WorldGenRoss128b.initundergroundFluids(); - BW_WorldGenRoss128ba.init_undergroundFluids(); - if (GalacticraftProxy.gtConf.hasChanged()) GalacticraftProxy.gtConf.save(); BW_WorldGenRoss128b.initOres(); BW_WorldGenRoss128ba.init_Ores(); MinecraftForge.EVENT_BUS.register(BWAtmosphereManager.INSTANCE); diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java index cc7de26fb6..5813c3385d 100644 --- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java @@ -206,70 +206,38 @@ public class EyeOfHarmonyRecipe { } private ItemStack getStoneDustType(String key) { - - switch (key) { - case "Ne": - return GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Netherrack, 1); - case "ED": - case "VA": - case "EA": - return GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Endstone, 1); - case "Mo": - return getModItem(NewHorizonsCoreMod.ID, "item.MoonStoneDust", 1); - case "De": - return getModItem(NewHorizonsCoreMod.ID, "item.DeimosStoneDust", 1); - case "Ma": - return getModItem(NewHorizonsCoreMod.ID, "item.MarsStoneDust", 1); - case "Ph": - return getModItem(NewHorizonsCoreMod.ID, "item.PhobosStoneDust", 1); - case "As": - case "KB": - return getModItem(NewHorizonsCoreMod.ID, "item.AsteroidsStoneDust", 1); - case "Ca": - return getModItem(NewHorizonsCoreMod.ID, "item.CallistoStoneDust", 1); - case "Ce": - return getModItem(NewHorizonsCoreMod.ID, "item.CeresStoneDust", 1); - case "Eu": - return getModItem(NewHorizonsCoreMod.ID, "item.EuropaStoneDust", 1); - case "Ga": - return getModItem(NewHorizonsCoreMod.ID, "item.GanymedeStoneDust", 1); - case "Io": - return getModItem(NewHorizonsCoreMod.ID, "item.IoStoneDust", 1); - case "Me": - return getModItem(NewHorizonsCoreMod.ID, "item.MercuryStoneDust", 1); - case "Ve": - return getModItem(NewHorizonsCoreMod.ID, "item.VenusStoneDust", 1); - case "En": - return getModItem(NewHorizonsCoreMod.ID, "item.EnceladusStoneDust", 1); - case "Mi": - return getModItem(NewHorizonsCoreMod.ID, "item.MirandaStoneDust", 1); - case "Ob": - return getModItem(NewHorizonsCoreMod.ID, "item.OberonStoneDust", 1); - case "Ti": - return getModItem(NewHorizonsCoreMod.ID, "item.TitanStoneDust", 1); - case "Pr": - return getModItem(NewHorizonsCoreMod.ID, "item.ProteusStoneDust", 1); - case "Tr": - return getModItem(NewHorizonsCoreMod.ID, "item.TritonStoneDust", 1); - case "Ha": - return getModItem(NewHorizonsCoreMod.ID, "item.HaumeaStoneDust", 1); - case "MM": - return getModItem(NewHorizonsCoreMod.ID, "item.MakeMakeStoneDust", 1); - case "Pl": - return getModItem(NewHorizonsCoreMod.ID, "item.PlutoStoneDust", 1); - case "BE": - return getModItem(NewHorizonsCoreMod.ID, "item.BarnardaEStoneDust", 1); - case "BF": - return getModItem(NewHorizonsCoreMod.ID, "item.BarnardaFStoneDust", 1); - case "CB": - return getModItem(NewHorizonsCoreMod.ID, "item.CentauriAStoneDust", 1); - case "TE": - return getModItem(NewHorizonsCoreMod.ID, "item.TCetiEStoneDust", 1); - case "VB": - return getModItem(NewHorizonsCoreMod.ID, "item.VegaBStoneDust", 1); - default: - return GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1); - } + ItemStack placeholder = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1); + return switch (key) { + case "Ne" -> GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Netherrack, 1); + case "ED", "VA", "EA" -> GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Endstone, 1); + case "Mo" -> getModItem(NewHorizonsCoreMod.ID, "item.MoonStoneDust", 1, placeholder); + case "De" -> getModItem(NewHorizonsCoreMod.ID, "item.DeimosStoneDust", 1, placeholder); + case "Ma" -> getModItem(NewHorizonsCoreMod.ID, "item.MarsStoneDust", 1, placeholder); + case "Ph" -> getModItem(NewHorizonsCoreMod.ID, "item.PhobosStoneDust", 1, placeholder); + case "As", "KB" -> getModItem(NewHorizonsCoreMod.ID, "item.AsteroidsStoneDust", 1, placeholder); + case "Ca" -> getModItem(NewHorizonsCoreMod.ID, "item.CallistoStoneDust", 1, placeholder); + case "Ce" -> getModItem(NewHorizonsCoreMod.ID, "item.CeresStoneDust", 1, placeholder); + case "Eu" -> getModItem(NewHorizonsCoreMod.ID, "item.EuropaStoneDust", 1, placeholder); + case "Ga" -> getModItem(NewHorizonsCoreMod.ID, "item.GanymedeStoneDust", 1, placeholder); + case "Io" -> getModItem(NewHorizonsCoreMod.ID, "item.IoStoneDust", 1, placeholder); + case "Me" -> getModItem(NewHorizonsCoreMod.ID, "item.MercuryStoneDust", 1, placeholder); + case "Ve" -> getModItem(NewHorizonsCoreMod.ID, "item.VenusStoneDust", 1, placeholder); + case "En" -> getModItem(NewHorizonsCoreMod.ID, "item.EnceladusStoneDust", 1, placeholder); + case "Mi" -> getModItem(NewHorizonsCoreMod.ID, "item.MirandaStoneDust", 1, placeholder); + case "Ob" -> getModItem(NewHorizonsCoreMod.ID, "item.OberonStoneDust", 1, placeholder); + case "Ti" -> getModItem(NewHorizonsCoreMod.ID, "item.TitanStoneDust", 1, placeholder); + case "Pr" -> getModItem(NewHorizonsCoreMod.ID, "item.ProteusStoneDust", 1, placeholder); + case "Tr" -> getModItem(NewHorizonsCoreMod.ID, "item.TritonStoneDust", 1, placeholder); + case "Ha" -> getModItem(NewHorizonsCoreMod.ID, "item.HaumeaStoneDust", 1, placeholder); + case "MM" -> getModItem(NewHorizonsCoreMod.ID, "item.MakeMakeStoneDust", 1, placeholder); + case "Pl" -> getModItem(NewHorizonsCoreMod.ID, "item.PlutoStoneDust", 1, placeholder); + case "BE" -> getModItem(NewHorizonsCoreMod.ID, "item.BarnardaEStoneDust", 1, placeholder); + case "BF" -> getModItem(NewHorizonsCoreMod.ID, "item.BarnardaFStoneDust", 1, placeholder); + case "CB" -> getModItem(NewHorizonsCoreMod.ID, "item.CentauriAStoneDust", 1, placeholder); + case "TE" -> getModItem(NewHorizonsCoreMod.ID, "item.TCetiEStoneDust", 1, placeholder); + case "VB" -> getModItem(NewHorizonsCoreMod.ID, "item.VegaBStoneDust", 1, placeholder); + default -> placeholder; + }; } public EyeOfHarmonyRecipe(final GT5OreLayerHelper.NormalOreDimensionWrapper normalOreDimensionWrapper, diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 837c2c5d04..4f1297bd81 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -25,7 +25,6 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.config.Configuration; import net.minecraftforge.oredict.OreDictionary; import org.apache.logging.log4j.LogManager; @@ -33,8 +32,11 @@ import org.apache.logging.log4j.Logger; import com.google.common.base.Stopwatch; import com.google.common.collect.SetMultimap; +import com.gtnewhorizon.gtnhlib.config.ConfigException; +import com.gtnewhorizon.gtnhlib.config.ConfigurationManager; import appeng.api.AEApi; +import bloodasp.galacticgreg.SpaceDimRegisterer; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; @@ -80,6 +82,24 @@ import gregtech.common.GT_DummyWorld; import gregtech.common.GT_Network; import gregtech.common.GT_Proxy; import gregtech.common.GT_RecipeAdder; +import gregtech.common.config.client.ConfigColorModulation; +import gregtech.common.config.client.ConfigInterface; +import gregtech.common.config.client.ConfigPreference; +import gregtech.common.config.client.ConfigRender; +import gregtech.common.config.client.ConfigWaila; +import gregtech.common.config.gregtech.ConfigDebug; +import gregtech.common.config.gregtech.ConfigFeatures; +import gregtech.common.config.gregtech.ConfigGeneral; +import gregtech.common.config.gregtech.ConfigHarvestLevel; +import gregtech.common.config.gregtech.ConfigMachines; +import gregtech.common.config.gregtech.ConfigOreDropBehavior; +import gregtech.common.config.gregtech.ConfigPollution; +import gregtech.common.config.machinestats.ConfigBronzeSolarBoiler; +import gregtech.common.config.machinestats.ConfigMassFabricator; +import gregtech.common.config.machinestats.ConfigMicrowaveEnergyTransmitter; +import gregtech.common.config.machinestats.ConfigSteelSolarBoiler; +import gregtech.common.config.machinestats.ConfigTeleporter; +import gregtech.common.config.worldgen.ConfigEndAsteroids; import gregtech.common.covers.GT_Cover_FacadeAE; import gregtech.common.misc.GT_Command; import gregtech.common.misc.spaceprojects.commands.SPM_Command; @@ -168,6 +188,47 @@ import ic2.api.recipe.RecipeOutput; + " after:gendustry;") public class GT_Mod implements IGT_Mod { + static { + try { + // Client + ConfigurationManager.registerConfig(ConfigColorModulation.class); + ConfigurationManager.registerConfig(ConfigInterface.class); + ConfigurationManager.registerConfig(ConfigPreference.class); + ConfigurationManager.registerConfig(ConfigRender.class); + ConfigurationManager.registerConfig(ConfigWaila.class); + + // GregTech.cfg + ConfigurationManager.registerConfig(ConfigDebug.class); + ConfigurationManager.registerConfig(ConfigFeatures.class); + ConfigurationManager.registerConfig(ConfigGeneral.class); + ConfigurationManager.registerConfig(ConfigHarvestLevel.class); + ConfigurationManager.registerConfig(ConfigMachines.class); + ConfigurationManager.registerConfig(ConfigOreDropBehavior.class); + ConfigurationManager.registerConfig(ConfigPollution.class); + + // MachineStats.cfg + ConfigurationManager.registerConfig(ConfigBronzeSolarBoiler.class); + ConfigurationManager.registerConfig(gregtech.common.config.machinestats.ConfigMachines.class); + ConfigurationManager.registerConfig(ConfigMassFabricator.class); + ConfigurationManager.registerConfig(ConfigMicrowaveEnergyTransmitter.class); + ConfigurationManager.registerConfig(ConfigSteelSolarBoiler.class); + ConfigurationManager.registerConfig(ConfigTeleporter.class); + + // OverPoweredStuff + ConfigurationManager.registerConfig(gregtech.common.config.opstuff.ConfigGeneral.class); + + // Other + ConfigurationManager.registerConfig(gregtech.common.config.other.ConfigGeneral.class); + + // WorldGeneration + ConfigurationManager.registerConfig(ConfigEndAsteroids.class); + ConfigurationManager.registerConfig(gregtech.common.config.worldgen.ConfigGeneral.class); + + } catch (ConfigException e) { + throw new RuntimeException(e); + } + } + public static final int NBT_VERSION = calculateTotalGTVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); @Mod.Instance(Mods.Names.GREG_TECH) @@ -182,6 +243,7 @@ public class GT_Mod implements IGT_Mod { public static int MAX_IC2 = 2147483647; public static GT_Achievements achievements; + @Deprecated public static final String aTextGeneral = "general"; public static final String aTextIC2 = "ic2_"; public static final Logger GT_FML_LOGGER = LogManager.getLogger("GregTech GTNH"); @@ -232,17 +294,16 @@ public class GT_Mod implements IGT_Mod { } } - Configuration tMainConfig = GT_PreLoad.getConfiguration(aEvent.getModConfigurationDirectory()); + GT_PreLoad.getConfiguration(aEvent.getModConfigurationDirectory()); GT_PreLoad.createLogFiles( aEvent.getModConfigurationDirectory() - .getParentFile(), - tMainConfig); + .getParentFile()); gregtechproxy.onPreLoad(); GT_Log.out.println("GT_Mod: Setting Configs"); - GT_PreLoad.loadConfig(tMainConfig); + GT_PreLoad.loadConfig(); new Enchantment_Hazmat(); new Enchantment_EnderDamage(); @@ -250,9 +311,6 @@ public class GT_Mod implements IGT_Mod { Materials.init(); - GT_Log.out.println("GT_Mod: Saving Main Config"); - tMainConfig.save(); - GT_PreLoad.initLocalization( aEvent.getModConfigurationDirectory() .getParentFile()); @@ -353,6 +411,9 @@ public class GT_Mod implements IGT_Mod { LHECoolantRegistry.registerBaseCoolants(); + GT_FML_LOGGER.debug("Registering SpaceDimensions"); + SpaceDimRegisterer.register(); + GregTech_API.sLoadFinished = true; GT_Log.out.println("GT_Mod: Load-Phase finished!"); GT_Log.ore.println("GT_Mod: Load-Phase finished!"); diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index 92e0ef36dd..51bf250659 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -35,10 +35,8 @@ import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; -import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.SoundResource; @@ -231,8 +229,7 @@ public class GregTech_API { /** * The Configuration Objects */ - public static GT_Config sMachineFile = null, sWorldgenFile = null, sMaterialProperties = null, sUnification = null, - sSpecialFile = null, sClientDataFile, sOPStuff = null; + public static GT_Config NEIClientFIle; public static int TICKS_FOR_LAG_AVERAGING = 25, MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = 100; /** @@ -258,11 +255,10 @@ public class GregTech_API { * Getting assigned by the Config */ public static boolean sTimber = true, sDrinksAlwaysDrinkable = false, sMultiThreadedSounds = false, - sDoShowAllItemsInCreative = false, sColoredGUI = true, sMachineMetalGUI = false, sConstantEnergy = true, - sMachineExplosions = true, sMachineFlammable = true, sMachineNonWrenchExplosions = true, - sMachineRainExplosions = true, sMachineThunderExplosions = true, sMachineFireExplosions = true, - sMachineWireFire = true, mOutputRF = false, mInputRF = false, meIOLoaded = false, mRFExplosions = false, - mServerStarted = false; + sDoShowAllItemsInCreative = false, sColoredGUI = true, sMachineMetalGUI = false, sMachineExplosions = true, + sMachineFlammable = true, sMachineNonWrenchExplosions = true, sMachineRainExplosions = true, + sMachineThunderExplosions = true, sMachineFireExplosions = true, sMachineWireFire = true, mOutputRF = false, + mInputRF = false, mRFExplosions = false, mServerStarted = false; public static int mEUtoRF = 360, mRFtoEU = 20; @@ -775,14 +771,7 @@ public class GregTech_API { } public static Comparator<ItemStack> getConfigurationCircuitsComparator() { - return Comparator.comparingInt((ItemStack is) -> { - // By default, the Programmed Circuit should be the earliest configuration circuit to which the - // player is exposed - if (GT_Mod.gregtechproxy.mCircuitsOrder.isEmpty()) - return is.getItem() instanceof GT_IntegratedCircuit_Item ? 0 : 1; - return GT_Mod.gregtechproxy.mCircuitsOrder - .getOrDefault(String.valueOf(GameRegistry.findUniqueIdentifierFor(is.getItem())), Integer.MAX_VALUE); - }) + return Comparator.comparingInt((ItemStack is) -> is.getItem() instanceof GT_IntegratedCircuit_Item ? 0 : 1) .thenComparing(ItemStack::getUnlocalizedName) .thenComparing(ItemStack::getItemDamage); } diff --git a/src/main/java/gregtech/api/enums/ConfigCategories.java b/src/main/java/gregtech/api/enums/ConfigCategories.java index 83deec4f58..0e70e54651 100644 --- a/src/main/java/gregtech/api/enums/ConfigCategories.java +++ b/src/main/java/gregtech/api/enums/ConfigCategories.java @@ -1,5 +1,6 @@ package gregtech.api.enums; +@Deprecated public enum ConfigCategories { news, diff --git a/src/main/java/gregtech/api/enums/Dimensions.java b/src/main/java/gregtech/api/enums/Dimensions.java new file mode 100644 index 0000000000..21dee59977 --- /dev/null +++ b/src/main/java/gregtech/api/enums/Dimensions.java @@ -0,0 +1,33 @@ +package gregtech.api.enums; + +public enum Dimensions { + + Overworld("0"), + Moon("Moon"), + Mercury("Mercury"), + Venus("Venus"), + Mars("Mars"), + Io("Io"), + Europa("Europa"), + Callisto("Callisto"), + Titan("Titan"), + Miranda("Miranda"), + Oberon("oberon"), + Triton("Triton"), + Proteus("Proteus"), + Pluto("Pluto"), + Makemake("Makemake"), + AlphaCentauriBb("aCentauriBb"), + BarnardaC("BarnardaC"), + BarnardaE("BarnardaE"), + BarnardaF("BarnardaF"), + TCetiE("TCetiE"), + Ross128b("Ross128b"), + Ross128ba("Ross128ba"),; + + public final String id; + + private Dimensions(String id) { + this.id = id; + } +} diff --git a/src/main/java/gregtech/api/enums/GTStones.java b/src/main/java/gregtech/api/enums/GTStones.java new file mode 100644 index 0000000000..82d7cb90ce --- /dev/null +++ b/src/main/java/gregtech/api/enums/GTStones.java @@ -0,0 +1,398 @@ +package gregtech.api.enums; + +import gregtech.api.GregTech_API; +import gregtech.common.GT_Worldgen_Stone; +import gregtech.common.StoneBuilder; + +public enum GTStones { + + NetherBlackgraniteTiny(new StoneBuilder().name("nether.stone.blackgranite.tiny") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(-1) + .size(50) + .probability(45) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBlackgraniteSmall(new StoneBuilder().name("nether.stone.blackgranite.small") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(-1) + .size(100) + .probability(60) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBlackgraniteMedium(new StoneBuilder().name("nether.stone.blackgranite.medium") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(-1) + .size(200) + .probability(80) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBlackgraniteLarge(new StoneBuilder().name("nether.stone.blackgranite.large") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(-1) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBlackgraniteHuge(new StoneBuilder().name("nether.stone.blackgranite.huge") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(-1) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherRedgraniteTiny(new StoneBuilder().name("nether.stone.redgranite.tiny") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(-1) + .size(50) + .probability(45) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherRedgraniteSmall(new StoneBuilder().name("nether.stone.redgranite.small") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(-1) + .size(100) + .probability(60) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherRedgraniteMedium(new StoneBuilder().name("nether.stone.redgranite.medium") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(-1) + .size(200) + .probability(80) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherRedgraniteLarge(new StoneBuilder().name("nether.stone.redgranite.large") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(-1) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherRedgraniteHuge(new StoneBuilder().name("nether.stone.redgranite.huge") + .disabledByDefault() + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(-1) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherMarbleTiny(new StoneBuilder().name("nether.stone.marble.tiny") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(-1) + .size(50) + .probability(45) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherMarbleSmall(new StoneBuilder().name("nether.stone.marble.small") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(-1) + .size(100) + .probability(60) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherMarbleMedium(new StoneBuilder().name("nether.stone.marble.medium") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(-1) + .size(200) + .probability(80) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherMarbleLarge(new StoneBuilder().name("nether.stone.marble.large") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(-1) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherMarbleHuge(new StoneBuilder().name("nether.stone.marble.huge") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(-1) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBasaltTiny(new StoneBuilder().name("nether.stone.basalt.tiny") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(-1) + .size(50) + .probability(45) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBasaltSmall(new StoneBuilder().name("nether.stone.basalt.small") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(-1) + .size(100) + .probability(60) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBasaltMedium(new StoneBuilder().name("nether.stone.basalt.medium") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(-1) + .size(200) + .probability(80) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBasaltLarge(new StoneBuilder().name("nether.stone.basalt.large") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(-1) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + NetherBasaltHuge(new StoneBuilder().name("nether.stone.basalt.huge") + .disabledByDefault() + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(-1) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + OverworldBlackgraniteTiny(new StoneBuilder().name("overworld.stone.blackgranite.tiny") + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(0) + .size(75) + .probability(5) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBlackgraniteSmall(new StoneBuilder().name("overworld.stone.blackgranite.small") + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(0) + .size(100) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBlackgraniteMedium(new StoneBuilder().name("overworld.stone.blackgranite.medium") + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(0) + .size(200) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBlackgraniteLarge(new StoneBuilder().name("overworld.stone.blackgranite.large") + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(0) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldBlackgraniteHuge(new StoneBuilder().name("overworld.stone.blackgranite.huge") + .block(GregTech_API.sBlockGranites) + .blockMeta(0) + .dimension(0) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldRedgraniteTiny(new StoneBuilder().name("overworld.stone.redgranite.tiny") + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(0) + .size(75) + .probability(5) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldRedgraniteSmall(new StoneBuilder().name("overworld.stone.redgranite.small") + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(0) + .size(100) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldRedgraniteMedium(new StoneBuilder().name("overworld.stone.redgranite.medium") + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(0) + .size(200) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldRedgraniteLarge(new StoneBuilder().name("overworld.stone.redgranite.large") + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(0) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldRedgraniteHuge(new StoneBuilder().name("overworld.stone.redgranite.huge") + .block(GregTech_API.sBlockGranites) + .blockMeta(8) + .dimension(0) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldMarbleTiny(new StoneBuilder().name("overworld.stone.marble.tiny") + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(0) + .size(75) + .probability(5) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldMarbleSmall(new StoneBuilder().name("overworld.stone.marble.small") + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(0) + .size(100) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldMarbleMedium(new StoneBuilder().name("overworld.stone.marble.medium") + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(0) + .size(200) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldMarbleLarge(new StoneBuilder().name("overworld.stone.marble.large") + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(0) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldMarbleHuge(new StoneBuilder().name("overworld.stone.marble.huge") + .block(GregTech_API.sBlockStones) + .blockMeta(0) + .dimension(0) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldBasaltTiny(new StoneBuilder().name("overworld.stone.basalt.tiny") + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(0) + .size(75) + .probability(5) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBasaltSmall(new StoneBuilder().name("overworld.stone.basalt.small") + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(0) + .size(100) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBasaltMedium(new StoneBuilder().name("overworld.stone.basalt.medium") + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(0) + .size(200) + .probability(10) + .heightRange(0, 180) + .generationInVoidEnabled(false)), + + OverworldBasaltLarge(new StoneBuilder().name("overworld.stone.basalt.large") + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(0) + .size(300) + .probability(70) + .heightRange(0, 120) + .generationInVoidEnabled(false)), + + OverworldBasaltHuge(new StoneBuilder().name("overworld.stone.basalt.huge") + .block(GregTech_API.sBlockStones) + .blockMeta(8) + .dimension(0) + .size(400) + .probability(150) + .heightRange(0, 120) + .generationInVoidEnabled(false)),; + + public final StoneBuilder stone; + + private GTStones(StoneBuilder stone) { + this.stone = stone; + } + + public GT_Worldgen_Stone addGTStone() { + return new GT_Worldgen_Stone(this.stone); + } + +} diff --git a/src/main/java/gregtech/api/enums/ManualOreDictTweaks.java b/src/main/java/gregtech/api/enums/ManualOreDictTweaks.java new file mode 100644 index 0000000000..2392fcb591 --- /dev/null +++ b/src/main/java/gregtech/api/enums/ManualOreDictTweaks.java @@ -0,0 +1,70 @@ +package gregtech.api.enums; + +import static gregtech.api.enums.Mods.Avaritia; +import static gregtech.api.enums.Mods.Botania; +import static gregtech.api.enums.Mods.DraconicEvolution; +import static gregtech.api.enums.Mods.EnderIO; +import static gregtech.api.enums.Mods.GregTech; +import static gregtech.api.enums.Mods.HardcoreEnderExpansion; +import static gregtech.api.enums.Mods.ProjectRedCore; +import static gregtech.api.enums.Mods.RandomThings; +import static gregtech.api.enums.Mods.Thaumcraft; +import static gregtech.api.enums.Mods.Translocator; + +import java.util.HashMap; +import java.util.Map; + +public class ManualOreDictTweaks { + + private static final Map<String, Map<String, Boolean>> oredictLookupTable = new HashMap<>(); + + private static final String[] gregtech = new String[] { "dustAlumina', 'dustNikolite" }; + private static final String[] enderio = new String[] { "ingotDarkSteel" }; + private static final String[] draconicevolution = new String[] { "dustDraconium" }; + private static final String[] thaumcraft = new String[] { + "ingotThaumium', 'ingotVoid', 'nuggetThaumium', 'nuggetVoid" }; + private static final String[] projred_core = new String[] { "dustElectrotine" }; + private static final String[] translocator = new String[] { "nuggetDiamond" }; + private static final String[] hardcoreenderexpansion = new String[] { "ingotHeeEndium" }; + private static final String[] avaritia = new String[] { "ingotCosmicNeutronium', 'ingotInfinity" }; + private static final String[] randomthings = new String[] { "stickObsidian" }; + private static final String[] botania = new String[] { + "ingotElvenElementium', 'ingotManasteel', 'ingotTerrasteel', 'nuggetElvenElementium', 'nuggetManasteel', 'nuggetTerrasteel" }; + + private static final String[] modNames = { GregTech.ID, EnderIO.ID, DraconicEvolution.ID, Thaumcraft.ID, + ProjectRedCore.ID, Translocator.ID, HardcoreEnderExpansion.ID, Avaritia.ID, RandomThings.ID, Botania.ID }; + private static final String[][] array = new String[][] { gregtech, enderio, draconicevolution, thaumcraft, + projred_core, translocator, hardcoreenderexpansion, avaritia, randomthings, botania }; + + static { + initTweakedValues(); + } + + private static void initTweakedValues() { + for (int i = 0; i < array.length; i++) { + HashMap<String, Boolean> modTableLookup = new HashMap<>(); + String name = modNames[i]; + for (String oredict : array[i]) { + modTableLookup.put(oredict, true); + } + oredictLookupTable.put(name, modTableLookup); + } + } + + public static boolean shouldOredictBeOverwritten(String modID, String oredict) { + Map<String, Boolean> modLookupTable = oredictLookupTable.get(modID); + if (modLookupTable == null) { + modLookupTable = new HashMap<>(); + modLookupTable.put(oredict, false); + oredictLookupTable.put(modID, modLookupTable); + return false; + } + Boolean result = modLookupTable.get(oredict); + if (result == null) { + modLookupTable.put(oredict, false); + result = false; + } + return result; + } + +} diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 16553e2d42..e5f9991236 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -13,7 +13,6 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -34,6 +33,7 @@ import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.config.gregtech.ConfigHarvestLevel; import gregtech.common.render.items.CosmicNeutroniumRenderer; import gregtech.common.render.items.GT_GeneratedMaterial_Renderer; import gregtech.common.render.items.GaiaSpiritRenderer; @@ -2574,59 +2574,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } } - private static void addFuelValues(Materials aMaterial, String aConfigPath) { - aMaterial.mFuelPower = GregTech_API.sMaterialProperties.get(aConfigPath, "FuelPower", aMaterial.mFuelPower); - aMaterial.mFuelType = GregTech_API.sMaterialProperties.get(aConfigPath, "FuelType", aMaterial.mFuelType); - } - - private static void addTemperatureValues(Materials aMaterial, String aConfigPath) { - aMaterial.mMeltingPoint = GregTech_API.sMaterialProperties - .get(aConfigPath, "MeltingPoint", aMaterial.mMeltingPoint); - aMaterial.mBlastFurnaceRequired = GregTech_API.sMaterialProperties - .get(aConfigPath, "BlastFurnaceRequired", aMaterial.mBlastFurnaceRequired); - aMaterial.mBlastFurnaceTemp = (short) GregTech_API.sMaterialProperties - .get(aConfigPath, "BlastFurnaceTemp", aMaterial.mBlastFurnaceTemp); - aMaterial.mGasTemp = GregTech_API.sMaterialProperties.get(aConfigPath, "GasTemp", aMaterial.mGasTemp); - aMaterial.setHeatDamage( - (float) GregTech_API.sMaterialProperties.get(aConfigPath, "HeatDamage", aMaterial.mHeatDamage)); - } - - private static void addDensityValues(Materials aMaterial, String aConfigPath) { - aMaterial.mDensityMultiplier = GregTech_API.sMaterialProperties - .get(aConfigPath, "DensityMultiplier", aMaterial.mDensityMultiplier); - aMaterial.mDensityDivider = GregTech_API.sMaterialProperties - .get(aConfigPath, "DensityDivider", aMaterial.mDensityDivider); - aMaterial.mDensity = (long) GregTech_API.sMaterialProperties.get( - aConfigPath, - "Density", - ((double) M * aMaterial.mDensityMultiplier) - / (aMaterial.mDensityDivider != 0 ? aMaterial.mDensityDivider : 1)); - } - - private static void addColorValues(Materials aMaterial, String aConfigPath) { - aMaterial.mTransparent = GregTech_API.sMaterialProperties - .get(aConfigPath, "Transparent", aMaterial.mTransparent); - String aColor = GregTech_API.sMaterialProperties - .get(aConfigPath, "DyeColor", aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString()); - aMaterial.mColor = aColor.equals("None") ? Dyes._NULL : Dyes.get(aColor); - String[] aRGBA = GregTech_API.sMaterialProperties.get( - aConfigPath, - "MatRGBA", - aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," + aMaterial.mRGBa[3] + ",") - .split(","); - aMaterial.mRGBa[0] = Short.parseShort(aRGBA[0]); - aMaterial.mRGBa[1] = Short.parseShort(aRGBA[1]); - aMaterial.mRGBa[2] = Short.parseShort(aRGBA[2]); - aMaterial.mRGBa[3] = Short.parseShort(aRGBA[3]); - } - - private static void addToolValues(Materials aMaterial, String aConfigPath) { - aMaterial.mDurability = GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolDurability", aMaterial.mDurability); - aMaterial.mToolSpeed = (float) GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolSpeed", aMaterial.mToolSpeed); - aMaterial.mToolQuality = (byte) GregTech_API.sMaterialProperties - .get(aConfigPath, "ToolQuality", aMaterial.mToolQuality); + private static void addToolValues(Materials aMaterial) { // Moved from GT_Proxy? (Not sure) aMaterial.mHandleMaterial = (aMaterial == Desh ? aMaterial.mHandleMaterial : aMaterial == Diamond || aMaterial == Thaumium ? Wood @@ -2653,79 +2601,26 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { } } - private static void addEnchantmentValues(Materials aMaterial, String aConfigPath) { - aMaterial.mEnchantmentToolsLevel = (byte) GregTech_API.sMaterialProperties - .get(aConfigPath, "EnchantmentLevel", aMaterial.mEnchantmentToolsLevel); - String aEnchantmentName = GregTech_API.sMaterialProperties.get( - aConfigPath, - "Enchantment", - aMaterial.mEnchantmentTools != null ? aMaterial.mEnchantmentTools.getName() : ""); + private static void addEnchantmentValues(Materials aMaterial) { + String aEnchantmentName = aMaterial.mEnchantmentTools != null ? aMaterial.mEnchantmentTools.getName() : ""; if (aMaterial.mEnchantmentTools != null && !aEnchantmentName.equals(aMaterial.mEnchantmentTools.getName())) IntStream.range(0, Enchantment.enchantmentsList.length) .filter(i -> aEnchantmentName.equals(Enchantment.enchantmentsList[i].getName())) .forEach(i -> aMaterial.mEnchantmentTools = Enchantment.enchantmentsList[i]); } - private static void addProcessingIntoValues(Materials aMaterial, String aConfigPath) { - aMaterial.mSmeltInto = MATERIALS_MAP - .get(GregTech_API.sMaterialProperties.get(aConfigPath, "MaterialSmeltInto", aMaterial.mSmeltInto.mName)); - aMaterial.mMacerateInto = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties.get(aConfigPath, "MaterialMacerateInto", aMaterial.mMacerateInto.mName)); - aMaterial.mArcSmeltInto = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties.get(aConfigPath, "MaterialArcSmeltInto", aMaterial.mArcSmeltInto.mName)); - aMaterial.mDirectSmelting = MATERIALS_MAP.get( - GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialDirectSmeltInto", aMaterial.mDirectSmelting.mName)); - aMaterial.mAutoGenerateBlastFurnaceRecipes = GregTech_API.sMaterialProperties - .get(aConfigPath, "AutoGenerateBlastFurnaceRecipes", aMaterial.mAutoGenerateBlastFurnaceRecipes); - } - - private static void addMultiplierValues(Materials aMaterial, String aConfigPath) { - aMaterial.mOreValue = GregTech_API.sMaterialProperties.get(aConfigPath, "OreValue", aMaterial.mOreValue); - aMaterial.setOreMultiplier( - GregTech_API.sMaterialProperties.get(aConfigPath, "OreMultiplier", aMaterial.mOreMultiplier)); - aMaterial.setSmeltingMultiplier( - GregTech_API.sMaterialProperties.get(aConfigPath, "OreSmeltingMultiplier", aMaterial.mSmeltingMultiplier)); - aMaterial.setByProductMultiplier( - GregTech_API.sMaterialProperties - .get(aConfigPath, "OreByProductMultiplier", aMaterial.mByProductMultiplier)); - } - - private static void addHasGasFluid(Materials aMaterial, String aConfigPath) { - - if (!aMaterial.mIconSet.is_custom) { - aMaterial.mHasPlasma = GregTech_API.sMaterialProperties.get(aConfigPath, "AddPlasma", aMaterial.mHasPlasma); - if (aMaterial.mHasPlasma) { - GT_Mod.gregtechproxy.addAutogeneratedPlasmaFluid(aMaterial); - } - aMaterial.mHasGas = GregTech_API.sMaterialProperties.get(aConfigPath, "AddGas", aMaterial.mHasGas); - if (aMaterial.mHasGas) { - GT_FluidFactory - .of(aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, GAS, aMaterial.mGasTemp); - } + private static void addHasGasFluid(Materials aMaterial) { + if (aMaterial.mIconSet.is_custom) { + return; } - } - private static void addInternalStuff(Materials aMaterial, String aConfigPath) { - aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties - .get(aConfigPath, "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); - aMaterial.mTypes = GregTech_API.sMaterialProperties.get( - aConfigPath, - "MaterialTypes", - aMaterial.mCustomOre ? 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 : aMaterial.mTypes); - aMaterial.mUnificatable = GregTech_API.sMaterialProperties - .get(aConfigPath, "Unificatable", aMaterial.mUnificatable); - aMaterial.mHasParentMod = GregTech_API.sMaterialProperties - .get(aConfigPath, "HasParentMod", aMaterial.mHasParentMod); - } - - private static void addLocalisation(Materials aMaterial, String aConfigPath) { - aMaterial.mDefaultLocalName = GregTech_API.sMaterialProperties.get( - aConfigPath, - "MaterialName", - aMaterial.mCustomOre ? "CustomOre" + aMaterial.mCustomID : aMaterial.mDefaultLocalName); - aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties - .get(aConfigPath, "ChemicalFormula", aMaterial.mChemicalFormula); + if (aMaterial.mHasPlasma) { + GT_Mod.gregtechproxy.addAutogeneratedPlasmaFluid(aMaterial); + } + if (aMaterial.mHasGas) { + GT_FluidFactory + .of(aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, GAS, aMaterial.mGasTemp); + } } private static String getConfigPath(Materials aMaterial) { @@ -2733,135 +2628,32 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { return "materials." + aMaterial.mConfigSection + "." + cOre; } - private static void addHarvestLevelNerfs(Materials aMaterial, String aConfigPath) { + private static void addHarvestLevelNerfs(Materials aMaterial) { /* Moved the harvest level changes from GT_Mod to have fewer things iterating over MATERIALS_ARRAY */ if (GT_Mod.gregtechproxy.mChangeHarvestLevels && aMaterial.mToolQuality > 0 && aMaterial.mMetaItemSubID < GT_Mod.gregtechproxy.mHarvestLevel.length && aMaterial.mMetaItemSubID >= 0) { - GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties - .get(aConfigPath, "HarvestLevel", aMaterial.mToolQuality); + GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] = aMaterial.mToolQuality; } } private static void addHarvestLevels() { - GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties - .get("harvestlevel", "ActivateHarvestLevelChange", false); - GT_Mod.gregtechproxy.mMaxHarvestLevel = Math - .min(15, GregTech_API.sMaterialProperties.get("harvestlevel", "MaxHarvestLevel", 7)); - GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties - .get("harvestlevel", "GraniteHarvestLevel", 3); + GT_Mod.gregtechproxy.mChangeHarvestLevels = ConfigHarvestLevel.activateHarvestLevelChange; + GT_Mod.gregtechproxy.mMaxHarvestLevel = Math.min(15, ConfigHarvestLevel.maxHarvestLevel); + GT_Mod.gregtechproxy.mGraniteHavestLevel = ConfigHarvestLevel.graniteHarvestLevel; } public static void initMaterialProperties() { addHarvestLevels(); for (Materials aMaterial : MATERIALS_MAP.values()) { - if (aMaterial != null && aMaterial != Materials._NULL && aMaterial != Materials.Empty) { - - String aConfigPath = getConfigPath(aMaterial); - - addFuelValues(aMaterial, aConfigPath); - addTemperatureValues(aMaterial, aConfigPath); - addDensityValues(aMaterial, aConfigPath); - addColorValues(aMaterial, aConfigPath); - addToolValues(aMaterial, aConfigPath); - addEnchantmentValues(aMaterial, aConfigPath); - addProcessingIntoValues(aMaterial, aConfigPath); - addMultiplierValues(aMaterial, aConfigPath); - addHasGasFluid(aMaterial, aConfigPath); - addInternalStuff(aMaterial, aConfigPath); - addLocalisation(aMaterial, aConfigPath); - SubTagCalculation(aMaterial, aConfigPath); - OreByProductsCalculation(aMaterial, aConfigPath); - OreReRegistrationsCalculation(aMaterial, aConfigPath); - aspectCalculation(aMaterial, aConfigPath); - addHarvestLevelNerfs(aMaterial, aConfigPath); - } - } - } - - private static void aspectCalculation(Materials aMaterial, String aConfigPath) { - - String aDefaultAspectString = aMaterial.mAspects.stream() - .map(aAspectStack -> aAspectStack.mAspect.toString()) - .collect(Collectors.joining(",", ",", "")); - String aDefaultAspectAmountString = aMaterial.mAspects.stream() - .map(aAspectStack -> String.valueOf(aAspectStack.mAmount)) - .collect(Collectors.joining(",", ",", "")); - - String aConfigAspectString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListTCAspects", aDefaultAspectString); - String aConfigAspectAmountString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListTCAspectAmounts", aDefaultAspectAmountString); - - if (!aConfigAspectString.equals(aDefaultAspectString) - || !aConfigAspectAmountString.equals(aDefaultAspectAmountString)) { - aMaterial.mAspects.clear(); - if (aConfigAspectString.length() > 0) { - String[] aAspects = aConfigAspectString.split(","); - String[] aAspectAmounts = aConfigAspectAmountString.split(","); - for (int i = 0; i < aAspects.length; i++) { - String aAspectString = aAspects[i]; - long aAspectAmount = Long.parseLong(aAspectAmounts[i]); - TC_AspectStack aAspectStack = new TC_AspectStack(TC_Aspects.valueOf(aAspectString), aAspectAmount); - aMaterial.mAspects.add(aAspectStack); - } - } - } - } - - private static void OreReRegistrationsCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultMatReRegString = aMaterial.mOreReRegistrations.stream() - .map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); - String aConfigMatMatReRegString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListMaterialReRegistrations", aDefaultMatReRegString); - if (!aConfigMatMatReRegString.equals(aDefaultMatReRegString)) { - aMaterial.mOreReRegistrations.clear(); - if (aConfigMatMatReRegString.length() > 0) { - Arrays.stream(aConfigMatMatReRegString.split(",")) - .map(MATERIALS_MAP::get) - .filter(Objects::nonNull) - .forEach(aMat -> aMaterial.mOreReRegistrations.add(aMat)); - } - } - } - - private static void OreByProductsCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultMatByProString = aMaterial.mOreByProducts.stream() - .map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); - String aConfigMatByProString = GregTech_API.sMaterialProperties - .get(aConfigPath, "ListMaterialByProducts", aDefaultMatByProString); - if (!aConfigMatByProString.equals(aDefaultMatByProString)) { - aMaterial.mOreByProducts.clear(); - if (aConfigMatByProString.length() > 0) { - Arrays.stream(aConfigMatByProString.split(",")) - .map(MATERIALS_MAP::get) - .filter(Objects::nonNull) - .forEach(aMat -> aMaterial.mOreByProducts.add(aMat)); + if (aMaterial == null || aMaterial == Materials._NULL || aMaterial == Materials.Empty) { + continue; } - } - } - /** - * Converts the pre-defined list of SubTags from a material into a list of SubTag names for setting/getting to/from - * the config. It is then converted to a String[] and finally to a singular String for insertion into the config If - * the config string is different from the default, we then want to clear the Materials SubTags and insert new ones - * from the config string. - */ - private static void SubTagCalculation(Materials aMaterial, String aConfigPath) { - String aDefaultTagString = aMaterial.mSubTags.stream() - .map(aTag -> aTag.mName) - .collect(Collectors.joining(",", ",", "")); - String aConfigTagString = GregTech_API.sMaterialProperties.get(aConfigPath, "ListSubTags", aDefaultTagString); - if (!aConfigTagString.equals(aDefaultTagString)) { - aMaterial.mSubTags.clear(); - if (aConfigTagString.length() > 0) { - Arrays.stream(aConfigTagString.split(",")) - .map(SubTag.sSubTags::get) - .filter(Objects::nonNull) - .forEach(aTag -> aMaterial.mSubTags.add(aTag)); - } + addToolValues(aMaterial); + addEnchantmentValues(aMaterial); + addHasGasFluid(aMaterial); + addHarvestLevelNerfs(aMaterial); } } diff --git a/src/main/java/gregtech/api/enums/Mods.java b/src/main/java/gregtech/api/enums/Mods.java index 28ed17d299..856817d972 100644 --- a/src/main/java/gregtech/api/enums/Mods.java +++ b/src/main/java/gregtech/api/enums/Mods.java @@ -179,14 +179,8 @@ public enum Mods { ZTones(Names.Z_TONES), // Do we keep compat of those? - ArsMagica2(Names.ARS_MAGICA2), - GanysSurface(Names.GANYS_SURFACE), - IndustrialCraft2Classic(Names.INDUSTRIAL_CRAFT2_CLASSIC), - MagicalCrops(Names.MAGICAL_CROPS), Metallurgy(Names.METALLURGY), RotaryCraft(Names.ROTARY_CRAFT), - ThermalExpansion(Names.THERMAL_EXPANSION), - ThermalFondation(Names.THERMAL_FONDATION), UndergroundBiomes(Names.UNDERGROUND_BIOMES), ; @@ -364,14 +358,8 @@ public enum Mods { public static final String Z_TONES = "Ztones"; // Do we keep compat of those mods? - public static final String ARS_MAGICA2 = "arsmagica2"; - public static final String GANYS_SURFACE = "ganyssurface"; - public static final String INDUSTRIAL_CRAFT2_CLASSIC = "IC2-Classic-Spmod"; - public static final String MAGICAL_CROPS = "magicalcrops"; public static final String METALLURGY = "Metallurgy"; public static final String ROTARY_CRAFT = "RotaryCraft"; - public static final String THERMAL_EXPANSION = "ThermalExpansion"; - public static final String THERMAL_FONDATION = "ThermalFoundation"; public static final String UNDERGROUND_BIOMES = "UndergroundBiomes"; } diff --git a/src/main/java/gregtech/api/enums/OreMixes.java b/src/main/java/gregtech/api/enums/OreMixes.java new file mode 100644 index 0000000000..c5c306baab --- /dev/null +++ b/src/main/java/gregtech/api/enums/OreMixes.java @@ -0,0 +1,982 @@ +package gregtech.api.enums; + +import static bloodasp.galacticgreg.api.enums.DimensionDef.*; +import static gregtech.common.OreMixBuilder.NETHER; +import static gregtech.common.OreMixBuilder.OW; +import static gregtech.common.OreMixBuilder.THE_END; +import static gregtech.common.OreMixBuilder.TWILIGHT_FOREST; + +import bloodasp.galacticgreg.GT_Worldgen_GT_Ore_Layer_Space; +import bloodasp.galacticgreg.api.enums.DimensionDef; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import gregtech.common.OreMixBuilder; + +public enum OreMixes { + + // spotless : off + Naquadah(new OreMixBuilder().name("ore.mix.naquadah") + .heightRange(10, 90) + .weight(30) + .density(4) + .size(32) + .enableInDim( + EndAsteroids, + Maahes, + Asteroids, + BarnardE, + BarnardF, + Haumea, + KuiperBelt, + Mercury, + Oberon, + Pluto, + Titan, + VegaB, + Venus) + .primary(Materials.Naquadah) + .secondary(Materials.Naquadah) + .inBetween(Materials.Naquadah) + .sporadic(Materials.NaquadahEnriched)), + + LigniteCoal(new OreMixBuilder().name("ore.mix.lignite") + .heightRange(80, 210) + .weight(160) + .density(7) + .size(32) + .enableInDim(OW) + .enableInDim(BarnardC) + .primary(Materials.Lignite) + .secondary(Materials.Lignite) + .inBetween(Materials.Lignite) + .sporadic(Materials.Coal)), + + Coal(new OreMixBuilder().name("ore.mix.coal") + .heightRange(30, 80) + .weight(80) + .density(5) + .size(32) + .enableInDim(OW, TWILIGHT_FOREST) + .primary(Materials.Coal) + .secondary(Materials.Coal) + .inBetween(Materials.Coal) + .sporadic(Materials.Lignite)), + + Magnetite(new OreMixBuilder().name("ore.mix.magnetite") + .heightRange(60, 180) + .weight(160) + .density(2) + .size(32) + .enableInDim(OW, TWILIGHT_FOREST) + .enableInDim(Seth, BarnardE, Ceres, Deimos, Io, MakeMake, TcetiE) + .primary(Materials.Magnetite) + .secondary(Materials.Magnetite) + .inBetween(Materials.Iron) + .sporadic(Materials.VanadiumMagnetite)), + + Gold(new OreMixBuilder().name("ore.mix.gold") + .heightRange(30, 60) + .weight(160) + .density(2) + .size(32) + .enableInDim(OW, THE_END, TWILIGHT_FOREST) + .enableInDim(EndAsteroids, Seth, Asteroids, Mars, BarnardF, Callisto, Phobos, Pluto, TcetiE, Triton, VegaB) + .primary(Materials.Magnetite) + .secondary(Materials.Magnetite) + .inBetween(Materials.VanadiumMagnetite) + .sporadic(Materials.Gold)), + + Iron(new OreMixBuilder().name("ore.mix.iron") + .heightRange(10, 40) + .weight(120) + .density(3) + .size(24) + .enableInDim(OW, NETHER, TWILIGHT_FOREST) + .enableInDim(Mars, Callisto, Ceres, Ganymede, Mercury, Oberon, Pluto) + .primary(Materials.BrownLimonite) + .secondary(Materials.YellowLimonite) + .inBetween(Materials.BandedIron) + .sporadic(Materials.Malachite)), + + Cassiterite(new OreMixBuilder().name("ore.mix.cassiterite") + .heightRange(60, 220) + .weight(50) + .density(4) + .size(24) + .enableInDim(EndAsteroids, MehenBelt, Seth, Moon, Io, Miranda, TcetiE, Venus) + .enableInDim(OW, THE_END, TWILIGHT_FOREST) + .primary(Materials.Tin) + .secondary(Materials.Tin) + .inBetween(Materials.Cassiterite) + .sporadic(Materials.Tin)), + + Tetrahedrite(new OreMixBuilder().name("ore.mix.tetrahedrite") + .heightRange(80, 120) + .weight(70) + .density(3) + .size(24) + .enableInDim(NETHER, THE_END) + .enableInDim(EndAsteroids, Asteroids, Mars, CentauriAlpha, Deimos, Ganymede, KuiperBelt, Miranda, VegaB, Venus) + .primary(Materials.Tetrahedrite) + .secondary(Materials.Tetrahedrite) + .inBetween(Materials.Copper) + .sporadic(Materials.Stibnite)), + + NetherQuartz(new OreMixBuilder().name("ore.mix.netherquartz") + .heightRange(40, 80) + .weight(80) + .density(4) + .size(24) + .enableInDim(NETHER) + .enableInDim(Neper, CentauriAlpha) + .primary(Materials.NetherQuartz) + .secondary(Materials.NetherQuartz) + .inBetween(Materials.NetherQuartz) + .sporadic(Materials.Quartzite)), + + Sulfur(new OreMixBuilder().name("ore.mix.sulfur") + .heightRange(5, 20) + .weight(100) + .density(4) + .size(24) + .enableInDim(NETHER) + .enableInDim(Anubis, Mars, CentauriAlpha, Deimos, Io, Phobos, Venus) + .primary(Materials.Sulfur) + .secondary(Materials.Sulfur) + .inBetween(Materials.Pyrite) + .sporadic(Materials.Sphalerite)), + + Copper(new OreMixBuilder().name("ore.mix.copper") + .heightRange(5, 60) + .weight(80) + .density(3) + .size(24) + .enableInDim(EndAsteroids, Moon, BarnardE, BarnardF, Callisto, Ceres, Enceladus, Proteus) + .enableInDim(OW, NETHER, THE_END) + .primary(Materials.Chalcopyrite) + .secondary(Materials.Iron) + .inBetween(Materials.Pyrite) + .sporadic(Materials.Copper)), + + Bauxite(new OreMixBuilder().name("ore.mix.bauxite") + .heightRange(10, 80) + .weight(80) + .density(3) + .size(24) + .enableInDim( + Seth, + Moon, + Asteroids, + Ganymede, + Haumea, + KuiperBelt, + MakeMake, + Mercury, + Phobos, + Pluto, + Proteus, + TcetiE, + Titan) + .primary(Materials.Bauxite) + .secondary(Materials.Ilmenite) + .inBetween(Materials.Aluminium) + .sporadic(Materials.Ilmenite)), + + Salts(new OreMixBuilder().name("ore.mix.salts") + .heightRange(50, 70) + .weight(50) + .density(2) + .size(24) + .enableInDim(OW, TWILIGHT_FOREST) + .enableInDim(Mars, BarnardC, TcetiE) + .primary(Materials.RockSalt) + .secondary(Materials.Salt) + .inBetween(Materials.Lepidolite) + .sporadic(Materials.Spodumene)), + + Redstone(new OreMixBuilder().name("ore.mix.redstone") + .heightRange(5, 40) + .weight(60) + .density(2) + .size(24) + .enableInDim(OW, NETHER) + .enableInDim(Mars, BarnardF, CentauriAlpha, Ganymede, Mercury, Miranda, VegaB, Venus) + .primary(Materials.Redstone) + .secondary(Materials.Redstone) + .inBetween(Materials.Ruby) + .sporadic(Materials.Cinnabar)), + + Soapstone(new OreMixBuilder().name("ore.mix.soapstone") + .heightRange(20, 50) + .weight(40) + .density(2) + .size(16) + .enableInDim(OW, TWILIGHT_FOREST) + .enableInDim(Anubis, Maahes, Ceres) + .primary(Materials.Soapstone) + .secondary(Materials.Talc) + .inBetween(Materials.Glauconite) + .sporadic(Materials.Pentlandite)), + + Nickel(new OreMixBuilder().name("ore.mix.nickel") + .heightRange(10, 40) + .weight(40) + .density(2) + .size(16) + .enableInDim(THE_END, TWILIGHT_FOREST) + .enableInDim(EndAsteroids, MehenBelt, Mars, Deimos, KuiperBelt, Phobos, Titan, Triton, Venus) + .primary(Materials.Garnierite) + .secondary(Materials.Nickel) + .inBetween(Materials.Cobaltite) + .sporadic(Materials.Pentlandite)), + + Platinum(new OreMixBuilder().name("ore.mix.platinum") + .heightRange(40, 50) + .weight(5) + .density(2) + .size(16) + .enableInDim(EndAsteroids, Maahes, MehenBelt) + .primary(Materials.Cooperite) + .secondary(Materials.Palladium) + .inBetween(Materials.Platinum) + .sporadic(Materials.Iridium)), + + Pitchblende(new OreMixBuilder().name("ore.mix.pitchblende") + .heightRange(60, 60) + .weight(40) + .density(2) + .size(16) + .enableInDim(Mars, BarnardF, CentauriAlpha, Haumea, Io, KuiperBelt, MakeMake, Oberon, Phobos, VegaB, Venus) + .primary(Materials.Pitchblende) + .secondary(Materials.Pitchblende) + .inBetween(Materials.Uraninite) + .sporadic(Materials.Uraninite)), + + Monazite(new OreMixBuilder().name("ore.mix.monazite") + .heightRange(20, 40) + .weight(30) + .density(2) + .size(16) + .enableInDim(Seth, Moon, BarnardF, Callisto, Deimos, Enceladus, Haumea, Io, MakeMake, Titan, Triton, Venus) + .primary(Materials.Bastnasite) + .secondary(Materials.Bastnasite) + .inBetween(Materials.Monazite) + .sporadic(Materials.Neodymium)), + + Molybdenum(new OreMixBuilder().name("ore.mix.molybdenum") + .heightRange(20, 50) + .weight(5) + .density(2) + .size(16) + .enableInDim(NETHER, THE_END, TWILIGHT_FOREST) + .enableInDim(EndAsteroids, Moon, BarnardE, Ceres, Mercury, Phobos, Pluto, Proteus, Titan) + .primary(Materials.Wulfenite) + .secondary(Materials.Molybdenite) + .inBetween(Materials.Molybdenum) + .sporadic(Materials.Powellite)), + + Tungstate(new OreMixBuilder().name("ore.mix.tungstate") + .heightRange(20, 60) + .weight(10) + .density(2) + .size(16) + .enableInDim( + EndAsteroids, + Asteroids, + Mars, + Callisto, + Deimos, + Enceladus, + Ganymede, + Haumea, + KuiperBelt, + MakeMake, + Oberon, + Pluto, + Triton, + VegaB) + .primary(Materials.Scheelite) + .secondary(Materials.Scheelite) + .inBetween(Materials.Tungstate) + .sporadic(Materials.Lithium)), + + Sapphire(new OreMixBuilder().name("ore.mix.sapphire") + .heightRange(10, 40) + .weight(60) + .density(2) + .size(16) + .enableInDim(TWILIGHT_FOREST) + .enableInDim(Horus) + .primary(Materials.Almandine) + .secondary(Materials.Pyrope) + .inBetween(Materials.Sapphire) + .sporadic(Materials.GreenSapphire)), + + Manganese(new OreMixBuilder().name("ore.mix.manganese") + .heightRange(20, 30) + .weight(20) + .density(2) + .size(16) + .enableInDim(OW, NETHER) + .enableInDim(EndAsteroids, BarnardE, BarnardF, CentauriAlpha, Ceres, Io, Oberon, Titan, Triton) + .primary(Materials.Grossular) + .secondary(Materials.Spessartine) + .inBetween(Materials.Pyrolusite) + .sporadic(Materials.Tantalite)), + + Quartz(new OreMixBuilder().name("ore.mix.quartz") + .heightRange(80, 120) + .weight(20) + .density(2) + .size(16) + .enableInDim(NETHER) + .enableInDim(Neper) + .primary(Materials.Quartzite) + .secondary(Materials.Barite) + .inBetween(Materials.CertusQuartz) + .sporadic(Materials.CertusQuartz)), + + Diamond(new OreMixBuilder().name("ore.mix.diamond") + .heightRange(5, 20) + .weight(40) + .density(1) + .size(16) + .enableInDim(BarnardF, Ganymede, KuiperBelt, Mercury, Miranda, Phobos, Pluto, Proteus, Titan) + .enableInDim(OW, TWILIGHT_FOREST) + .primary(Materials.Graphite) + .secondary(Materials.Graphite) + .inBetween(Materials.Diamond) + .sporadic(Materials.Coal)), + + Olivine(new OreMixBuilder().name("ore.mix.olivine") + .heightRange(10, 40) + .weight(60) + .density(2) + .size(16) + .enableInDim(TWILIGHT_FOREST) + .enableInDim(EndAsteroids, Anubis, MehenBelt, BarnardE, Ceres, Haumea, MakeMake) + .primary(Materials.Bentonite) + .secondary(Materials.Magnesite) + .inBetween(Materials.Olivine) + .sporadic(Materials.Glauconite)), + + Apatite(new OreMixBuilder().name("ore.mix.apatite") + .heightRange(40, 60) + .weight(60) + .density(2) + .size(16) + .enableInDim(TcetiE.modDimensionDef.getDimensionName(), OW, OreMixBuilder.TWILIGHT_FOREST) + .primary(Materials.Apatite) + .secondary(Materials.Apatite) + .inBetween(Materials.TricalciumPhosphate) + .sporadic(Materials.Pyrochlore)), + + Galena(new OreMixBuilder().name("ore.mix.galena") + .heightRange(5, 45) + .weight(40) + .density(4) + .size(16) + .enableInDim(Moon, Mars, Ganymede, Oberon, Triton, VegaB, Venus) + .primary(Materials.Galena) + .secondary(Materials.Galena) + .inBetween(Materials.Silver) + .sporadic(Materials.Lead)), + + Lapis(new OreMixBuilder().name("ore.mix.lapis") + .heightRange(20, 50) + .weight(40) + .density(4) + .size(16) + .enableInDim(OW, TWILIGHT_FOREST) + .enableInDim(EndAsteroids, MehenBelt, Ceres, Deimos, Enceladus, VegaB) + .primary(Materials.Lazurite) + .secondary(Materials.Sodalite) + .inBetween(Materials.Lapis) + .sporadic(Materials.Calcite)), + + Beryllium(new OreMixBuilder().name("ore.mix.beryllium") + .heightRange(5, 30) + .weight(30) + .density(2) + .size(16) + .enableInDim(OreMixBuilder.NETHER, OreMixBuilder.THE_END) + .enableInDim(EndAsteroids, Mars, BarnardF, CentauriAlpha, Ceres, Haumea, MakeMake, Pluto, Titan, Venus) + .primary(Materials.Beryllium) + .secondary(Materials.Beryllium) + .inBetween(Materials.Emerald) + .sporadic(Materials.Thorium)), + + Uranium(new OreMixBuilder().name("ore.mix.uranium") + .heightRange(20, 30) + .weight(20) + .density(2) + .size(16) + .enableInDim( + MehenBelt, + BarnardE, + Ceres, + Deimos, + Enceladus, + Ganymede, + Haumea, + KuiperBelt, + MakeMake, + Phobos, + Proteus) + .primary(Materials.Uraninite) + .secondary(Materials.Uraninite) + .inBetween(Materials.Uranium) + .sporadic(Materials.Uranium)), + OilSand(new OreMixBuilder().name("ore.mix.oilsand") + .heightRange(50, 80) + .weight(40) + .density(5) + .size(16) + .enableInDim(OW) + .enableInDim(BarnardC, TcetiE) + .primary(Materials.Oilsands) + .secondary(Materials.Oilsands) + .inBetween(Materials.Oilsands) + .sporadic(Materials.Oilsands)), + + Neutronium(new OreMixBuilder().name("ore.mix.neutronium") + .heightRange(5, 30) + .weight(10) + .density(2) + .size(16) + .enableInDim(Maahes, MehenBelt, BarnardE, BarnardF, Haumea, KuiperBelt, MakeMake, Pluto, Proteus, Triton, VegaB) + .primary(Materials.Neutronium) + .secondary(Materials.Adamantium) + .inBetween(Materials.Naquadah) + .sporadic(Materials.Titanium)), + + AquaIgnis(new OreMixBuilder().name("ore.mix.aquaignis") + .heightRange(5, 35) + .weight(16) + .density(2) + .size(16) + .enableInDim(Neper.modDimensionDef.getDimensionName(), OreMixBuilder.TWILIGHT_FOREST) + .primary(Materials.InfusedWater) + .secondary(Materials.InfusedFire) + .inBetween(Materials.Amber) + .sporadic(Materials.Cinnabar)), + + TerraAer(new OreMixBuilder().name("ore.mix.terraaer") + .heightRange(5, 35) + .weight(16) + .density(2) + .size(16) + .enableInDim(Neper) + .enableInDim(TWILIGHT_FOREST) + .primary(Materials.InfusedEarth) + .secondary(Materials.InfusedAir) + .inBetween(Materials.Amber) + .sporadic(Materials.Cinnabar)), + + PerditioOrdo(new OreMixBuilder().name("ore.mix.perditioordo") + .heightRange(5, 35) + .weight(16) + .density(2) + .size(16) + .enableInDim(TWILIGHT_FOREST) + .enableInDim(Neper) + .primary(Materials.InfusedEntropy) + .secondary(Materials.InfusedOrder) + .inBetween(Materials.Amber) + .sporadic(Materials.Cinnabar)), + + CopperTin(new OreMixBuilder().name("ore.mix.coppertin") + .heightRange(80, 200) + .weight(80) + .density(3) + .size(24) + .enableInDim(OW) + .primary(Materials.Chalcopyrite) + .secondary(Materials.Vermiculite) + .inBetween(Materials.Cassiterite) + .sporadic(Materials.Alunite)), + + TitaniumChrome(new OreMixBuilder().name("ore.mix.titaniumchrome") + .heightRange(10, 70) + .weight(16) + .density(2) + .size(16) + .enableInDim(MehenBelt, Moon, Asteroids, Callisto, Ganymede, Mercury, Miranda, Pluto, Proteus, TcetiE, Titan) + .primary(Materials.Ilmenite) + .secondary(Materials.Chromite) + .inBetween(Materials.Uvarovite) + .sporadic(Materials.Perlite)), + + MineralSand(new OreMixBuilder().name("ore.mix.mineralsand") + .heightRange(50, 60) + .weight(80) + .density(3) + .size(24) + .enableInDim(OW) + .enableInDim(Anubis, Maahes, BarnardC, DimensionDef.Europa) + .primary(Materials.BasalticMineralSand) + .secondary(Materials.GraniticMineralSand) + .inBetween(Materials.FullersEarth) + .sporadic(Materials.Gypsum)), + + GarnetTin(new OreMixBuilder().name("ore.mix.garnettin") + .heightRange(50, 60) + .weight(80) + .density(3) + .size(24) + .enableInDim(OW) + .enableInDim(CentauriAlpha, DimensionDef.Europa) + .primary(Materials.CassiteriteSand) + .secondary(Materials.GarnetSand) + .inBetween(Materials.Asbestos) + .sporadic(Materials.Diatomite)), + + KaoliniteZeolite(new OreMixBuilder().name("ore.mix.kaolinitezeolite") + .heightRange(50, 70) + .weight(60) + .density(4) + .size(16) + .enableInDim(OW) + .enableInDim(Neper, TcetiE) + .primary(Materials.Kaolinite) + .secondary(Materials.Zeolite) + .inBetween(Materials.FullersEarth) + .sporadic(Materials.GlauconiteSand)), + + Mica(new OreMixBuilder().name("ore.mix.mica") + .heightRange(20, 40) + .weight(20) + .density(2) + .size(16) + .enableInDim(Anubis, Neper, BarnardC) + .enableInDim(OW) + .primary(Materials.Kyanite) + .secondary(Materials.Mica) + .inBetween(Materials.Cassiterite) + .sporadic(Materials.Pollucite)), + + Dolomite(new OreMixBuilder().name("ore.mix.dolomite") + .heightRange(150, 200) + .weight(40) + .density(4) + .size(24) + .enableInDim(OW) + .enableInDim(Anubis, Neper) + .primary(Materials.Dolomite) + .secondary(Materials.Wollastonite) + .inBetween(Materials.Trona) + .sporadic(Materials.Andradite)), + + PlatinumChrome(new OreMixBuilder().name("ore.mix.platinumchrome") + .heightRange(5, 30) + .weight(10) + .density(2) + .size(16) + .enableInDim(MehenBelt, Seth, Callisto, Ceres, Ganymede, Io, KuiperBelt, Mercury, Oberon, Pluto) + .primary(Materials.Platinum) + .secondary(Materials.Chrome) + .inBetween(Materials.Cooperite) + .sporadic(Materials.Palladium)), + + IridiumMytryl(new OreMixBuilder().name("ore.mix.iridiummytryl") + .heightRange(15, 40) + .weight(10) + .density(2) + .size(16) + .enableInDim(MehenBelt, Seth, Enceladus, Io, KuiperBelt, Mercury, Miranda, Titan, Triton, Venus) + .primary(Materials.Nickel) + .secondary(Materials.Iridium) + .inBetween(Materials.Palladium) + .sporadic(Materials.Mithril)), + + Osmium(new OreMixBuilder().name("ore.mix.osmium") + .heightRange(5, 30) + .weight(10) + .density(2) + .size(16) + .enableInDim(MehenBelt, Seth, BarnardC, Enceladus, KuiperBelt, Miranda, Oberon, Pluto, Proteus, Titan) + .primary(Materials.Nickel) + .secondary(Materials.Osmium) + .inBetween(Materials.Iridium) + .sporadic(Materials.Nickel)), + + SaltPeterElectrotine(new OreMixBuilder().name("ore.mix.saltpeterelectrotine") + .heightRange(5, 45) + .weight(40) + .density(3) + .size(16) + .enableInDim(NETHER) + .enableInDim(CentauriAlpha, Ceres) + .primary(Materials.Saltpeter) + .secondary(Materials.Diatomite) + .inBetween(Materials.Electrotine) + .sporadic(Materials.Alunite)), + + Desh(new OreMixBuilder().name("ore.mix.desh") + .heightRange(5, 40) + .weight(30) + .density(2) + .size(16) + .enableInDim(Anubis, Mars, Miranda) + .primary(Materials.Desh) + .secondary(Materials.Desh) + .inBetween(Materials.Scheelite) + .sporadic(Materials.Tungstate)), + + Draconium(new OreMixBuilder().name("ore.mix.draconium") + .heightRange(20, 40) + .weight(40) + .density(1) + .size(16) + .enableInDim(Horus, Seth, Deimos, Mercury, Miranda, Phobos) + .primary(Materials.Draconium) + .secondary(Materials.Electrotine) + .inBetween(Materials.Jade) + .sporadic(Materials.Vinteum)), + + Quantium(new OreMixBuilder().name("ore.mix.quantium") + .heightRange(5, 25) + .weight(30) + .density(3) + .size(24) + .enableInDim(Horus, Maahes, Venus) + .primary(Materials.Quantium) + .secondary(Materials.Amethyst) + .inBetween(Materials.Rutile) + .sporadic(Materials.Ardite)), + + CallistoIce(new OreMixBuilder().name("ore.mix.callistoice") + .heightRange(40, 60) + .weight(40) + .density(2) + .size(16) + .enableInDim(Anubis, Maahes, Callisto) + .primary(Materials.CallistoIce) + .secondary(Materials.Topaz) + .inBetween(Materials.BlueTopaz) + .sporadic(Materials.Alduorite)), + + Mytryl(new OreMixBuilder().name("ore.mix.mytryl") + .heightRange(10, 30) + .weight(40) + .density(2) + .size(16) + .enableInDim(Anubis, Horus, Io) + .primary(Materials.Mytryl) + .secondary(Materials.Jasper) + .inBetween(Materials.Ceruclase) + .sporadic(Materials.Vulcanite)), + + Ledox(new OreMixBuilder().name("ore.mix.ledox") + .heightRange(55, 65) + .weight(30) + .density(2) + .size(24) + .enableInDim(Horus, Enceladus, DimensionDef.Europa) + .primary(Materials.Ledox) + .secondary(Materials.Opal) + .inBetween(Materials.Orichalcum) + .sporadic(Materials.Rubracium)), + + Oriharukon(new OreMixBuilder().name("ore.mix.oriharukon") + .heightRange(30, 60) + .weight(40) + .density(2) + .size(16) + .enableInDim(Horus, Deimos, Phobos) + .primary(Materials.Oriharukon) + .secondary(Materials.Tanzanite) + .inBetween(Materials.Vyroxeres) + .sporadic(Materials.Mirabilite)), + + BlackPlutonium(new OreMixBuilder().name("ore.mix.blackplutonium") + .heightRange(5, 25) + .weight(40) + .density(2) + .size(24) + .enableInDim(Horus, BarnardC, CentauriAlpha, MakeMake, Pluto, TcetiE) + .primary(Materials.BlackPlutonium) + .secondary(Materials.GarnetRed) + .inBetween(Materials.GarnetYellow) + .sporadic(Materials.Borax)), + + InfusedGold(new OreMixBuilder().name("ore.mix.infusedgold") + .heightRange(15, 40) + .weight(30) + .density(2) + .size(16) + .enableInDim(BarnardE, Haumea, Io, Proteus, Titan, VegaB) + .primary(Materials.Gold) + .secondary(Materials.Gold) + .inBetween(Materials.InfusedGold) + .sporadic(Materials.Platinum)), + + Niobium(new OreMixBuilder().name("ore.mix.niobium") + .heightRange(5, 30) + .weight(60) + .density(2) + .size(24) + .enableInDim(BarnardF, MakeMake, Triton, VegaB) + .primary(Materials.Niobium) + .secondary(Materials.Yttrium) + .inBetween(Materials.Gallium) + .sporadic(Materials.Gallium)), + + TungstenIrons(new OreMixBuilder().name("ore.mix.tungstenirons") + .heightRange(5, 25) + .weight(16) + .density(2) + .size(30) + .enableInDim(Neper, BarnardC, BarnardE, BarnardF, Oberon, Pluto, Proteus, Triton) + .primary(Materials.Tungsten) + .secondary(Materials.Silicon) + .inBetween(Materials.DeepIron) + .sporadic(Materials.ShadowIron)), + + UraniumGTNH(new OreMixBuilder().name("ore.mix.uraniumgtnh") + .heightRange(10, 30) + .weight(60) + .density(2) + .size(24) + .enableInDim(BarnardE, BarnardF, Haumea, Pluto, Triton, VegaB) + .primary(Materials.Thorium) + .secondary(Materials.Uranium) + .inBetween(Materials.Plutonium241) + .sporadic(Materials.Uranium235)), + + VanadiumGold(new OreMixBuilder().name("ore.mix.vanadiumgold") + .heightRange(10, 50) + .weight(60) + .density(2) + .size(24) + .enableInDim(Maahes, BarnardF, Enceladus, MakeMake, Proteus, VegaB) + .primary(Materials.Vanadium) + .secondary(Materials.Magnetite) + .inBetween(Materials.Gold) + .sporadic(Materials.Chrome)), + + NetherStar(new OreMixBuilder().name("ore.mix.netherstar") + .heightRange(20, 60) + .weight(60) + .density(2) + .size(24) + .enableInDim(Horus, BarnardE, Haumea, TcetiE, VegaB) + .primary(Materials.GarnetSand) + .secondary(Materials.NetherStar) + .inBetween(Materials.GarnetRed) + .sporadic(Materials.GarnetYellow)), + + Garnet(new OreMixBuilder().name("ore.mix.garnet") + .heightRange(10, 30) + .weight(40) + .density(2) + .size(16) + .enableInDim(Horus, BarnardF, MakeMake, VegaB) + .primary(Materials.GarnetRed) + .secondary(Materials.GarnetYellow) + .inBetween(Materials.Chrysotile) + .sporadic(Materials.Realgar)), + + RareEarth(new OreMixBuilder().name("ore.mix.rareearth") + .heightRange(30, 60) + .weight(40) + .density(2) + .size(24) + .enableInDim(BarnardE, BarnardF, CentauriAlpha, VegaB) + .primary(Materials.Cadmium) + .secondary(Materials.Caesium) + .inBetween(Materials.Lanthanum) + .sporadic(Materials.Cerium)), + + RichNuclear(new OreMixBuilder().name("ore.mix.richnuclear") + .heightRange(55, 120) + .weight(5) + .density(2) + .size(8) + .enableInDim(Callisto, Ceres, Ganymede, Io) + .primary(Materials.Uranium) + .secondary(Materials.Plutonium) + .inBetween(Materials.Thorium) + .sporadic(Materials.Thorium)), + + HeavyPentele(new OreMixBuilder().name("ore.mix.heavypentele") + .heightRange(40, 60) + .weight(60) + .density(5) + .size(32) + .enableInDim(Neper, Mars, BarnardC, Mercury, Phobos, Titan, VegaB) + .primary(Materials.Arsenic) + .secondary(Materials.Bismuth) + .inBetween(Materials.Antimony) + .sporadic(Materials.Antimony)), + + Europa(new OreMixBuilder().name("ore.mix.europa") + .heightRange(55, 65) + .weight(110) + .density(4) + .size(24) + .enableInDim(Horus, DimensionDef.Europa, TcetiE) + .primary(Materials.Magnesite) + .secondary(Materials.BandedIron) + .inBetween(Materials.Sulfur) + .sporadic(Materials.Opal)), + + EuropaCore(new OreMixBuilder().name("ore.mix.europacore") + .heightRange(5, 15) + .weight(5) + .density(2) + .size(16) + .enableInDim(Maahes, DimensionDef.Europa, TcetiE) + .primary(Materials.Chrome) + .secondary(Materials.Tungstate) + .inBetween(Materials.Molybdenum) + .sporadic(Materials.Manganese)), + + SecondLanthanid(new OreMixBuilder().name("ore.mix.secondlanthanid") + .heightRange(10, 40) + .weight(10) + .density(3) + .size(24) + .enableInDim(Seth, BarnardC, CentauriAlpha) + .primary(Materials.Samarium) + .secondary(Materials.Neodymium) + .inBetween(Materials.Tartarite) + .sporadic(Materials.Tartarite)), + + QuartzSpace(new OreMixBuilder().name("ore.mix.quartzspace") + .heightRange(40, 80) + .weight(20) + .density(3) + .size(16) + .enableInDim(Horus, Moon, Mars, CentauriAlpha, Io, Phobos, Proteus, TcetiE, Venus) + .primary(Materials.Quartzite) + .secondary(Materials.Barite) + .inBetween(Materials.CertusQuartz) + .sporadic(Materials.CertusQuartz)), + + Rutile(new OreMixBuilder().name("ore.mix.rutile") + .heightRange(5, 20) + .weight(8) + .density(4) + .size(12) + .enableInDim(Anubis, Titan, Venus) + .primary(Materials.Rutile) + .secondary(Materials.Titanium) + .inBetween(Materials.Bauxite) + .sporadic(Materials.MeteoricIron)), + + TFGalena(new OreMixBuilder().name("ore.mix.tfgalena") + .heightRange(5, 35) + .weight(40) + .density(4) + .size(16) + .enableInDim(TWILIGHT_FOREST) + .enableInDim(Anubis, Maahes) + .primary(Materials.Galena) + .secondary(Materials.Silver) + .inBetween(Materials.Lead) + .sporadic(Materials.Cryolite)), + + LuVTantalite(new OreMixBuilder().name("ore.mix.luvtantalite") + .heightRange(20, 30) + .weight(10) + .density(4) + .size(16) + .enableInDim(Io, Miranda) + .primary(Materials.Pyrolusite) + .secondary(Materials.Apatite) + .inBetween(Materials.Tantalite) + .sporadic(Materials.Pyrochlore)), + + CertusQuartz(new OreMixBuilder().name("ore.mix.certusquartz") + .heightRange(40, 80) + .weight(60) + .density(5) + .size(32) + .enableInDim(Horus, Neper) + .primary(Materials.CertusQuartz) + .secondary(Materials.CertusQuartz) + .inBetween(Materials.CertusQuartzCharged) + .sporadic(Materials.QuartzSand)), + + InfinityCatalyst(new OreMixBuilder().name("ore.mix.infinitycatalyst") + .heightRange(5, 20) + .weight(15) + .density(2) + .size(16) + .enableInDim(Anubis) + .primary(Materials.Neutronium) + .secondary(Materials.Adamantium) + .inBetween(Materials.InfinityCatalyst) + .sporadic(Materials.Bedrockium)), + + CosmicNeutronium(new OreMixBuilder().name("ore.mix.cosmicneutronium") + .heightRange(5, 20) + .weight(15) + .density(2) + .size(16) + .enableInDim(Horus) + .primary(Materials.Neutronium) + .secondary(Materials.CosmicNeutronium) + .inBetween(Materials.BlackPlutonium) + .sporadic(Materials.Bedrockium)), + + Dilithium(new OreMixBuilder().name("ore.mix.dilithium") + .heightRange(30, 100) + .weight(30) + .density(3) + .size(24) + .enableInDim(Neper) + .primary(Materials.Dilithium) + .secondary(Materials.Dilithium) + .inBetween(Materials.MysteriousCrystal) + .sporadic(Materials.Vinteum)), + + Naquadria(new OreMixBuilder().name("ore.mix.naquadria") + .heightRange(10, 90) + .weight(40) + .density(4) + .size(24) + .enableInDim(Maahes) + .primary(Materials.Naquadah) + .secondary(Materials.NaquadahEnriched) + .inBetween(Materials.Naquadria) + .sporadic(Materials.Trinium)), + + AwakenedDraconium(new OreMixBuilder().name("ore.mix.awakeneddraconium") + .heightRange(20, 40) + .weight(20) + .density(3) + .size(16) + .enableInDim(MehenBelt) + .primary(Materials.Draconium) + .secondary(Materials.Draconium) + .inBetween(Materials.DraconiumAwakened) + .sporadic(Materials.NetherStar)), + + Tengam(new OreMixBuilder().name("ore.mix.tengam") + .heightRange(30, 180) + .weight(80) + .density(2) + .size(32) + .enableInDim(MehenBelt) + .primary(Materials.TengamRaw) + .secondary(Materials.TengamRaw) + .inBetween(Materials.Electrotine) + .sporadic(Materials.Samarium)); + + // spotless : on + + public final OreMixBuilder oreMixBuilder; + + private OreMixes(OreMixBuilder oreMixBuilder) { + this.oreMixBuilder = oreMixBuilder; + } + + public GT_Worldgen_GT_Ore_Layer addGTOreLayer() { + return new GT_Worldgen_GT_Ore_Layer(this.oreMixBuilder); + } + + public GT_Worldgen_GT_Ore_Layer_Space addGaGregOreLayer() { + return new GT_Worldgen_GT_Ore_Layer_Space(this.oreMixBuilder); + } +} diff --git a/src/main/java/gregtech/api/enums/SmallOres.java b/src/main/java/gregtech/api/enums/SmallOres.java new file mode 100644 index 0000000000..6de67bc3b9 --- /dev/null +++ b/src/main/java/gregtech/api/enums/SmallOres.java @@ -0,0 +1,555 @@ +package gregtech.api.enums; + +import static bloodasp.galacticgreg.api.enums.DimensionDef.Anubis; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Asteroids; +import static bloodasp.galacticgreg.api.enums.DimensionDef.BarnardE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.BarnardF; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Callisto; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Ceres; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Deimos; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Enceladus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.EndAsteroids; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Ganymede; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Haumea; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Horus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Io; +import static bloodasp.galacticgreg.api.enums.DimensionDef.KuiperBelt; +import static bloodasp.galacticgreg.api.enums.DimensionDef.MakeMake; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Mars; +import static bloodasp.galacticgreg.api.enums.DimensionDef.MehenBelt; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Mercury; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Miranda; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Moon; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Oberon; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Phobos; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Pluto; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Proteus; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Seth; +import static bloodasp.galacticgreg.api.enums.DimensionDef.TcetiE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Titan; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Triton; +import static bloodasp.galacticgreg.api.enums.DimensionDef.VegaB; +import static bloodasp.galacticgreg.api.enums.DimensionDef.Venus; +import static gregtech.common.SmallOreBuilder.NETHER; +import static gregtech.common.SmallOreBuilder.OW; +import static gregtech.common.SmallOreBuilder.THE_END; +import static gregtech.common.SmallOreBuilder.TWILIGHT_FOREST; + +import bloodasp.galacticgreg.GT_Worldgen_GT_Ore_SmallPieces_Space; +import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; +import gregtech.common.SmallOreBuilder; + +public enum SmallOres { + + // spotless : off + Copper(new SmallOreBuilder().name("ore.small.copper") + .heightRange(60, 180) + .amount(32) + .ore(Materials.Copper) + .enableInDim(Mars, Phobos, Proteus, Triton) + .enableInDim(NETHER, OW, THE_END)), + + Tin(new SmallOreBuilder().name("ore.small.tin") + .heightRange(80, 220) + .amount(32) + .ore(Materials.Tin) + .enableInDim(MehenBelt, Mars, Deimos, Ganymede, Proteus, Titan, EndAsteroids) + .enableInDim(NETHER, OW, THE_END)), + + Bismuth(new SmallOreBuilder().name("ore.small.bismuth") + .heightRange(80, 120) + .amount(8) + .ore(Materials.Bismuth) + .enableInDim(Mars, Callisto, Ceres, Io, MakeMake, Mercury, Proteus, VegaB) + .enableInDim(NETHER)), + + Coal(new SmallOreBuilder().name("ore.small.coal") + .heightRange(120, 250) + .amount(24) + .ore(Materials.Coal) + .enableInDim(OW)), + + Iron(new SmallOreBuilder().name("ore.small.iron") + .heightRange(40, 100) + .amount(16) + .ore(Materials.Iron) + .enableInDim( + Asteroids, + Mars, + BarnardE, + BarnardF, + Callisto, + Enceladus, + Ganymede, + Haumea, + Io, + KuiperBelt, + Miranda, + Phobos, + Titan, + Triton) + .enableInDim(NETHER, OW, THE_END)), + + Lead(new SmallOreBuilder().name("ore.small.lead") + .heightRange(40, 180) + .amount(16) + .ore(Materials.Lead) + .enableInDim( + Asteroids, + Mars, + Ceres, + Deimos, + Ganymede, + KuiperBelt, + MakeMake, + Mercury, + Oberon, + Pluto, + Triton, + VegaB, + Venus, + EndAsteroids) + .enableInDim(NETHER, THE_END, TWILIGHT_FOREST)), + + Zinc(new SmallOreBuilder().name("ore.small.zinc") + .heightRange(80, 210) + .amount(24) + .ore(Materials.Zinc) + .enableInDim(Mars, BarnardE, Enceladus, Ganymede, Haumea, Io, Mercury, Proteus, Titan, EndAsteroids) + .enableInDim(NETHER, OW, THE_END)), + + Gold(new SmallOreBuilder().name("ore.small.gold") + .heightRange(20, 60) + .amount(8) + .ore(Materials.Gold) + .enableInDim( + Asteroids, + Mars, + BarnardF, + Callisto, + Ceres, + KuiperBelt, + Miranda, + Phobos, + Pluto, + Venus, + EndAsteroids) + .enableInDim(OW, THE_END)), + + Silver(new SmallOreBuilder().name("ore.small.silver") + .heightRange(20, 60) + .amount(20) + .ore(Materials.Silver) + .enableInDim(Enceladus, Io, Oberon, Pluto, Proteus, Titan, Triton, VegaB, EndAsteroids) + .enableInDim(NETHER, OW, THE_END)), + + Nickel(new SmallOreBuilder().name("ore.small.nickel") + .heightRange(80, 150) + .amount(8) + .ore(Materials.Nickel) + .enableInDim( + MehenBelt, + Asteroids, + Mars, + BarnardE, + BarnardF, + Ceres, + Deimos, + KuiperBelt, + MakeMake, + Mercury, + Pluto, + Venus, + EndAsteroids) + .enableInDim(OW, THE_END)), + + Lapis(new SmallOreBuilder().name("ore.small.lapis") + .heightRange(10, 50) + .amount(4) + .ore(Materials.Lapis) + .enableInDim(MehenBelt, Enceladus, Ganymede, Io, Oberon, Phobos, TcetiE) + .enableInDim(OW)), + + Diamond(new SmallOreBuilder().name("ore.small.diamond") + .heightRange(5, 15) + .amount(2) + .ore(Materials.Diamond) + .enableInDim(Asteroids, Callisto, Ceres, Deimos, KuiperBelt, Oberon, Titan, Triton, VegaB, Venus) + .enableInDim(OW)), + + Emerald(new SmallOreBuilder().name("ore.small.emerald") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Emerald) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Ruby(new SmallOreBuilder().name("ore.small.ruby") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Ruby) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Sapphire(new SmallOreBuilder().name("ore.small.sapphire") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Sapphire) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Greensapphire(new SmallOreBuilder().name("ore.small.greensapphire") + .heightRange(5, 35) + .amount(2) + .ore(Materials.GreenSapphire) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Olivine(new SmallOreBuilder().name("ore.small.olivine") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Olivine) + .enableInDim(Horus, MehenBelt) + .enableInDim(TWILIGHT_FOREST)), + + Topaz(new SmallOreBuilder().name("ore.small.topaz") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Topaz) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Tanzanite(new SmallOreBuilder().name("ore.small.tanzanite") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Tanzanite) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Amethyst(new SmallOreBuilder().name("ore.small.amethyst") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Amethyst) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Opal(new SmallOreBuilder().name("ore.small.opal") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Opal) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Jasper(new SmallOreBuilder().name("ore.small.jasper") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Jasper) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Bluetopaz(new SmallOreBuilder().name("ore.small.bluetopaz") + .heightRange(5, 35) + .amount(2) + .ore(Materials.BlueTopaz) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Amber(new SmallOreBuilder().name("ore.small.amber") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Amber) + .enableInDim(TWILIGHT_FOREST)), + + Foolsruby(new SmallOreBuilder().name("ore.small.foolsruby") + .heightRange(5, 35) + .amount(2) + .ore(Materials.FoolsRuby) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Garnetred(new SmallOreBuilder().name("ore.small.garnetred") + .heightRange(5, 35) + .amount(2) + .ore(Materials.GarnetRed) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Garnetyellow(new SmallOreBuilder().name("ore.small.garnetyellow") + .heightRange(5, 35) + .amount(2) + .ore(Materials.GarnetYellow) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Redstone(new SmallOreBuilder().name("ore.small.redstone") + .heightRange(5, 25) + .amount(8) + .ore(Materials.Redstone) + .enableInDim(Mars, Ganymede, Io, Mercury, Proteus, Titan) + .enableInDim(NETHER, OW)), + + Netherquartz(new SmallOreBuilder().name("ore.small.netherquartz") + .heightRange(30, 120) + .amount(64) + .ore(Materials.NetherQuartz) + .enableInDim(NETHER)), + + Saltpeter(new SmallOreBuilder().name("ore.small.saltpeter") + .heightRange(10, 60) + .amount(8) + .ore(Materials.Saltpeter) + .enableInDim(Mars, Deimos, Enceladus, Ganymede, Io, Proteus, Venus) + .enableInDim(NETHER, TWILIGHT_FOREST)), + + Sulfur(new SmallOreBuilder().name("ore.small.sulfur") + .heightRange(5, 60) + .amount(40) + .ore(Materials.Sulfur) + .enableInDim(NETHER)), + + Titanium(new SmallOreBuilder().name("ore.small.titanium") + .heightRange(10, 180) + .amount(32) + .ore(Materials.Titanium) + .enableInDim( + MehenBelt, + Asteroids, + Mars, + BarnardE, + BarnardF, + Callisto, + Ceres, + Deimos, + Enceladus, + Ganymede, + Haumea, + Io, + KuiperBelt, + MakeMake, + Mercury, + Miranda, + Oberon, + Phobos, + Pluto, + Proteus, + Titan, + Triton, + Venus) + + ), + + Tungsten(new SmallOreBuilder().name("ore.small.tungsten") + .heightRange(10, 120) + .amount(16) + .ore(Materials.Tungsten) + .enableInDim(Io, Venus)), + + Meteoriciron(new SmallOreBuilder().name("ore.small.meteoriciron") + .heightRange(50, 70) + .amount(8) + .ore(Materials.MeteoricIron) + .enableInDim(Moon, Mars, Deimos, Io, Phobos, Pluto, Venus)), + + Firestone(new SmallOreBuilder().name("ore.small.firestone") + .heightRange(5, 15) + .amount(2) + .ore(Materials.Firestone) + .enableInDim(Io, Venus)), + + Neutronium(new SmallOreBuilder().name("ore.small.neutronium") + .heightRange(5, 15) + .amount(8) + .ore(Materials.Neutronium) + .enableInDim( + MehenBelt, + BarnardE, + BarnardF, + Enceladus, + Haumea, + KuiperBelt, + MakeMake, + Oberon, + Pluto, + Proteus, + TcetiE, + Titan, + Triton, + VegaB)), + + Chromite(new SmallOreBuilder().name("ore.small.chromite") + .heightRange(20, 40) + .amount(8) + .ore(Materials.Chromite) + .enableInDim( + MehenBelt, + Asteroids, + Mars, + Callisto, + Ceres, + Deimos, + Enceladus, + Ganymede, + Haumea, + Io, + KuiperBelt, + MakeMake, + Mercury, + Oberon, + Phobos, + Pluto, + Proteus, + Titan, + Triton, + VegaB, + Venus)), + + Tungstate(new SmallOreBuilder().name("ore.small.tungstate") + .heightRange(20, 40) + .amount(8) + .ore(Materials.Tungstate) + .enableInDim( + Asteroids, + Mars, + Callisto, + Ceres, + Deimos, + Enceladus, + Ganymede, + Io, + KuiperBelt, + Mercury, + Miranda, + Oberon, + Phobos, + Pluto, + Proteus, + Titan, + Triton, + Venus)), + + Naquadah(new SmallOreBuilder().name("ore.small.naquadah") + .heightRange(5, 25) + .amount(8) + .ore(Materials.Naquadah) + .enableInDim(BarnardE, BarnardF, Ceres, Enceladus, Io, KuiperBelt, Mercury, Pluto, Proteus, Venus)), + + Quantium(new SmallOreBuilder().name("ore.small.quantium") + .heightRange(5, 25) + .amount(6) + .ore(Materials.Quantium) + .enableInDim(Ceres, Haumea, Io, MakeMake, Pluto, Titan)), + + Mythril(new SmallOreBuilder().name("ore.small.mythril") + .heightRange(5, 25) + .amount(6) + .ore(Materials.Mytryl) + .enableInDim(Horus, Callisto, MakeMake, Miranda, Proteus, Venus)), + + Ledox(new SmallOreBuilder().name("ore.small.ledox") + .heightRange(40, 60) + .amount(4) + .ore(Materials.Ledox) + .enableInDim(Callisto, Enceladus, Haumea, Mercury, Oberon, Pluto)), + + Oriharukon(new SmallOreBuilder().name("ore.small.oriharukon") + .heightRange(20, 40) + .amount(6) + .ore(Materials.Oriharukon) + .enableInDim(Mars, Ceres, Haumea, MakeMake, Mercury, Titan, Triton)), + + Draconium(new SmallOreBuilder().name("ore.small.draconium") + .heightRange(5, 15) + .amount(4) + .ore(Materials.Draconium) + .enableInDim(Seth, Deimos, Ganymede, Haumea, MakeMake, Oberon, Phobos, Pluto, Venus)), + + Awdraconium(new SmallOreBuilder().name("ore.small.awdraconium") + .heightRange(5, 15) + .amount(2) + .ore(Materials.DraconiumAwakened) + .enableInDim(Seth, BarnardE, BarnardF, TcetiE, VegaB)), + + Desh(new SmallOreBuilder().name("ore.small.desh") + .heightRange(10, 30) + .amount(6) + .ore(Materials.Desh) + .enableInDim(Callisto, Deimos, Haumea, MakeMake, Mercury, Miranda, Phobos, Proteus, Triton)), + + Blackplutonium(new SmallOreBuilder().name("ore.small.blackplutonium") + .heightRange(25, 45) + .amount(6) + .ore(Materials.BlackPlutonium) + .enableInDim(BarnardE, BarnardF, Haumea, MakeMake, Pluto, Triton, VegaB)), + + Infinitycatalyst(new SmallOreBuilder().name("ore.small.infinitycatalyst") + .heightRange(40, 80) + .amount(6) + .ore(Materials.InfinityCatalyst) + .enableInDim(Anubis, VegaB)), + + Infinity(new SmallOreBuilder().name("ore.small.infinity") + .heightRange(2, 40) + .amount(2) + .ore(Materials.Infinity) + .disabledByDefault()), + + Bedrockium(new SmallOreBuilder().name("ore.small.bedrockium") + .heightRange(5, 25) + .amount(6) + .ore(Materials.Bedrockium) + .enableInDim(BarnardF)), + + Realgar(new SmallOreBuilder().name("ore.small.realgar") + .heightRange(15, 85) + .amount(32) + .ore(Materials.Realgar) + .enableInDim(BarnardF) + .enableInDim(NETHER)), + + Certusquartz(new SmallOreBuilder().name("ore.small.certusquartz") + .heightRange(5, 115) + .amount(16) + .ore(Materials.CertusQuartz) + .enableInDim(Horus) + .enableInDim(NETHER)), + + Jade(new SmallOreBuilder().name("ore.small.jade") + .heightRange(5, 35) + .amount(2) + .ore(Materials.Jade) + .enableInDim(Horus) + .enableInDim(TWILIGHT_FOREST)), + + Deepiron(new SmallOreBuilder().name("ore.small.deepiron") + .heightRange(5, 40) + .amount(8) + .ore(Materials.DeepIron) + .enableInDim(Mercury)), + + Redgarnet(new SmallOreBuilder().name("ore.small.redgarnet") + .heightRange(5, 35) + .amount(2) + .ore(Materials.GarnetRed) + .enableInDim(Horus)), + + Chargedcertus(new SmallOreBuilder().name("ore.small.chargedcertus") + .heightRange(5, 115) + .amount(4) + .ore(Materials.CertusQuartzCharged) + .enableInDim(Horus)),; + // spotless : on + + public final SmallOreBuilder smallOreBuilder; + + private SmallOres(gregtech.common.SmallOreBuilder smallOreBuilder) { + this.smallOreBuilder = smallOreBuilder; + } + + public GT_Worldgen_GT_Ore_SmallPieces addGTSmallOre() { + return new GT_Worldgen_GT_Ore_SmallPieces(this.smallOreBuilder); + } + + public GT_Worldgen_GT_Ore_SmallPieces_Space addGaGregSmallOre() { + return new GT_Worldgen_GT_Ore_SmallPieces_Space(this.smallOreBuilder); + } +} diff --git a/src/main/java/gregtech/api/enums/UndergroundFluidNames.java b/src/main/java/gregtech/api/enums/UndergroundFluidNames.java new file mode 100644 index 0000000000..5e96544bd2 --- /dev/null +++ b/src/main/java/gregtech/api/enums/UndergroundFluidNames.java @@ -0,0 +1,43 @@ +package gregtech.api.enums; + +public enum UndergroundFluidNames { + + carbonDioxide("carbondioxide"), + carbonMonoxide("carbonmonoxide"), + chlorobenzene("chlorobenzene"), + deuterium("deuterium"), + distilledWater("ic2distilledwater"), + ethane("ethane"), + ethylene("ethylene"), + fluorine("fluorine"), + heavyOil("liquid_heavy_oil"), + helium3("helium-3"), + hydrofluoricAcid("hydrofluoricacid_gt5u"), + hydrogen("hydrogen"), + hydrogenSulfide("liquid_hydricsulfur"), + lava("lava"), + lightOil("liquid_light_oil"), + liquidAir("liquidair"), + mediumOil("liquid_medium_oil"), + methane("methane"), + moltenCopper("molten.copper"), + moltenIron("molten.iron"), + moltenLead("molten.lead"), + moltenTin("molten.tin"), + naturalGas("gas_natural_gas"), + nitrogen("nitrogen"), + oil("oil"), + oxygen("oxygen"), + saltWater("saltwater"), + sulfuricAcid("sulfuricacid"), + unknownWater("unknowwater"), + veryHeavyOil("liquid_extra_heavy_oil"), + + ; + + public final String name; + + private UndergroundFluidNames(String name) { + this.name = name; + } +} diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 946caaa172..4959f8b060 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -35,7 +35,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregtechWailaProvider; import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Util; /** @@ -122,7 +121,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * Called to set Configuration values for this MetaTileEntity. Use aConfig.get(ConfigCategories.machineconfig, * "MetaTileEntityName.Ability", DEFAULT_VALUE); to set the Values. */ - void onConfigLoad(GT_Config aConfig); + void onConfigLoad(); /** * If a Cover of that Type can be placed on this Side. Also Called when the Facing of the Block Changes and a Cover diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index a4c5df4efe..8971db2d92 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -41,7 +41,6 @@ import gregtech.api.interfaces.tileentity.IColoredTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.GT_LanguageManager; @@ -239,7 +238,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad() { /* Do nothing */ } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 604c1dfb3b..d4f8aa6ba4 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -52,7 +52,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; @@ -204,7 +203,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity, ICleanroomRecei } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad() { /* Do nothing */ } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index f5ab88fb45..e44860963f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -76,9 +76,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public int mTransferredAmperage = 0; - public int mOverheat; - public static short mMaxOverheat = (short) (GT_Mod.gregtechproxy.mWireHeatingTicks * 100); - public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { super(aID, aName, aNameRegional, 0); @@ -471,13 +468,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile final long maxVoltageOut = (mVoltage - mCableLossPerMeter) * mAmperage; return new String[] { - "Heat: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mOverheat) - + EnumChatFormatting.RESET - + " / " - + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxOverheat) - + EnumChatFormatting.RESET, "Amperage: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(currAmp) + EnumChatFormatting.RESET diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index d94a7c0ac2..cafd1c9cb7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -40,8 +40,6 @@ import org.apache.commons.lang3.tuple.MutableTriple; import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.Mods; @@ -66,6 +64,7 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; import gregtech.common.GT_Client; +import gregtech.common.config.other.ConfigGeneral; import gregtech.common.covers.CoverInfo; import gregtech.common.covers.GT_Cover_Drain; import gregtech.common.covers.GT_Cover_FluidRegulator; @@ -512,7 +511,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { boolean wasActionPerformed = false; - int limit = GregTech_API.sSpecialFile.get(ConfigCategories.general, "PipeWrenchingChainRange", 64); + int limit = ConfigGeneral.pipeWrenchingChainRange; for (int connected = 0; connected < limit; connected++) { TileEntity nextPipeBaseTile = currentPipeBase.getTileEntityAtSide(tSide); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 4ffe82b1c2..fb77abd8b2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -58,8 +58,6 @@ import com.gtnewhorizons.modularui.common.widget.TextWidget; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.SoundResource; import gregtech.api.enums.VoidingMode; import gregtech.api.gui.modularui.GT_UIInfos; @@ -94,6 +92,7 @@ import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.client.GT_SoundLoop; import gregtech.common.GT_Pollution; +import gregtech.common.config.machinestats.ConfigMachines; import gregtech.common.gui.modularui.widget.CheckRecipeResultSyncer; import gregtech.common.gui.modularui.widget.ShutDownReasonSyncer; import gregtech.common.items.GT_MetaGenerated_Tool_01; @@ -169,12 +168,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 2); this.processingLogic = null; - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - this.damageFactorLow = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = ConfigMachines.disableMaintenanceChecks; + this.damageFactorLow = ConfigMachines.damageFactorLow; + this.damageFactorHigh = ConfigMachines.damageFactorHigh; this.mNEI = ""; if (!shouldCheckMaintenance()) fixAllIssues(); } @@ -182,12 +178,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public GT_MetaTileEntity_MultiBlockBase(String aName) { super(aName, 2); this.processingLogic = createProcessingLogic(); - GT_MetaTileEntity_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - this.damageFactorLow = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorLow", 5); - this.damageFactorHigh = (float) GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.damageFactorHigh", 0.6f); + GT_MetaTileEntity_MultiBlockBase.disableMaintenance = ConfigMachines.disableMaintenanceChecks; + this.damageFactorLow = ConfigMachines.damageFactorLow; + this.damageFactorHigh = ConfigMachines.damageFactorHigh; if (!shouldCheckMaintenance()) fixAllIssues(); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index a8c26957f8..de7019b292 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java @@ -1,6 +1,7 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Mods.EnderIO; import static mcp.mobius.waila.api.SpecialChars.BLUE; import static mcp.mobius.waila.api.SpecialChars.GOLD; import static mcp.mobius.waila.api.SpecialChars.GREEN; @@ -194,7 +195,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi .extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false); tEU = tEU * GregTech_API.mRFtoEU / 100; aBaseMetaTileEntity.injectEnergyUnits(ForgeDirection.UNKNOWN, Math.min(tEU, maxEUInput()), 1); - } else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer powerContainer + } else if (EnderIO.isModLoaded() && tTileEntity instanceof IPowerContainer powerContainer && powerContainer.getEnergyStored() > 0) { final int storedRF = powerContainer.getEnergyStored(); final int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU); diff --git a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java index 95d4246cb6..f057614ccf 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -1,5 +1,58 @@ package gregtech.api.objects; +import static gregtech.api.enums.Dimensions.AlphaCentauriBb; +import static gregtech.api.enums.Dimensions.BarnardaC; +import static gregtech.api.enums.Dimensions.BarnardaE; +import static gregtech.api.enums.Dimensions.BarnardaF; +import static gregtech.api.enums.Dimensions.Callisto; +import static gregtech.api.enums.Dimensions.Europa; +import static gregtech.api.enums.Dimensions.Io; +import static gregtech.api.enums.Dimensions.Makemake; +import static gregtech.api.enums.Dimensions.Mars; +import static gregtech.api.enums.Dimensions.Mercury; +import static gregtech.api.enums.Dimensions.Miranda; +import static gregtech.api.enums.Dimensions.Moon; +import static gregtech.api.enums.Dimensions.Oberon; +import static gregtech.api.enums.Dimensions.Overworld; +import static gregtech.api.enums.Dimensions.Pluto; +import static gregtech.api.enums.Dimensions.Proteus; +import static gregtech.api.enums.Dimensions.Ross128b; +import static gregtech.api.enums.Dimensions.Ross128ba; +import static gregtech.api.enums.Dimensions.TCetiE; +import static gregtech.api.enums.Dimensions.Titan; +import static gregtech.api.enums.Dimensions.Triton; +import static gregtech.api.enums.Dimensions.Venus; +import static gregtech.api.enums.UndergroundFluidNames.carbonDioxide; +import static gregtech.api.enums.UndergroundFluidNames.carbonMonoxide; +import static gregtech.api.enums.UndergroundFluidNames.chlorobenzene; +import static gregtech.api.enums.UndergroundFluidNames.deuterium; +import static gregtech.api.enums.UndergroundFluidNames.distilledWater; +import static gregtech.api.enums.UndergroundFluidNames.ethane; +import static gregtech.api.enums.UndergroundFluidNames.ethylene; +import static gregtech.api.enums.UndergroundFluidNames.fluorine; +import static gregtech.api.enums.UndergroundFluidNames.heavyOil; +import static gregtech.api.enums.UndergroundFluidNames.helium3; +import static gregtech.api.enums.UndergroundFluidNames.hydrofluoricAcid; +import static gregtech.api.enums.UndergroundFluidNames.hydrogen; +import static gregtech.api.enums.UndergroundFluidNames.hydrogenSulfide; +import static gregtech.api.enums.UndergroundFluidNames.lava; +import static gregtech.api.enums.UndergroundFluidNames.lightOil; +import static gregtech.api.enums.UndergroundFluidNames.liquidAir; +import static gregtech.api.enums.UndergroundFluidNames.mediumOil; +import static gregtech.api.enums.UndergroundFluidNames.methane; +import static gregtech.api.enums.UndergroundFluidNames.moltenCopper; +import static gregtech.api.enums.UndergroundFluidNames.moltenIron; +import static gregtech.api.enums.UndergroundFluidNames.moltenLead; +import static gregtech.api.enums.UndergroundFluidNames.moltenTin; +import static gregtech.api.enums.UndergroundFluidNames.naturalGas; +import static gregtech.api.enums.UndergroundFluidNames.nitrogen; +import static gregtech.api.enums.UndergroundFluidNames.oil; +import static gregtech.api.enums.UndergroundFluidNames.oxygen; +import static gregtech.api.enums.UndergroundFluidNames.saltWater; +import static gregtech.api.enums.UndergroundFluidNames.sulfuricAcid; +import static gregtech.api.enums.UndergroundFluidNames.unknownWater; +import static gregtech.api.enums.UndergroundFluidNames.veryHeavyOil; + import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; @@ -7,6 +60,9 @@ import net.minecraftforge.common.config.Configuration; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; +import gregtech.api.enums.Dimensions; +import gregtech.api.enums.UndergroundFluidNames; + public class GT_UO_DimensionList { private Configuration fConfig; @@ -19,6 +75,10 @@ public class GT_UO_DimensionList { fDimensionList = HashBiMap.create(); } + public void save() { + fConfig.save(); + } + public GT_UO_Dimension GetDimension(int aDimension) { if (CheckBlackList(aDimension)) return null; if (fDimensionList.containsKey(Integer.toString(aDimension))) @@ -59,26 +119,463 @@ public class GT_UO_DimensionList { // IT IS IN BUCKETS!!! } - public void SetDafultValues() { - SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 700, 20, 7); - SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 650, 20, 6); - SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 600, 20, 5); - SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 550, 20, 4); - SetConfigValues("Overworld", "0", "oil", "oil", 0, 600, 20, 5); - SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 24, 128, 100, 1); + private void setOverworldValues() { + new ConfigSetter().dimension(Overworld) + .fluid(naturalGas) + .chance(20) + .decreaseAmount(5) + .maxAmount(350) + .minAmount(10) + .writeToConfig(); + + new ConfigSetter().dimension(Overworld) + .fluid(lightOil) + .chance(20) + .decreaseAmount(5) + .maxAmount(350) + .minAmount(10) + .writeToConfig(); + + new ConfigSetter().dimension(Overworld) + .fluid(mediumOil) + .chance(20) + .decreaseAmount(5) + .maxAmount(625) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Overworld) + .fluid(heavyOil) + .chance(20) + .decreaseAmount(5) + .maxAmount(625) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Overworld) + .fluid(oil) + .chance(20) + .decreaseAmount(5) + .maxAmount(625) + .minAmount(0) + .writeToConfig(); + } + + private void setMoonValues() { + new ConfigSetter().dimension(Moon) + .fluid(helium3) + .chance(100) + .decreaseAmount(5) + .maxAmount(425) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Moon) + .fluid(saltWater) + .chance(20) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + } + + private void setMercuryValues() { + new ConfigSetter().dimension(Mercury) + .fluid(helium3) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Mercury) + .fluid(moltenIron) + .chance(30) + .decreaseAmount(5) + .maxAmount(400) + .minAmount(0) + .writeToConfig(); + } + + private void setVenusValues() { + new ConfigSetter().dimension(Venus) + .fluid(moltenLead) + .chance(100) + .decreaseAmount(5) + .maxAmount(1600) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Venus) + .fluid(sulfuricAcid) + .chance(100) + .decreaseAmount(5) + .maxAmount(250) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Venus) + .fluid(carbonDioxide) + .chance(100) + .decreaseAmount(5) + .maxAmount(1500) + .minAmount(0) + .writeToConfig(); + } + + private void setMarsValues() { + new ConfigSetter().dimension(Mars) + .fluid(saltWater) + .chance(100) + .decreaseAmount(5) + .maxAmount(400) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Mars) + .fluid(chlorobenzene) + .chance(100) + .decreaseAmount(5) + .maxAmount(400) + .minAmount(0) + .writeToConfig(); + } + + private void setIoValues() { + new ConfigSetter().dimension(Io) + .fluid(moltenLead) + .chance(20) + .decreaseAmount(5) + .maxAmount(650) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Io) + .fluid(sulfuricAcid) + .chance(80) + .decreaseAmount(5) + .maxAmount(350) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Io) + .fluid(carbonDioxide) + .chance(80) + .decreaseAmount(5) + .maxAmount(750) + .minAmount(0) + .writeToConfig(); + } + + private void setEuropaValues() { + new ConfigSetter().dimension(Europa) + .fluid(saltWater) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Europa) + .fluid(veryHeavyOil) + .chance(20) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Europa) + .fluid(distilledWater) + .chance(80) + .decreaseAmount(5) + .maxAmount(3500) + .minAmount(0) + .writeToConfig(); + } + + private void setCallistoValues() { + new ConfigSetter().dimension(Callisto) + .fluid(oxygen) + .chance(100) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Callisto) + .fluid(liquidAir) + .chance(100) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + } + + private void setTitanValues() { + new ConfigSetter().dimension(Titan) + .fluid(methane) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Titan) + .fluid(ethane) + .chance(100) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + } + + private void setMirandaValues() { + new ConfigSetter().dimension(Miranda) + .fluid(hydrogenSulfide) + .chance(100) + .decreaseAmount(5) + .maxAmount(900) + .minAmount(0) + .writeToConfig(); + } + + private void setOberonValues() { + new ConfigSetter().dimension(Oberon) + .fluid(carbonMonoxide) + .chance(100) + .decreaseAmount(5) + .maxAmount(2000) + .minAmount(0) + .writeToConfig(); + } + + private void setTritonValues() { + new ConfigSetter().dimension(Triton) + .fluid(nitrogen) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Triton) + .fluid(ethylene) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + } + + private void setProteusValues() { + new ConfigSetter().dimension(Proteus) + .fluid(deuterium) + .chance(100) + .decreaseAmount(5) + .maxAmount(700) + .minAmount(0) + .writeToConfig(); + } + + private void setPlutoValues() { + new ConfigSetter().dimension(Pluto) + .fluid(nitrogen) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Pluto) + .fluid(oxygen) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Pluto) + .fluid(liquidAir) + .chance(40) + .decreaseAmount(5) + .maxAmount(300) + .minAmount(4) + .writeToConfig(); + + new ConfigSetter().dimension(Pluto) + .fluid(fluorine) + .chance(80) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(4) + .writeToConfig(); + } + + private void setMakeMakeValues() { + new ConfigSetter().dimension(Makemake) + .fluid(hydrofluoricAcid) + .chance(80) + .decreaseAmount(5) + .maxAmount(300) + .minAmount(0) + .writeToConfig(); + } + + private void setAlphaCentauriBBValues() { + new ConfigSetter().dimension(AlphaCentauriBb) + .fluid(moltenCopper) + .chance(10) + .decreaseAmount(5) + .maxAmount(300) + .minAmount(0) + .writeToConfig(); + } + + private void setBarnardaCValues() { + new ConfigSetter().dimension(BarnardaC) + .fluid(veryHeavyOil) + .chance(100) + .decreaseAmount(5) + .maxAmount(800) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(BarnardaC) + .fluid(unknownWater) + .chance(100) + .decreaseAmount(5) + .maxAmount(300) + .minAmount(0) + .writeToConfig(); + } + + private void setBarnardaEValues() { + new ConfigSetter().dimension(BarnardaE) + .fluid(liquidAir) + .chance(20) + .decreaseAmount(5) + .maxAmount(400) + .minAmount(0) + .writeToConfig(); + } + + private void setBarnardaFValues() { + new ConfigSetter().dimension(BarnardaF) + .fluid(moltenTin) + .chance(15) + .decreaseAmount(5) + .maxAmount(400) + .minAmount(0) + .writeToConfig(); + } + + private void setTcetiEValues() { + new ConfigSetter().dimension(TCetiE) + .fluid(veryHeavyOil) + .chance(100) + .decreaseAmount(5) + .maxAmount(200) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(TCetiE) + .fluid(hydrogen) + .chance(50) + .decreaseAmount(5) + .maxAmount(700) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(TCetiE) + .fluid(distilledWater) + .chance(100) + .decreaseAmount(5) + .maxAmount(10_000) + .minAmount(0) + .writeToConfig(); + } + + private void setRoss128bValues() { + new ConfigSetter().dimension(Ross128b) + .fluid(veryHeavyOil) + .chance(40) + .decreaseAmount(5) + .maxAmount(625) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Ross128b) + .fluid(lava) + .chance(5) + .decreaseAmount(5) + .maxAmount(820) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Ross128b) + .fluid(naturalGas) + .chance(65) + .decreaseAmount(5) + .maxAmount(625) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Ross128b) + .fluid(distilledWater) + .chance(100) + .decreaseAmount(5) + .maxAmount(5000) + .minAmount(0) + .writeToConfig(); + } + + private void setRoss128baValues() { + new ConfigSetter().dimension(Ross128ba) + .fluid(saltWater) + .chance(40) + .decreaseAmount(5) + .maxAmount(1250) + .minAmount(0) + .writeToConfig(); + + new ConfigSetter().dimension(Ross128ba) + .fluid(helium3) + .chance(60) + .decreaseAmount(5) + .maxAmount(1250) + .minAmount(0) + .writeToConfig(); + } + + public void setDefaultValues() { + setOverworldValues(); + setMoonValues(); + setMercuryValues(); + setVenusValues(); + setMarsValues(); + setIoValues(); + setEuropaValues(); + setCallistoValues(); + setTitanValues(); + setMirandaValues(); + setOberonValues(); + setTritonValues(); + setProteusValues(); + setPlutoValues(); + setMakeMakeValues(); + setAlphaCentauriBBValues(); + setBarnardaCValues(); + setBarnardaEValues(); + setBarnardaFValues(); + setTcetiEValues(); + setRoss128bValues(); + setRoss128baValues(); } public void getConfig(Configuration aConfig, String aCategory) { fCategory = aCategory; fConfig = aConfig; - if (!fConfig.hasCategory(fCategory)) SetDafultValues(); - - fConfig.setCategoryComment(fCategory, "Config Underground Fluids (Delete this Category for regenerate)"); - fConfig.setCategoryComment( - fCategory + ".Default", - "Set Default Generating (Use this Category for Default settings)"); - fConfig.setCategoryComment(fCategory + ".Overworld", "Set Overworld Generating"); - fConfig.setCategoryComment(fCategory + ".Moon", "Set Moon Generating"); + if (!fConfig.hasCategory(fCategory)) setDefaultValues(); blackList = new int[] { -1, 1 }; blackList = aConfig.get(fCategory, "DimBlackList", blackList, "Dimension IDs Black List") @@ -94,5 +591,58 @@ public class GT_UO_DimensionList { .toArray()[i]); fDimensionList.put(Dimension.Dimension, Dimension); } + save(); + } + + public class ConfigSetter { + + private int chance; + private int decreaseAmount; + private int maxAmount; + private int minAmount; + private UndergroundFluidNames fluid; + private Dimensions dim; + + public ConfigSetter chance(int chance) { + this.chance = chance; + return this; + } + + public ConfigSetter decreaseAmount(int decreaseAmount) { + this.decreaseAmount = decreaseAmount; + return this; + } + + public ConfigSetter maxAmount(int maxAmount) { + this.maxAmount = maxAmount; + return this; + } + + public ConfigSetter minAmount(int minAmount) { + this.minAmount = minAmount; + return this; + } + + public ConfigSetter fluid(UndergroundFluidNames fluid) { + this.fluid = fluid; + return this; + } + + public ConfigSetter dimension(Dimensions dim) { + this.dim = dim; + return this; + } + + public void writeToConfig() { + SetConfigValues( + dim.toString(), + dim.id, + fluid.toString(), + fluid.name, + minAmount, + maxAmount, + chance, + decreaseAmount); + } } } diff --git a/src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelBackend.java b/src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelBackend.java index 53152312f4..b38b66e41b 100644 --- a/src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelBackend.java +++ b/src/main/java/gregtech/api/recipe/maps/LargeBoilerFuelBackend.java @@ -9,8 +9,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.recipe.RecipeMapBackend; import gregtech.api.recipe.RecipeMapBackendPropertiesBuilder; @@ -25,12 +23,8 @@ public class LargeBoilerFuelBackend extends RecipeMapBackend { private static boolean addedGeneralDesc = false; - private static final List<String> ALLOWED_SOLID_FUELS = Arrays.asList( - GregTech_API.sMachineFile.mConfig.getStringList( - "LargeBoiler.allowedFuels", - ConfigCategories.machineconfig.toString(), - new String[] { "gregtech:gt.blockreinforced:6", "gregtech:gt.blockreinforced:7" }, - "Allowed fuels for the Large Titanium Boiler and Large Tungstensteel Boiler")); + private static final List<String> ALLOWED_SOLID_FUELS = Arrays + .asList("gregtech:gt.blockreinforced:6", "gregtech:gt.blockreinforced:7"); public LargeBoilerFuelBackend(RecipeMapBackendPropertiesBuilder propertiesBuilder) { super(propertiesBuilder); diff --git a/src/main/java/gregtech/api/util/GT_ClientPreference.java b/src/main/java/gregtech/api/util/GT_ClientPreference.java index 8df4ef8b05..3ea2730a0c 100644 --- a/src/main/java/gregtech/api/util/GT_ClientPreference.java +++ b/src/main/java/gregtech/api/util/GT_ClientPreference.java @@ -1,5 +1,8 @@ package gregtech.api.util; +import gregtech.common.config.client.ConfigPreference; +import gregtech.common.config.client.ConfigWaila; + public class GT_ClientPreference { private final boolean mSingleBlockInitialFilter; @@ -15,12 +18,11 @@ public class GT_ClientPreference { this.wailaAverageNS = wailaAverageNS; } - public GT_ClientPreference(GT_Config aClientDataFile) { - this.mSingleBlockInitialFilter = aClientDataFile.get("preference", "mSingleBlockInitialFilter", false); - this.mSingleBlockInitialMultiStack = aClientDataFile - .get("preference", "mSingleBlockInitialAllowMultiStack", false); - this.mInputBusInitialFilter = aClientDataFile.get("preference", "mInputBusInitialFilter", true); - this.wailaAverageNS = aClientDataFile.get("waila", "WailaAverageNS", false); + public GT_ClientPreference() { + this.mSingleBlockInitialFilter = ConfigPreference.singleBlockInitialFilter; + this.mSingleBlockInitialMultiStack = ConfigPreference.singleBlockInitialAllowMultiStack; + this.mInputBusInitialFilter = ConfigPreference.inputBusInitialFilter; + this.wailaAverageNS = ConfigWaila.wailaAverageNS; } public boolean isSingleBlockInitialFilterEnabled() { diff --git a/src/main/java/gregtech/api/util/GT_Config.java b/src/main/java/gregtech/api/util/GT_Config.java index dc56def68f..e1157febb4 100644 --- a/src/main/java/gregtech/api/util/GT_Config.java +++ b/src/main/java/gregtech/api/util/GT_Config.java @@ -14,6 +14,8 @@ public class GT_Config implements Runnable { public static boolean troll = false; public static Configuration sConfigFileIDs; + public static Configuration cleanroomFile; + public static Configuration undergroundFluidsFile; public final Configuration mConfig; public GT_Config(Configuration aConfig) { @@ -38,7 +40,7 @@ public class GT_Config implements Runnable { aName.replaceAll("\\|", "."), aDefault); int rResult = tProperty.getInt(aDefault); - if (!tProperty.wasRead() && shouldSave()) sConfigFileIDs.save(); + sConfigFileIDs.save(); return rResult; } diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java index bd85813e2b..1ce0c85523 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen.java @@ -1,6 +1,5 @@ package gregtech.api.world; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Random; @@ -10,7 +9,8 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.DimensionManager; -import gregtech.api.GregTech_API; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; public abstract class GT_Worldgen { @@ -21,7 +21,7 @@ public abstract class GT_Worldgen { @SuppressWarnings({ "unchecked", "rawtypes" }) // The adding of "this" needs a List<this> which does not exist public GT_Worldgen(String aName, List aList, boolean aDefault) { mWorldGenName = aName; - mEnabled = GregTech_API.sWorldgenFile.get("worldgen", mWorldGenName, aDefault); + mEnabled = aDefault; if (mEnabled) aList.add(this); } @@ -45,32 +45,6 @@ public abstract class GT_Worldgen { } /** - * @param aWorld The World Object - * @param aRandom The Random Generator to use - * @param aBiome The Name of the Biome (always != null) - * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End - * @param aChunkX xCoord of the Chunk - * @param aChunkZ zCoord of the Chunk - * @return if the Worldgeneration has been successfully completed - */ - public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - return false; - } - - /** - * - * @param aWorld The World Object - * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End - * @param aAllowedDimensionType The Type of allowed Worldgeneration - * @return if generation for this world is allowed for MoronTech (tm) OreGen (ATM (2.0.3.1Dev) only End, Nether, - * Overworld, Twilight Forest and Deep Dark) - */ - public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - return isGenerationAllowed(aWorld.provider.getDimensionName(), aDimensionType, aAllowedDimensionType); - } - - /** * * @param aDimName The Dimension Name * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End @@ -79,17 +53,17 @@ public abstract class GT_Worldgen { * Overworld, Twilight Forest and Deep Dark) */ public boolean isGenerationAllowed(String aDimName, int aDimensionType, int aAllowedDimensionType) { + if (aDimName.equalsIgnoreCase("Underdark")) { + return false; + } if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") || aDimName.equalsIgnoreCase("The End") - || aDimName.equalsIgnoreCase("Twilight Forest") - || aDimName.equalsIgnoreCase("Underdark"))) return false; + || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; Boolean tAllowed = mDimensionMap.get(aDimName); if (tAllowed == null) { - boolean tValue = GregTech_API.sWorldgenFile - .get("worldgen." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); - mDimensionMap.put(aDimName, tValue); - return tValue; + mDimensionMap.put(aDimName, aDimensionType == aAllowedDimensionType); + return aDimensionType == aAllowedDimensionType; } return tAllowed; } @@ -112,20 +86,32 @@ public abstract class GT_Worldgen { */ public boolean isGenerationAllowed(World aWorld, Class... aAllowedDimensionTypes) { String aDimName = aWorld.provider.getDimensionName(); + if (aDimName.equalsIgnoreCase("Underdark")) { + return false; + } if (!(aDimName.equalsIgnoreCase("Overworld") || aDimName.equalsIgnoreCase("Nether") || aDimName.equalsIgnoreCase("The End") - || aDimName.equalsIgnoreCase("Twilight Forest") - || aDimName.equalsIgnoreCase("Underdark"))) return false; + || aDimName.equalsIgnoreCase("Twilight Forest"))) return false; Boolean tAllowed = mDimensionMap.get(aDimName); if (tAllowed == null) { - boolean tValue = GregTech_API.sWorldgenFile.get( - "worldgen." + mWorldGenName, - aDimName, - Arrays.stream(aAllowedDimensionTypes) - .anyMatch(worldProvider -> worldProvider.isInstance(aWorld.provider))); - mDimensionMap.put(aDimName, tValue); - return tValue; + boolean value = false; + for (int i = 0; i < aAllowedDimensionTypes.length; i++) { + if (aAllowedDimensionTypes[i].isInstance(aWorld.provider)) { + value = true; + } + } + + // ugly, but idk how to do it better without hard depping on tf provider in ore constructors + if (this instanceof GT_Worldgen_GT_Ore_SmallPieces) { + value = ((GT_Worldgen_GT_Ore_SmallPieces) this).twilightForest && aWorld.provider.dimensionId == 7; + } + if (this instanceof GT_Worldgen_GT_Ore_Layer) { + value = ((GT_Worldgen_GT_Ore_Layer) this).twilightForest && aWorld.provider.dimensionId == 7; + } + + mDimensionMap.put(aDimName, value); + return value; } return tAllowed; } diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java deleted file mode 100644 index 958adfad54..0000000000 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java +++ /dev/null @@ -1,34 +0,0 @@ -package gregtech.api.world; - -import java.util.ArrayList; -import java.util.Collection; - -import net.minecraft.block.Block; - -import gregtech.api.GregTech_API; - -public abstract class GT_Worldgen_Ore extends GT_Worldgen { - - public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; - public final Block mBlock; - public final Collection<String> mBiomeList; - public final boolean mAllowToGenerateinVoid; - private final String aTextWorldgen = "worldgen."; - - public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super(aName, GregTech_API.sWorldgenList, aDefault); - mDimensionType = aDimensionType; - mBlock = aBlock; - mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15); - mProbability = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Probability", aProbability); - mAmount = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Amount", aAmount); - mSize = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Size", aSize); - mMinY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MinHeight", aMinY); - mMaxY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MaxHeight", aMaxY); - if (aBiomeList == null) mBiomeList = new ArrayList<>(); - else mBiomeList = aBiomeList; - mAllowToGenerateinVoid = aAllowToGenerateinVoid; - } -} diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java deleted file mode 100644 index f89d3ad8f8..0000000000 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock.java +++ /dev/null @@ -1,52 +0,0 @@ -package gregtech.api.world; - -import java.util.Collection; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore { - - public GT_Worldgen_Ore_SingleBlock(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super( - aName, - aDefault, - aBlock, - aBlockMeta, - aDimensionType, - aAmount, - aSize, - aProbability, - aMinY, - aMaxY, - aBiomeList, - aAllowToGenerateinVoid); - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) - && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { - for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), - tZ = aChunkZ + aRandom.nextInt(16); - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ) - .isAir(aWorld, tX, tY, tZ)) - || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone) - || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone) - || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) { - aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0); - } - } - return true; - } - return false; - } -} diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java deleted file mode 100644 index 3993c65f2a..0000000000 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore_SingleBlock_UnderLava.java +++ /dev/null @@ -1,54 +0,0 @@ -package gregtech.api.world; - -import java.util.Collection; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore { - - public GT_Worldgen_Ore_SingleBlock_UnderLava(String aName, boolean aDefault, Block aBlock, int aBlockMeta, - int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, - Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { - super( - aName, - aDefault, - aBlock, - aBlockMeta, - aDimensionType, - aAmount, - aSize, - aProbability, - aMinY, - aMaxY, - aBiomeList, - aAllowToGenerateinVoid); - } - - @Override - public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) - && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { - for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), - tZ = aChunkZ + aRandom.nextInt(16); - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if (((mAllowToGenerateinVoid && aWorld.getBlock(tX, tY, tZ) - .isAir(aWorld, tX, tY, tZ)) - || (tBlock != null && (tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.stone) - || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.end_stone) - || tBlock.isReplaceableOreGen(aWorld, tX, tY, tZ, Blocks.netherrack))))) { - if (aWorld.getBlock(tX, tY + 1, tZ) == Blocks.lava - || aWorld.getBlock(tX, tY, tZ) == Blocks.flowing_lava) - aWorld.setBlock(tX, tY, tZ, mBlock, mBlockMeta, 0); - } - } - return true; - } - return false; - } -} diff --git a/src/main/java/gregtech/client/GT_GUI_ClientConfig.java b/src/main/java/gregtech/client/GT_GUI_ClientConfig.java index 1e9841369b..dfb4b2800c 100644 --- a/src/main/java/gregtech/client/GT_GUI_ClientConfig.java +++ b/src/main/java/gregtech/client/GT_GUI_ClientConfig.java @@ -2,62 +2,28 @@ package gregtech.client; import static gregtech.api.enums.Mods.GregTech; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; -import cpw.mods.fml.client.config.GuiConfig; -import cpw.mods.fml.client.config.IConfigElement; -import gregtech.api.GregTech_API; +import com.gtnewhorizon.gtnhlib.config.ConfigException; +import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig; + +import gregtech.common.config.client.ConfigColorModulation; +import gregtech.common.config.client.ConfigInterface; +import gregtech.common.config.client.ConfigPreference; +import gregtech.common.config.client.ConfigRender; +import gregtech.common.config.client.ConfigWaila; -public class GT_GUI_ClientConfig extends GuiConfig { +public class GT_GUI_ClientConfig extends SimpleGuiConfig { - public GT_GUI_ClientConfig(GuiScreen parentScreen) { + public GT_GUI_ClientConfig(GuiScreen parentScreen) throws ConfigException { super( parentScreen, - getConfigElements(), GregTech.ID, - "client", - false, - false, - getAbridgedConfigPath(GregTech_API.sClientDataFile.mConfig.toString())); - } - - @SuppressWarnings("rawtypes") - private static List<IConfigElement> getConfigElements() { - final Configuration config = GregTech_API.sClientDataFile.mConfig; - setLanguageKeys(config); - return config.getCategoryNames() - .stream() - .filter(name -> name.indexOf('.') == -1) - .map(name -> new ConfigElement(config.getCategory(name))) - .collect(Collectors.toList()); - } - - private static void setLanguageKeys(Configuration config) { - for (String categoryName : config.getCategoryNames()) { - ConfigCategory category = config.getCategory(categoryName); - category.setLanguageKey("GT5U.config." + categoryName); - for (Map.Entry<String, Property> entry : category.entrySet()) { - // drop the default value in name - String name = entry.getKey(); - int defaultStart = name.lastIndexOf('_'); - String realName = defaultStart >= 0 ? name.substring(0, defaultStart) : name; - if (categoryName.equals("nei.recipe_categories")) { - // reuse existing translation for RecipeCategory - entry.getValue() - .setLanguageKey(name); - } else { - entry.getValue() - .setLanguageKey(String.format("%s.%s", category.getLanguagekey(), realName)); - } - } - } + "GregTech", + ConfigColorModulation.class, + ConfigInterface.class, + ConfigPreference.class, + ConfigRender.class, + ConfigWaila.class); } } diff --git a/src/main/java/gregtech/client/GT_GuiFactory.java b/src/main/java/gregtech/client/GT_GuiFactory.java index 3c8e5cd52c..ecf317a6fa 100644 --- a/src/main/java/gregtech/client/GT_GuiFactory.java +++ b/src/main/java/gregtech/client/GT_GuiFactory.java @@ -1,29 +1,13 @@ package gregtech.client; -import java.util.Set; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import cpw.mods.fml.client.IModGuiFactory; - -public class GT_GuiFactory implements IModGuiFactory { +import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory; - @Override - public void initialize(Minecraft minecraftInstance) {} +public class GT_GuiFactory implements SimpleGuiFactory { @Override public Class<? extends GuiScreen> mainConfigGuiClass() { return GT_GUI_ClientConfig.class; } - - @Override - public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { - return null; - } - - @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { - return null; - } } diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index b93060ba59..cdd21a13d4 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -619,7 +619,7 @@ public class GT_Client extends GT_Proxy implements Runnable { mPollutionRenderer.preLoad(); - mPreference = new GT_ClientPreference(GregTech_API.sClientDataFile); + mPreference = new GT_ClientPreference(); Materials.initClient(); } @@ -650,24 +650,6 @@ public class GT_Client extends GT_Proxy implements Runnable { public void onPostLoad() { super.onPostLoad(); - if (GregTech_API.sClientDataFile.get("debug", "PrintMetaIDs", false)) { - try { - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { - if (GregTech_API.METATILEENTITIES[i] != null) { - GregTech_API.METATILEENTITIES[i].getStackForm(1L) - .getTooltip(null, true); - GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName()); - } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } - // reobf doesn't work with lambda, so this must be a class // noinspection Convert2Lambda ((IReloadableResourceManager) Minecraft.getMinecraft() @@ -825,9 +807,8 @@ public class GT_Client extends GT_Proxy implements Runnable { @SubscribeEvent public void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent e) { if (GregTech.ID.equals(e.modID) && "client".equals(e.configID)) { - GregTech_API.sClientDataFile.mConfig.save(); // refresh client preference and send to server, since it's the only config we allow changing at runtime. - mPreference = new GT_ClientPreference(GregTech_API.sClientDataFile); + mPreference = new GT_ClientPreference(); GT_PreLoad.loadClientConfig(); if (e.isWorldRunning) GT_Values.NW.sendToServer(new GT_Packet_ClientPreference(mPreference)); } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index b6eb9ec3ad..85978e4c20 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -18,17 +18,16 @@ import static gregtech.api.enums.Mods.Forestry; import static gregtech.api.enums.Mods.GTPlusPlus; import static gregtech.api.enums.Mods.GalacticraftCore; import static gregtech.api.enums.Mods.GalaxySpace; -import static gregtech.api.enums.Mods.GanysSurface; import static gregtech.api.enums.Mods.GraviSuite; import static gregtech.api.enums.Mods.GregTech; import static gregtech.api.enums.Mods.IguanaTweaksTinkerConstruct; -import static gregtech.api.enums.Mods.MagicalCrops; import static gregtech.api.enums.Mods.Names; import static gregtech.api.enums.Mods.Railcraft; import static gregtech.api.enums.Mods.TaintedMagic; import static gregtech.api.enums.Mods.Thaumcraft; import static gregtech.api.enums.Mods.ThaumicBoots; import static gregtech.api.enums.Mods.ThaumicTinkerer; +import static gregtech.api.enums.Mods.TinkerConstruct; import static gregtech.api.enums.Mods.TwilightForest; import static gregtech.api.enums.Mods.WitchingGadgets; import static gregtech.api.recipe.RecipeMaps.crackingRecipes; @@ -120,11 +119,11 @@ import cpw.mods.fml.common.network.FMLNetworkEvent; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.FluidState; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; +import gregtech.api.enums.ManualOreDictTweaks; import gregtech.api.enums.Materials; import gregtech.api.enums.OreDictNames; import gregtech.api.enums.OrePrefixes; @@ -166,6 +165,7 @@ import gregtech.api.util.GT_Shaped_Recipe; import gregtech.api.util.GT_Shapeless_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder; +import gregtech.common.config.opstuff.ConfigGeneral; import gregtech.common.items.GT_MetaGenerated_Item_98; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gregtech.common.items.ID_MetaTool_01; @@ -543,7 +543,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public final GT_BlockMap<Boolean> mCTMBlockCache = new GT_BlockMap<>(); public boolean mDisableVanillaOres = true; public boolean mAllowSmallBoilerAutomation = false; - public boolean mSortToTheEnd = true; public boolean mCraftingUnification = true; public boolean mInventoryUnification = true; public boolean mIncreaseDungeonLoot = true; @@ -551,7 +550,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public boolean mSurvivalIntoAdventure = false; public boolean mNerfedWoodPlank = true; public boolean mNerfedVanillaTools = true; - public boolean mHardRock = false; public boolean mHungerEffect = true; public boolean mIgnoreTcon = true; public boolean mAchievements = true; @@ -563,8 +561,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public boolean mHideUnusedOres = true; public boolean mPollution = true; public boolean mExplosionItemDrop = false; - public boolean mUseGreatlyShrukenReplacementList = true; - public int mSkeletonsShootGTArrows = 16; public int mMaxEqualEntitiesAtOneSpot = 3; public int mFlintChance = 30; public int mItemDespawnTime = 6000; @@ -572,7 +568,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public int[] mHarvestLevel = new int[1000]; public int mGraniteHavestLevel = 3; public int mMaxHarvestLevel = 7; - public int mWireHeatingTicks = 4; public double replicatorExponent = 1.2D; public int mPollutionSmogLimit = 550000; public int mPollutionPoisonLimit = 750000; @@ -608,11 +603,9 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public boolean mEnableAllMaterials = false; public boolean mEnableCleanroom = true; public boolean mLowGravProcessing = false; - public boolean mAprilFool = false; public boolean mCropNeedBlock = true; public boolean mAMHInteraction = true; public boolean mForceFreeFace = true; - public boolean mBrickedBlastFurnace = true; public boolean mMixedOreOnlyYieldsTwoThirdsOfPureOre = false; public boolean mRichOreYieldMultiplier = true; public boolean mNetherOreYieldMultiplier = true; @@ -735,10 +728,8 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public boolean mWailaTransformerVoltageTier = true; /** - * What is the order of the circuits when they are selected? + * This enables showing the cpu load in nanoseconds via waila. */ - public Map<String, Integer> mCircuitsOrder = new HashMap<>(); - public boolean wailaAverageNS = false; public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15 @@ -834,9 +825,8 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { GT_Log.ore.println("GT_Mod: Preload-Phase started!"); GregTech_API.sPreloadStarted = true; - this.mIgnoreTcon = GregTech_API.sOPStuff.get(ConfigCategories.general, "ignoreTConstruct", true); - this.mWireHeatingTicks = GregTech_API.sOPStuff.get(ConfigCategories.general, "WireHeatingTicks", 4); - this.replicatorExponent = GregTech_API.sOPStuff.get("Replicator", "Nerf Exponent", 1.2D); + this.mIgnoreTcon = ConfigGeneral.ignoreTinkerConstruct; + this.replicatorExponent = ConfigGeneral.replicatorExponent; for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry .getRegisteredFluidContainerData()) { if ((tData.filledContainer.getItem() == Items.potionitem) && (tData.filledContainer.getItemDamage() == 0)) { @@ -1070,19 +1060,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { public void onLoad() { GT_Log.out.println("GT_Mod: Beginning Load-Phase."); GT_Log.ore.println("GT_Mod: Beginning Load-Phase."); - if (MagicalCrops.isModLoaded()) { - GT_OreDictUnificator.registerOre( - "cropChilipepper", - GT_ModHandler.getModItem(MagicalCrops.ID, "magicalcrops_CropProduce", 1L, 2)); - GT_OreDictUnificator.registerOre( - "cropTomato", - GT_ModHandler.getModItem(MagicalCrops.ID, "magicalcrops_CropProduce", 1L, 8)); - GT_OreDictUnificator - .registerOre("cropGrape", GT_ModHandler.getModItem(MagicalCrops.ID, "magicalcrops_CropProduce", 1L, 4)); - } - if (GanysSurface.isModLoaded()) { - GT_OreDictUnificator.registerOre("cropTea", GT_ModHandler.getModItem(GanysSurface.ID, "teaLeaves", 1L, 0)); - } // Clay buckets, which don't get registered until Iguana Tweaks pre-init if (IguanaTweaksTinkerConstruct.isModLoaded()) { @@ -1283,7 +1260,7 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { - GregTech_API.METATILEENTITIES[i].onConfigLoad(GregTech_API.sMachineFile); + GregTech_API.METATILEENTITIES[i].onConfigLoad(); } } } @@ -1719,17 +1696,10 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { } try { aEvent.Ore.stackSize = 1; - if (this.mIgnoreTcon || aEvent.Ore.getUnlocalizedName() - .startsWith("item.oreberry")) { - if ((aOriginalMod.toLowerCase(Locale.ENGLISH) - .contains("xycraft")) - || (aOriginalMod.toLowerCase(Locale.ENGLISH) - .contains("tconstruct"))) { - if (GT_Values.D1) { - GT_Log.ore.println(aMod + " -> " + aEvent.Name + " is getting ignored, because of racism. :P"); - } - return; - } + + // skipping TinkerConstruct ore registration + if (this.mIgnoreTcon && aOriginalMod.equals(TinkerConstruct.ID)) { + return; } String tModToName = aMod + " -> " + aEvent.Name; if (this.mOreDictActivated || GregTech_API.sPostloadStarted || GregTech_API.sLoadFinished) { @@ -2743,8 +2713,6 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { } public void registerUnificationEntries() { - GregTech_API.sUnification.mConfig.save(); - GregTech_API.sUnification.mConfig.load(); GT_OreDictUnificator.resetUnificationEntries(); for (OreDictEventContainer tOre : this.mEvents) { if ((!(tOre.mEvent.Ore.getItem() instanceof GT_MetaGenerated_Item)) && (tOre.mPrefix != null) @@ -2753,166 +2721,17 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { boolean checkModID = tOre.mModID != null; if (checkModID) { - switch (tOre.mModID) { - case Names.ENDER_I_O -> { - if (tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.DarkSteel) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } - } - case Names.THERMAL_FONDATION -> { - if (tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Blizz) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Pyrotheum) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } - } - case Names.ARS_MAGICA2 -> { - if (tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Vinteum) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.BlueTopaz) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Chimerite) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Moonstone) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Sunstone) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } - } - case Names.ROTARY_CRAFT -> { - if (tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.HSLA) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } - } - case Names.APPLIED_ENERGISTICS2 -> { - if (tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.CertusQuartz) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } else if (tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.CertusQuartz) { - GT_OreDictUnificator - .addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set( - tOre.mPrefix, - tOre.mMaterial, - tOre.mEvent.Ore, - (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - true)), - true); - continue; - } + if (tOre.mModID.equals(Names.ENDER_I_O)) { + if (tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.DarkSteel) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set( + tOre.mPrefix, + tOre.mMaterial, + tOre.mEvent.Ore, + ManualOreDictTweaks.shouldOredictBeOverwritten(tOre.mModID, tOre.mEvent.Name), + true); + continue; } - default -> {} } } if (GT_OreDictUnificator.isBlacklisted(tOre.mEvent.Ore)) { @@ -2923,10 +2742,7 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, - (checkModID) && (GregTech_API.sUnification.get( - ConfigCategories.specialunificationtargets + "." + tOre.mModID, - tOre.mEvent.Name, - false)), + checkModID && ManualOreDictTweaks.shouldOredictBeOverwritten(tOre.mModID, tOre.mEvent.Name), true); } } @@ -2944,18 +2760,13 @@ public abstract class GT_Proxy implements IGT_Mod, IFuelHandler { tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, - (tOre.mModID != null) && (GregTech_API.sUnification.get( - new StringBuilder().append(ConfigCategories.specialunificationtargets) - .append(".") - .append(tOre.mModID), - tOre.mEvent.Name, - false)), + (tOre.mModID != null) + && ManualOreDictTweaks.shouldOredictBeOverwritten(tOre.mModID, tOre.mEvent.Name), true); } } } GregTech_API.sUnificationEntriesRegistered = true; - GregTech_API.sUnification.mConfig.save(); GT_Recipe.reInit(); } 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 23bf149b9c..718b682916 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 @@ -17,8 +17,8 @@ import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.chunk.IChunkProvider; +import bloodasp.galacticgreg.api.enums.DimensionDef; import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; import gregtech.api.util.GT_Log; import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_TileEntity_Ores; @@ -36,76 +36,45 @@ public class GT_Worldgen_GT_Ore_Layer extends GT_Worldgen { public final short mSecondaryMeta; public final short mBetweenMeta; public final short mSporadicMeta; - // public final String mBiome; public final String mRestrictBiome; public final boolean mOverworld; public final boolean mNether; public final boolean mEnd; public final boolean mEndAsteroid; + public final boolean twilightForest; public static final int WRONG_BIOME = 0; public static final int WRONG_DIMENSION = 1; public static final int NO_ORE_IN_BOTTOM_LAYER = 2; public static final int NO_OVERLAP = 3; public static final int ORE_PLACED = 4; public static final int NO_OVERLAP_AIR_BLOCK = 5; - - public final boolean mMoon = false, mMars = false, mAsteroid = false; public final String aTextWorldgen = "worldgen."; public Class[] mAllowedProviders; - @Deprecated - 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 GC_UNUSED1, boolean GC_UNUSED2, - boolean GC_UNUSED3, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { - this( - aName, - aDefault, - aMinY, - aMaxY, - aWeight, - aDensity, - aSize, - aOverworld, - aNether, - aEnd, - aPrimary, - aSecondary, - aBetween, - aSporadic); - } - - 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, Materials aPrimary, Materials aSecondary, - Materials aBetween, Materials aSporadic) { - super(aName, sList, aDefault); - 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.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - short mMaxY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY)); + public GT_Worldgen_GT_Ore_Layer(OreMixBuilder mix) { + super(mix.oreMixName, sList, mix.enabledByDefault); + this.mOverworld = mix.dimsEnabled.getOrDefault(OreMixBuilder.OW, false); + this.mNether = mix.dimsEnabled.getOrDefault(OreMixBuilder.NETHER, false); + this.mEnd = mix.dimsEnabled.getOrDefault(OreMixBuilder.THE_END, false); + this.mEndAsteroid = mix.dimsEnabled + .getOrDefault(DimensionDef.EndAsteroids.modDimensionDef.getDimensionName(), false); + this.twilightForest = mix.dimsEnabled.getOrDefault(OreMixBuilder.TWILIGHT_FOREST, false); + this.mMinY = ((short) mix.minY); + short mMaxY = ((short) mix.maxY); if (mMaxY < (this.mMinY + 9)) { GT_Log.out.println("Oremix " + this.mWorldGenName + " has invalid Min/Max heights!"); mMaxY = (short) (this.mMinY + 9); } this.mMaxY = mMaxY; - 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"); + this.mWeight = (short) mix.weight; + this.mDensity = (short) mix.density; + this.mSize = (short) Math.max(1, mix.size); + this.mPrimaryMeta = (short) mix.primary.mMetaItemSubID; + this.mSecondaryMeta = (short) mix.secondary.mMetaItemSubID; + this.mBetweenMeta = (short) mix.between.mMetaItemSubID; + this.mSporadicMeta = (short) mix.sporadic.mMetaItemSubID; + this.mRestrictBiome = "None"; if (this.mEnabled) { sWeight += this.mWeight; diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java index f1e0c92703..ef01c2ea0f 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java @@ -13,7 +13,6 @@ import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.chunk.IChunkProvider; import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; import gregtech.api.util.GT_Log; import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_TileEntity_Ores; @@ -27,63 +26,26 @@ public class GT_Worldgen_GT_Ore_SmallPieces extends GT_Worldgen { public final boolean mOverworld; public final boolean mNether; public final boolean mEnd; - public final boolean mMoon = false, mMars = false, mAsteroid = false; + public final boolean twilightForest; public final String mBiome; - public final String aTextWorldgen = "worldgen."; public static ArrayList<GT_Worldgen_GT_Ore_SmallPieces> sList = new ArrayList<>(); public Class[] mAllowedProviders; - // TODO CHECK IF INSTANTIATION IS CORRECT - public GT_Worldgen_GT_Ore_SmallPieces(String aName, boolean aDefault, int aMinY, int aMaxY, int aAmount, - boolean aOverworld, boolean aNether, boolean aEnd, Materials aPrimary) { - super(aName, GregTech_API.sWorldgenList, aDefault); - 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.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max( - this.mMinY + 1, - GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mAmount = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Amount", aAmount))); - this.mMeta = ((short) GregTech_API.sWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "Ore", aPrimary.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "BiomeName", "None"); - sList.add(this); + public GT_Worldgen_GT_Ore_SmallPieces(SmallOreBuilder ore) { + super(ore.smallOreName, GregTech_API.sWorldgenList, ore.enabledByDefault); + this.mOverworld = ore.dimsEnabled.getOrDefault(SmallOreBuilder.OW, false); + this.mNether = ore.dimsEnabled.getOrDefault(SmallOreBuilder.NETHER, false); + this.mEnd = ore.dimsEnabled.getOrDefault(SmallOreBuilder.THE_END, false); + this.twilightForest = ore.dimsEnabled.getOrDefault(SmallOreBuilder.TWILIGHT_FOREST, false); - List<Class> allowedProviders = new ArrayList<>(); - if (this.mNether) { - allowedProviders.add(WorldProviderHell.class); - } - - if (this.mOverworld) { - allowedProviders.add(WorldProviderSurface.class); - } - - if (this.mEnd) { - allowedProviders.add(WorldProviderEnd.class); - } - mAllowedProviders = allowedProviders.toArray(new Class[allowedProviders.size()]); - } + this.mMinY = (short) ore.minY; + this.mMaxY = (short) Math.max(this.mMinY + 1, ore.maxY); + this.mAmount = (short) Math.max(1, ore.amount); + this.mMeta = (short) ore.ore.mMetaItemSubID; + this.mBiome = "None"; - public GT_Worldgen_GT_Ore_SmallPieces(String aName, boolean aDefault, int aMinY, int aMaxY, int aAmount, - boolean aOverworld, boolean aNether, boolean aEnd, boolean GC_UNUSED1, boolean GC_UNUSED2, boolean GC_UNUSED3, - Materials aPrimary) { - super(aName, GregTech_API.sWorldgenList, aDefault); - 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.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max( - this.mMinY + 1, - GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mAmount = ((short) Math - .max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Amount", aAmount))); - this.mMeta = ((short) GregTech_API.sWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "Ore", aPrimary.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "BiomeName", "None"); - sList.add(this); + if (this.mEnabled) sList.add(this); List<Class> allowedProviders = new ArrayList<>(); if (this.mNether) { diff --git a/src/main/java/gregtech/common/GT_Worldgen_Stone.java b/src/main/java/gregtech/common/GT_Worldgen_Stone.java index a9001d3f26..97621865bc 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_Stone.java +++ b/src/main/java/gregtech/common/GT_Worldgen_Stone.java @@ -16,11 +16,11 @@ import net.minecraft.world.chunk.IChunkProvider; import gregtech.api.GregTech_API; import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Log; -import gregtech.api.world.GT_Worldgen_Ore; +import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; -public class GT_Worldgen_Stone extends GT_Worldgen_Ore { +public class GT_Worldgen_Stone extends GT_Worldgen { static final double[] sizeConversion = { 1, 1, 1.333333, 1.333333, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; // Bias // the @@ -36,6 +36,12 @@ public class GT_Worldgen_Stone extends GT_Worldgen_Ore { // or // sills. + public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; + public final Block mBlock; + public final Collection<String> mBiomeList; + public final boolean mAllowToGenerateinVoid; + private final String aTextWorldgen = "worldgen."; + public Hashtable<Long, StoneSeeds> validStoneSeeds = new Hashtable<>(1024); static class StoneSeeds { @@ -58,22 +64,18 @@ public class GT_Worldgen_Stone extends GT_Worldgen_Ore { } } - public GT_Worldgen_Stone(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super( - aName, - aDefault, - aBlock, - aBlockMeta, - aDimensionType, - aAmount, - aSize, - aProbability, - aMinY, - aMaxY, - aBiomeList, - aAllowToGenerateinVoid); + public GT_Worldgen_Stone(StoneBuilder stone) { + super(stone.stoneName, GregTech_API.sWorldgenList, stone.enabledByDefault); + mDimensionType = stone.dimension; + mBlock = stone.block; + mBlockMeta = Math.min(Math.max(stone.blockMeta, 0), 15); + mProbability = stone.probability; + mAmount = stone.amount; + mSize = stone.size; + mMinY = stone.minY; + mMaxY = stone.maxY; + mBiomeList = new ArrayList<>(); + mAllowToGenerateinVoid = stone.allowToGenerateInVoid; } @Override diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 7357f42446..68ce3e4d82 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -34,6 +34,7 @@ import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Log; import gregtech.api.world.GT_Worldgen; import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.common.config.worldgen.ConfigEndAsteroids; public class GT_Worldgenerator implements IWorldGenerator { @@ -47,30 +48,27 @@ public class GT_Worldgenerator implements IWorldGenerator { // This is probably not going to work. Trying to create a fake orevein to put into hashtable when there will be no // ores in a vein. public static GT_Worldgen_GT_Ore_Layer noOresInVein = new GT_Worldgen_GT_Ore_Layer( - "NoOresInVein", - false, - 0, - 255, - 0, - 255, - 16, - false, - false, - false, - Materials.Aluminium, - Materials.Aluminium, - Materials.Aluminium, - Materials.Aluminium); + new OreMixBuilder().name("NoOresInVein") + .disabledByDefault() + .heightRange(0, 255) + .weight(0) + .density(255) + .size(16) + .primary(Materials.Aluminium) + .secondary(Materials.Aluminium) + .inBetween(Materials.Aluminium) + .sporadic(Materials.Aluminium)); + public static Hashtable<Long, GT_Worldgen_GT_Ore_Layer> validOreveins = new Hashtable<>(1024); public boolean mIsGenerating = false; public static final Object listLock = new Object(); public static OregenPattern oregenPattern = OregenPattern.AXISSYMMETRICAL; public GT_Worldgenerator() { - endAsteroids = GregTech_API.sWorldgenFile.get("endasteroids", "GenerateAsteroids", true); - endMinSize = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidMinSize", 50); - endMaxSize = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidMaxSize", 200); - mEndAsteroidProbability = GregTech_API.sWorldgenFile.get("endasteroids", "AsteroidProbability", 300); + endAsteroids = ConfigEndAsteroids.generateEndAsteroids; + endMinSize = ConfigEndAsteroids.EndAsteroidMinSize; + endMaxSize = ConfigEndAsteroids.EndAsteroidMaxSize; + mEndAsteroidProbability = ConfigEndAsteroids.EndAsteroidProbability; GameRegistry.registerWorldGenerator(this, 1073741823); if (debugWorldGen) { GT_Log.out.println("GT_Worldgenerator created"); diff --git a/src/main/java/gregtech/common/OreMixBuilder.java b/src/main/java/gregtech/common/OreMixBuilder.java new file mode 100644 index 0000000000..2a78f516a0 --- /dev/null +++ b/src/main/java/gregtech/common/OreMixBuilder.java @@ -0,0 +1,86 @@ +package gregtech.common; + +import java.util.HashMap; +import java.util.Map; + +import bloodasp.galacticgreg.api.enums.DimensionDef; +import gregtech.api.enums.Materials; + +public class OreMixBuilder { + + public static final String OW = "Overworld"; + public static final String NETHER = "Nether"; + public static final String THE_END = "TheEnd"; + public static final String TWILIGHT_FOREST = "Twilight Forest"; + public String oreMixName; + public boolean enabledByDefault = true; + public Map<String, Boolean> dimsEnabled = new HashMap<>(); + public int minY, maxY, weight, density, size; + public Materials primary, secondary, between, sporadic; + + public OreMixBuilder name(String name) { + this.oreMixName = name; + return this; + } + + public OreMixBuilder disabledByDefault() { + this.enabledByDefault = false; + return this; + } + + public OreMixBuilder enableInDim(DimensionDef... dims) { + for (DimensionDef dim : dims) { + this.dimsEnabled.put(dim.modDimensionDef.getDimensionName(), true); + } + return this; + } + + public OreMixBuilder enableInDim(String... dims) { + for (String dim : dims) { + this.dimsEnabled.put(dim, true); + } + return this; + } + + public OreMixBuilder heightRange(int minY, int maxY) { + this.minY = minY; + this.maxY = maxY; + return this; + } + + public OreMixBuilder density(int density) { + this.density = density; + return this; + } + + public OreMixBuilder weight(int weight) { + this.weight = weight; + return this; + } + + public OreMixBuilder size(int size) { + this.size = size; + return this; + } + + public OreMixBuilder primary(Materials primary) { + this.primary = primary; + return this; + } + + public OreMixBuilder secondary(Materials secondary) { + this.secondary = secondary; + return this; + } + + public OreMixBuilder inBetween(Materials between) { + this.between = between; + return this; + } + + public OreMixBuilder sporadic(Materials sporadic) { + this.sporadic = sporadic; + return this; + } + +} diff --git a/src/main/java/gregtech/common/SmallOreBuilder.java b/src/main/java/gregtech/common/SmallOreBuilder.java new file mode 100644 index 0000000000..e9a68e7caf --- /dev/null +++ b/src/main/java/gregtech/common/SmallOreBuilder.java @@ -0,0 +1,60 @@ +package gregtech.common; + +import java.util.HashMap; +import java.util.Map; + +import bloodasp.galacticgreg.api.enums.DimensionDef; +import gregtech.api.enums.Materials; + +public class SmallOreBuilder { + + public static final String OW = "Overworld"; + public static final String NETHER = "Nether"; + public static final String THE_END = "TheEnd"; + public static final String TWILIGHT_FOREST = "Twilight Forest"; + public String smallOreName; + public boolean enabledByDefault = true; + public Map<String, Boolean> dimsEnabled = new HashMap<>(); + public int minY, maxY, amount; + public Materials ore; + + public SmallOreBuilder name(String name) { + this.smallOreName = name; + return this; + } + + public SmallOreBuilder disabledByDefault() { + this.enabledByDefault = false; + return this; + } + + public SmallOreBuilder enableInDim(DimensionDef... dims) { + for (DimensionDef dim : dims) { + this.dimsEnabled.put(dim.modDimensionDef.getDimensionName(), true); + } + return this; + } + + public SmallOreBuilder enableInDim(String... dims) { + for (String dim : dims) { + this.dimsEnabled.put(dim, true); + } + return this; + } + + public SmallOreBuilder heightRange(int minY, int maxY) { + this.minY = minY; + this.maxY = maxY; + return this; + } + + public SmallOreBuilder amount(int amount) { + this.amount = amount; + return this; + } + + public SmallOreBuilder ore(Materials ore) { + this.ore = ore; + return this; + } +} diff --git a/src/main/java/gregtech/common/StoneBuilder.java b/src/main/java/gregtech/common/StoneBuilder.java new file mode 100644 index 0000000000..3ab32937a6 --- /dev/null +++ b/src/main/java/gregtech/common/StoneBuilder.java @@ -0,0 +1,66 @@ +package gregtech.common; + +import net.minecraft.block.Block; + +public class StoneBuilder { + + public String stoneName; + public Block block; + public int blockMeta; + public int dimension; + public int minY, maxY; + public int amount, size, probability; + public boolean enabledByDefault = true; + public boolean allowToGenerateInVoid; + + public StoneBuilder name(String name) { + this.stoneName = name; + return this; + } + + public StoneBuilder block(Block block) { + this.block = block; + return this; + } + + public StoneBuilder blockMeta(int blockMeta) { + this.blockMeta = blockMeta; + return this; + } + + public StoneBuilder disabledByDefault() { + this.enabledByDefault = false; + return this; + } + + public StoneBuilder generationInVoidEnabled(boolean allowToGenerateInVoid) { + this.allowToGenerateInVoid = allowToGenerateInVoid; + return this; + } + + public StoneBuilder heightRange(int minY, int maxY) { + this.minY = minY; + this.maxY = maxY; + return this; + } + + public StoneBuilder amount(int amount) { + this.amount = amount; + return this; + } + + public StoneBuilder size(int size) { + this.size = size; + return this; + } + + public StoneBuilder probability(int probability) { + this.probability = probability; + return this; + } + + public StoneBuilder dimension(int dimension) { + this.dimension = dimension; + return this; + } +} diff --git a/src/main/java/gregtech/common/config/client/ConfigColorModulation.java b/src/main/java/gregtech/common/config/client/ConfigColorModulation.java new file mode 100644 index 0000000000..f5b189136e --- /dev/null +++ b/src/main/java/gregtech/common/config/client/ConfigColorModulation.java @@ -0,0 +1,25 @@ +package gregtech.common.config.client; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "color_modulation", + configSubDirectory = "GregTech", + filename = "Client") +public class ConfigColorModulation { + + @Config.Comment("hex value for the cable insulation color modulation.") + @Config.DefaultString("#404040") + public static String cableInsulation; + + @Config.Comment("hex value for the construction foam color modulation.") + @Config.DefaultString("#404040") + public static String constructionFoam; + + @Config.Comment("hex value for the machine metal color modulation.") + @Config.DefaultString("#D2DCFF") + public static String machineMetal; +} diff --git a/src/main/java/gregtech/common/config/client/ConfigInterface.java b/src/main/java/gregtech/common/config/client/ConfigInterface.java new file mode 100644 index 0000000000..261be6f51c --- /dev/null +++ b/src/main/java/gregtech/common/config/client/ConfigInterface.java @@ -0,0 +1,29 @@ +package gregtech.common.config.client; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "interface", configSubDirectory = "GregTech", filename = "Client") +public class ConfigInterface { + + @Config.Comment("if true, makes cover tabs visible on GregTech machines.") + @Config.DefaultBoolean(true) + public static boolean coverTabsVisible; + + @Config.Comment("if true, puts the cover tabs display on the right of the UI instead of the left.") + @Config.DefaultBoolean(false) + public static boolean coverTabsFlipped; + + @Config.Comment("How verbose should tooltips be? 0: disabled, 1: one-line, 2: normal, 3+: extended.") + @Config.DefaultInt(2) + public static int tooltipVerbosity; + + @Config.Comment("How verbose should tooltips be when LSHIFT is held? 0: disabled, 1: one-line, 2: normal, 3+: extended.") + @Config.DefaultInt(3) + public static int tooltipShiftVerbosity; + + @Config.Comment("Which style to use for title tab on machine GUI? 0: text tab split-dark, 1: text tab unified, 2: item icon tab.") + @Config.DefaultInt(0) + public static int titleTabStyle; +} diff --git a/src/main/java/gregtech/common/config/client/ConfigPreference.java b/src/main/java/gregtech/common/config/client/ConfigPreference.java new file mode 100644 index 0000000000..f69ee8b890 --- /dev/null +++ b/src/main/java/gregtech/common/config/client/ConfigPreference.java @@ -0,0 +1,21 @@ +package gregtech.common.config.client; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "preference", configSubDirectory = "GregTech", filename = "Client") +public class ConfigPreference { + + @Config.Comment("if true, input filter will initially be on when input buses are placed in the world.") + @Config.DefaultBoolean(false) + public static boolean inputBusInitialFilter; + + @Config.Comment("if true, allow multistacks on single blocks by default when they are first placed in the world.") + @Config.DefaultBoolean(false) + public static boolean singleBlockInitialAllowMultiStack; + + @Config.Comment("if true, input filter will initially be on when machines are placed in the world.") + @Config.DefaultBoolean(false) + public static boolean singleBlockInitialFilter; +} diff --git a/src/main/java/gregtech/common/config/client/ConfigRender.java b/src/main/java/gregtech/common/config/client/ConfigRender.java new file mode 100644 index 0000000000..27860a13cb --- /dev/null +++ b/src/main/java/gregtech/common/config/client/ConfigRender.java @@ -0,0 +1,46 @@ +package gregtech.common.config.client; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "render", configSubDirectory = "GregTech", filename = "Client") +public class ConfigRender { + + @Config.Comment("if true, enables ambient-occlusion smooth lighting on tiles.") + @Config.DefaultBoolean(true) + public static boolean renderTileAmbientOcclusion; + + @Config.Comment("if true, enables glowing of the machine controllers.") + @Config.DefaultBoolean(true) + public static boolean renderGlowTextures; + + @Config.Comment("if true, render flipped machine with flipped textures.") + @Config.DefaultBoolean(true) + public static boolean renderFlippedMachinesFlipped; + + @Config.Comment("if true, render indicators on hatches.") + @Config.DefaultBoolean(true) + public static boolean renderIndicatorsOnHatch; + + @Config.Comment("if true, enables dirt particles when pollution reaches the threshold.") + @Config.DefaultBoolean(true) + public static boolean renderDirtParticles; + + @Config.Comment("if true, enables pollution fog when pollution reaches the threshold.") + @Config.DefaultBoolean(true) + public static boolean renderPollutionFog; + + @Config.Comment("if true, enables the green -> red durability for an item's damage value.") + @Config.DefaultBoolean(true) + public static boolean renderItemDurabilityBar; + + @Config.Comment("if true, enables the blue charge bar for an electric item's charge.") + @Config.DefaultBoolean(true) + public static boolean renderItemChargeBar; + + @Config.Comment("enables BaseMetaTileEntity block updates handled by BlockUpdateHandler.") + @Config.DefaultBoolean(false) + public static boolean useBlockUpdateHandler; + +} diff --git a/src/main/java/gregtech/common/config/client/ConfigWaila.java b/src/main/java/gregtech/common/config/client/ConfigWaila.java new file mode 100644 index 0000000000..9d6f732941 --- /dev/null +++ b/src/main/java/gregtech/common/config/client/ConfigWaila.java @@ -0,0 +1,21 @@ +package gregtech.common.config.client; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "waila", configSubDirectory = "GregTech", filename = "Client") + +public class ConfigWaila { + + /** + * This enables showing voltage tier of transformer for Waila, instead of raw voltage number + */ + @Config.Comment("if true, enables showing voltage tier of transformer for Waila, instead of raw voltage number.") + @Config.DefaultBoolean(true) + public static boolean wailaTransformerVoltageTier; + + @Config.Comment("if true, enables showing voltage tier of transformer for Waila, instead of raw voltage number.") + @Config.DefaultBoolean(false) + public static boolean wailaAverageNS; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigDebug.java b/src/main/java/gregtech/common/config/gregtech/ConfigDebug.java new file mode 100644 index 0000000000..fe5fc52b13 --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigDebug.java @@ -0,0 +1,79 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "debug", configSubDirectory = "GregTech", filename = "GregTech") +public class ConfigDebug { + + @Config.Comment("enable D1 flag (a set of debug logs)") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean D1; + + @Config.Comment("enable D2 flag (another set of debug logs)") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean D2; + + @Config.Comment("This will prevent NEI from crashing but spams the Log.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean allowBrokenRecipeMap; + + @Config.Comment("Debug parameters for cleanroom testing.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugCleanroom; + + @Config.Comment("Debug parameter for driller testing.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugDriller; + + @Config.Comment("Debug parameter for world generation. Tracks chunks added/removed from run queue.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugWorldgen; + + @Config.Comment("Debug parameter for orevein generation.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugOrevein; + + @Config.Comment("Debug parameter for small ore generation.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugSmallOres; + + @Config.Comment("Debug parameter for stones generation.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugStones; + + @Config.Comment("Debug parameter for single block miner.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugBlockMiner; + + @Config.Comment("Debug parameter for single block pump.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugBlockPump; + + @Config.Comment("Debug parameter for entity cramming reduction.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugEntityCramming; + + @Config.Comment("Debug parameter for gregtech.api.util.GT_ChunkAssociatedData") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugWorldData; + + @Config.Comment("Debug parameter for chunk loaders.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean debugChunkloaders; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigFeatures.java b/src/main/java/gregtech/common/config/gregtech/ConfigFeatures.java new file mode 100644 index 0000000000..82a86f9186 --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigFeatures.java @@ -0,0 +1,34 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "features", configSubDirectory = "GregTech", filename = "GregTech") +public class ConfigFeatures { + + @Config.Comment("Controls the stacksize of tree related blocks.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int maxLogStackSize; + + @Config.Comment("Controls the stacksize of every oredicted prefix based items used for blocks (if that even makes sense)") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int maxOtherBlocksStackSize; + + @Config.Comment("Controls the stacksize of oredicted planks.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int maxPlankStackSize; + + @Config.Comment("Controls the stacksize of oredicted items used in ore treatment.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int maxOreStackSize; + + @Config.Comment("Controls the stacksize of IC2 overclocker upgrades.") + @Config.DefaultInt(4) + @Config.RequiresMcRestart + public static int upgradeStackSize; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigGeneral.java b/src/main/java/gregtech/common/config/gregtech/ConfigGeneral.java new file mode 100644 index 0000000000..e2ac011d39 --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigGeneral.java @@ -0,0 +1,254 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "general", configSubDirectory = "GregTech", filename = "GregTech") +public class ConfigGeneral { + + @Config.Comment("Control percentage of filled 3x3 chunks. Lower number means less oreveins spawn.") + @Config.DefaultInt(100) + @Config.RequiresMcRestart + public static int oreveinPercentage; + + @Config.Comment("Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is cheap") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int oreveinAttempts; + + @Config.Comment("Control number of attempts to place a valid ore vein. If a vein wasn't placed due to height restrictions, completely in the water, etc, another attempt is tried.") + @Config.DefaultInt(8) + @Config.RequiresMcRestart + public static int oreveinMaxPlacementAttempts; + + @Config.Comment("Whether to place small ores as placer ores for an orevein.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean oreveinPlacerOres; + + @Config.Comment("Multiplier to control how many placer ores get generated.") + @Config.DefaultInt(2) + @Config.RequiresMcRestart + public static int oreveinPlacerOresMultiplier; + + @Config.Comment("If true, enables the timber axe (cuts down whole tree in a single hit).") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean timber; + + @Config.Comment("If true, all the GT5U potions are always drinkable.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean drinksAlwaysDrinkable; + + @Config.Comment("if true, shows all the metaitems in creative and in NEI.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean doShowAllItemsInCreative; + + @Config.Comment("if true, makes the GT5U sounds multi-threaded.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean multiThreadedSounds; + + @Config.Comment("Max entity amount in the same block for entity craming.") + @Config.DefaultInt(6) + @Config.RequiresMcRestart + public static int maxEqualEntitiesAtOneSpot; + + @Config.Comment("The chance of success to start a fire from the flint and steel.") + @Config.DefaultInt(30) + @Config.RequiresMcRestart + public static int flintChance; + + @Config.Comment("Entity despawn time.") + @Config.DefaultInt(6000) + @Config.RequiresMcRestart + public static int itemDespawnTime; + + @Config.Comment("If true, allows small boiler automation.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean allowSmallBoilerAutomation; + + @Config.Comment("If true, increases dungeon loots in vanilla structures.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean increaseDungeonLoot; + + @Config.Comment("If true, spawns an axe at the start in adventure mode. Does nothing if the advanture mode isn't forced.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean axeWhenAdventure; + + @Config.Comment("If true, forces the survival map into adventure mode.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean survivalIntoAdventure; + + @Config.Comment("If true, hungers the players based on his amount of stuff in the inventory every 6s, regardless of player movement.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean hungerEffect; + + @Config.Comment("If true, enables the item oredification of the items in the inventory.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean inventoryUnification; + + @Config.Comment("if true, enables GT5U and GT++ bees.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean GTBees; + + @Config.Comment("if true, enables crafting unification.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean craftingUnification; + + @Config.Comment("If true, nerfs planks recipes.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean nerfedWoodPlank; + + @Config.Comment("if true, reduces the durability of the vanilla tools.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean nerfedVanillaTools; + + @Config.Comment("if true, enables GT5U achievements.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean achievements; + + @Config.Comment("if true, hides unused ores.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean hideUnusedOres; + + @Config.Comment("if true, enables all the materials in GT5U.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean enableAllMaterials; + + @Config.Comment("Controls the amount of tick over the lag averaging is done with the scanner.") + @Config.DefaultInt(25) + @Config.RequiresMcRestart + public static int ticksForLagAveraging; + + @Config.Comment("Controls the threshold (in ms) above which a lag warning is issued in log for a specific tile entity.") + @Config.DefaultInt(100) + @Config.RequiresMcRestart + public static int millisecondThesholdUntilLagWarning; + + @Config.Comment("if true, drops the content of the machine inventory before exploding.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean explosionItemDrop; + + @Config.Comment("if true, enables the cleanroom multi.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean enableCleanroom; + + @Config.Comment("if true, enables low gravity requirement in some crafts. Is forced to false if GalactiCraft is not present.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean lowGravProcessing; + + @Config.Comment("if true, crops need a block below to fully grow.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean cropNeedBlock; + + @Config.Comment("if yes, allows the automatic interactions with the maintenance hatches.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean autoMaintenaceHatchesInteraction; + + @Config.Comment("if true, mixed ores only yields the equivalent of 2/3 of the pure ores.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean mixedOreOnlyYieldsTwoThirdsOfPureOre; + + @Config.Comment("if true, rich ores yield twice as much as normal ores.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean richOreYieldMultiplier; + + @Config.Comment("if true, nether ores yield twice as much as normal ores.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean netherOreYieldMultiplier; + + @Config.Comment("if true, end ores yield twice as much as normal ores.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean endOreYieldMultiplier; + + @Config.Comment("if true, enables GT6 styled pipe connections.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean gt6Pipe; + + @Config.Comment("if true, enables GT6 styled wire connections.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean gt6Cable; + + @Config.Comment("if true, allows GT5U cables to be IC2 power sources.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean ic2EnergySourceCompat; + + @Config.Comment("if true, wires will require soldering material to be connected.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean costlyCableConnection; + + @Config.Comment("if true, crashes on null recipe input.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean crashOnNullRecipeInput; + + @Config.Comment("if true, enable placeholder for material names in lang file.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean i18nPlaceholder; + + @Config.Comment("if true, sets the hardness of the mobspawers to 500 and their blast resistance to 6 000 000.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean harderMobSpawner; + + @Config.Comment("Controls the minimum distance allowed for the long distance pipelines to form.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int minimalDistancePoints; + + @Config.Comment("This will set the blacklist of blocks for CTM blocks.") + @Config.DefaultStringList({ "team.chisel.block.BlockRoadLine" }) + @Config.RequiresMcRestart + public static String[] CTMBlacklist; + + @Config.Comment("This will set the whitelist of blocks for CTM blocks.") + @Config.DefaultStringList({ "team.chisel.block.BlockCarvable", "team.chisel.block.BlockCarvableGlass" }) + @Config.RequiresMcRestart + public static String[] CTMWhitelist; + + @Config.Comment("if true, logs all the oredict in logs/OreDict.log.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean loggingOreDict; + + @Config.Comment("if true, logs all the oredict in logs/Explosion.log.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean loggingExplosions; + + @Config.Comment("if true, log all the oredict in logs/PlayerActivity.log.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean loggingPlayerActicity; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigHarvestLevel.java b/src/main/java/gregtech/common/config/gregtech/ConfigHarvestLevel.java new file mode 100644 index 0000000000..f924ceda8d --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigHarvestLevel.java @@ -0,0 +1,28 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "harvest_level", + configSubDirectory = "GregTech", + filename = "GregTech") +public class ConfigHarvestLevel { + + @Config.Comment("Activate Harvest Level Change") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean activateHarvestLevelChange; + + @Config.Comment("Maximum harvest level") + @Config.DefaultInt(7) + @Config.RequiresMcRestart + public static int maxHarvestLevel; + + @Config.Comment("GraniteHarvestLevel harvest level") + @Config.DefaultInt(3) + @Config.RequiresMcRestart + public static int graniteHarvestLevel; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigMachines.java b/src/main/java/gregtech/common/config/gregtech/ConfigMachines.java new file mode 100644 index 0000000000..06f6c0c18f --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigMachines.java @@ -0,0 +1,147 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "machines", configSubDirectory = "GregTech", filename = "GregTech") +public class ConfigMachines { + + @Config.Comment("Number of ticks between sending sound packets to clients for electric machines. Default is 1.5 seconds. Trying to mitigate lag and FPS drops.") + @Config.DefaultInt(30) + @Config.RequiresMcRestart + public static int ticksBetweenSounds; + + @Config.Comment("This will set the blacklist for the world accelerator in TE mode.") + @Config.DefaultStringList({ "com.rwtema.extrautils.tileentity.enderquarry.TileEntityEnderQuarry", + "advsolar.common.tiles.TileEntityUltimateSolarPanel", "advsolar.common.tiles.TileEntitySolarPanel", + "advsolar.common.tiles.TileEntityQuantumSolarPanel", "advsolar.common.tiles.TileEntityHybridSolarPanel", + "advsolar.common.tiles.TileEntityAdvancedSolarPanel", "com.supsolpans.tiles.TileAdminSolarPanel", + "com.supsolpans.tiles.TilePhotonicSolarPanel", "com.supsolpans.tiles.TileSingularSolarPanel", + "com.supsolpans.tiles.TileSpectralSolarPanel", "emt.tile.solar.air.TileEntityAirSolar", + "emt.tile.solar.air.TileEntityDoubleAirSolar", "emt.tile.solar.air.TileEntityTripleAirSolar", + "emt.tile.solar.air.TileEntityQuadrupleAirSolar", "emt.tile.solar.air.TileEntityQuintupleAirSolar", + "emt.tile.solar.air.TileEntitySextupleAirSolar", "emt.tile.solar.air.TileEntitySeptupleAirSolar", + "emt.tile.solar.air.TileEntityOctupleAirSolar", "emt.tile.solar.compressed.TileEntityCompressedSolar", + "emt.tile.solar.compressed.TileEntityDoubleCompressedSolar", + "emt.tile.solar.compressed.TileEntityTripleCompressedSolar", + "emt.tile.solar.compressed.TileEntityQuadrupleAirSolar", + "emt.tile.solar.compressed.TileEntityQuintupleAirSolar", "emt.tile.solar.compressed.TileEntitySextupleAirSolar", + "emt.tile.solar.compressed.TileEntitySeptupleAirSolar", "emt.tile.solar.compressed.TileEntityOctupleAirSolar", + "emt.tile.solar.dark.TileEntityDarkSolar", "emt.tile.solar.dark.TileEntityDoubleDarkSolar", + "emt.tile.solar.dark.TileEntityTripleDarkSolar", "emt.tile.solar.dark.TileEntityQuadrupleAirSolar", + "emt.tile.solar.dark.TileEntityQuintupleAirSolar", "emt.tile.solar.dark.TileEntitySextupleAirSolar", + "emt.tile.solar.dark.TileEntitySeptupleAirSolar", "emt.tile.solar.dark.TileEntityOctupleAirSolar", + "emt.tile.solar.earth.TileEntityDoubleEarthSolar", "emt.tile.solar.earth.TileEntityEarthSolar", + "emt.tile.solar.earth.TileEntityTripleEarthSolar", "emt.tile.solar.earth.TileEntityQuadrupleAirSolar", + "emt.tile.solar.earth.TileEntityQuintupleAirSolar", "emt.tile.solar.earth.TileEntitySextupleAirSolar", + "emt.tile.solar.earth.TileEntitySeptupleAirSolar", "emt.tile.solar.earth.TileEntityOctupleAirSolar", + "emt.tile.solar.fire.TileEntityDoubleFireSolar", "emt.tile.solar.fire.TileEntityFireSolar", + "emt.tile.solar.fire.TileEntityTripleFireSolar", "emt.tile.solar.fire.TileEntityQuadrupleAirSolar", + "emt.tile.solar.fire.TileEntityQuintupleAirSolar", "emt.tile.solar.fire.TileEntitySextupleAirSolar", + "emt.tile.solar.fire.TileEntitySeptupleAirSolar", "emt.tile.solar.fire.TileEntityOctupleAirSolar", + "emt.tile.solar.order.TileEntityDoubleOrderSolar", "emt.tile.solar.order.TileEntityOrderSolar", + "emt.tile.solar.order.TileEntityTripleOrderSolar", "emt.tile.solar.order.TileEntityQuadrupleAirSolar", + "emt.tile.solar.order.TileEntityQuintupleAirSolar", "emt.tile.solar.order.TileEntitySextupleAirSolar", + "emt.tile.solar.order.TileEntitySeptupleAirSolar", "emt.tile.solar.order.TileEntityOctupleAirSolar", + "emt.tile.solar.water.TileEntityDoubleWaterSolar", "emt.tile.solar.water.TileEntityTripleWaterSolar", + "emt.tile.solar.water.TileEntityWaterSolar", "emt.tile.solar.water.TileEntityQuadrupleAirSolar", + "emt.tile.solar.water.TileEntityQuintupleAirSolar", "emt.tile.solar.water.TileEntitySextupleAirSolar", + "emt.tile.solar.water.TileEntitySeptupleAirSolar", "emt.tile.solar.water.TileEntityOctupleAirSolar", + "com.lulan.compactkineticgenerators.tileentity.TileCkgE", + "com.lulan.compactkineticgenerators.tileentity.TileCkgH", + "com.lulan.compactkineticgenerators.tileentity.TileCkgL", + "com.lulan.compactkineticgenerators.tileentity.TileCkgM", + "com.lulan.compactkineticgenerators.tileentity.TileCkwaE", + "com.lulan.compactkineticgenerators.tileentity.TileCkwaH", + "com.lulan.compactkineticgenerators.tileentity.TileCkwaL", + "com.lulan.compactkineticgenerators.tileentity.TileCkwaM", + "com.lulan.compactkineticgenerators.tileentity.TileCkwmE", + "com.lulan.compactkineticgenerators.tileentity.TileCkwmH", + "com.lulan.compactkineticgenerators.tileentity.TileCkwmL", + "com.lulan.compactkineticgenerators.tileentity.TileCkwmM", "com.supsolpans.tiles.TileSpectralSolarPanel", + "com.supsolpans.tiles.TileSingularSolarPanel", "com.supsolpans.tiles.TileAdminSolarPanel", + "com.supsolpans.tiles.TilePhotonicSolarPanel", "gtPlusPlus.core.tileentities.general.TileEntityFishTrap", + "gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest", + "net.bdew.gendustry.machines.apiary.TileApiary", "goodgenerator.blocks.tileEntity.EssentiaHatch", + "magicbees.tileentity.TileEntityApimancersDrainerCommon", + "magicbees.tileentity.TileEntityApimancersDrainerGT" }) + @Config.RequiresMcRestart + public static String[] blacklistedTileEntiyClassNamesForWA; + + @Config.Comment("This will set the percentage how much ReinforcedGlass is Allowed in Cleanroom Walls.") + @Config.DefaultFloat(5.0f) + @Config.RequiresMcRestart + public static float cleanroomGlass; + + @Config.Comment("This will let machines such as drills and pumps chunkload their work area.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean enableChunkloaders; + + @Config.Comment("This will make all chunkloading machines act as World Anchors (true) or Passive Anchors (false).") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean alwaysReloadChunkloaders; + + @Config.Comment("If true, then digital chest with AE2 storage bus will be accessible only through AE2") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean disableDigitalChestsExternalAccess; + + @Config.Comment("If true, machines can explode.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineExplosions; + + @Config.Comment("If true, machine can take fire.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineFlammable; + + @Config.Comment("If true, explodes if the machine is dismantled without a wrench.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineNonWrenchExplosions; + + @Config.Comment("If true, burn the wires on explosion. (by sending IV amps into the cables)") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineWireFire; + + @Config.Comment("If true, machine will randomly explode if there is fire on adjacent blocks.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineFireExplosions; + + @Config.Comment("If true, will randomly explode if it is raining.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineRainExplosions; + + @Config.Comment("If true, will randomly explode during thunderstorm if the machine can be exposed to rain.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean machineThunderExplosions; + + @Config.Comment("If true, enable the guis of the machines to get a tint and it will be of the color of the dye applied to the machine.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean coloredGUI; + + @Config.Comment("If true and if the machine tint is activated, the guis will have a uniform metallic tint no matter what color is applied to the machines.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean machineMetalGUI; + + // Implementation for this is actually handled in NewHorizonsCoreMod in MainRegistry.java! + @Config.Comment("If true, use the definition of the metallic tint in GT5U, otherwise NHCore will set it to white.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean useMachineMetal; + + @Config.Comment("if true, enables MuTEs(multitile entities) to be added to the game. MuTEs are in the start of development and its not recommended to enable them unless you know what you are doing. (always activated in dev env)") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean enableMultiTileEntities; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigOreDropBehavior.java b/src/main/java/gregtech/common/config/gregtech/ConfigOreDropBehavior.java new file mode 100644 index 0000000000..dd6e1420e2 --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigOreDropBehavior.java @@ -0,0 +1,24 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "ore_drop_behavior", + configSubDirectory = "GregTech", + filename = "GregTech") +public class ConfigOreDropBehavior { + + @Config.Comment({ "Settings:", + " - 'PerDimBlock': Sets the drop to the block variant of the ore block based on dimension, defaults to stone type", + " - 'UnifiedBlock': Sets the drop to the stone variant of the ore block", + " - 'Block': Sets the drop to the ore mined", + " - 'FortuneItem': Sets the drop to the new ore item and makes it affected by fortune" + + " - 'Item': Sets the drop to the new ore item" }) + + @Config.DefaultString("FortuneItem") + @Config.RequiresMcRestart + public static String setting; +} diff --git a/src/main/java/gregtech/common/config/gregtech/ConfigPollution.java b/src/main/java/gregtech/common/config/gregtech/ConfigPollution.java new file mode 100644 index 0000000000..a78fff8f8c --- /dev/null +++ b/src/main/java/gregtech/common/config/gregtech/ConfigPollution.java @@ -0,0 +1,129 @@ +package gregtech.common.config.gregtech; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "pollution", configSubDirectory = "GregTech", filename = "GregTech") +public class ConfigPollution { + + @Config.Comment("if true, enables pollution in the game.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean pollution; + + @Config.Comment("Controls the threshold starting from which you can see fog.") + @Config.DefaultInt(550_000) + @Config.RequiresMcRestart + public static int pollutionSmogLimit; + @Config.Comment("Controls the threshold starting from which players get poison effect.") + @Config.DefaultInt(750_000) + @Config.RequiresMcRestart + public static int pollutionPoisonLimit; + @Config.Comment("Controls the threshold starting from which vegetation starts to be killed.") + @Config.DefaultInt(1_000_000) + @Config.RequiresMcRestart + public static int pollutionVegetationLimit; + @Config.Comment("Controls the threshold starting from which if it rains, will turn cobblestone into gravel and gravel into sand.") + @Config.DefaultInt(2_000_000) + @Config.RequiresMcRestart + public static int pollutionSourRainLimit; + @Config.Comment("Controls the pollution released by an explosion.") + @Config.DefaultInt(100_000) + @Config.RequiresMcRestart + public static int pollutionOnExplosion; + @Config.Comment("Controls the pollution released per second by the bricked blast furnace.") + @Config.DefaultInt(200) + @Config.RequiresMcRestart + public static int pollutionPrimitveBlastFurnacePerSecond; + @Config.Comment("Controls the pollution released per second by the charcoal pile igniter.") + @Config.DefaultInt(100) + @Config.RequiresMcRestart + public static int pollutionCharcoalPitPerSecond; + @Config.Comment("Controls the pollution released per second by the EBF.") + @Config.DefaultInt(400) + @Config.RequiresMcRestart + public static int pollutionEBFPerSecond; + @Config.Comment("Controls the pollution released per second by the large combustion engine.") + @Config.DefaultInt(480) + @Config.RequiresMcRestart + public static int pollutionLargeCombustionEnginePerSecond; + @Config.Comment("Controls the pollution released per second by the extreme combustion engine.") + @Config.DefaultInt(3_840) + @Config.RequiresMcRestart + public static int pollutionExtremeCombustionEnginePerSecond; + @Config.Comment("Controls the pollution released per second by the implosion compressor.") + @Config.DefaultInt(10_000) + @Config.RequiresMcRestart + public static int pollutionImplosionCompressorPerSecond; + @Config.Comment("Controls the pollution released per second by the large bronze boiler.") + @Config.DefaultInt(1_000) + @Config.RequiresMcRestart + public static int pollutionLargeBronzeBoilerPerSecond; + @Config.Comment("Controls the pollution released per second by the large steel boiler.") + @Config.DefaultInt(2_000) + @Config.RequiresMcRestart + public static int pollutionLargeSteelBoilerPerSecond; + @Config.Comment("Controls the pollution released per second by the large titanium boiler.") + @Config.DefaultInt(3_000) + @Config.RequiresMcRestart + public static int pollutionLargeTitaniumBoilerPerSecond; + @Config.Comment("Controls the pollution released per second by the large tungstensteel boiler.") + @Config.DefaultInt(4_000) + @Config.RequiresMcRestart + public static int pollutionLargeTungstenSteelBoilerPerSecond; + @Config.Comment("Controls the pollution reduction obtained with each increment of the circuit when throttling large boilers.") + @Config.DefaultFloat(1.0f / 24.0f) // divided by 24 because there are 24 circuit configs. + @Config.RequiresMcRestart + public static float pollutionReleasedByThrottle; + @Config.Comment("Controls the pollution released per second by the large gas turbine.") + @Config.DefaultInt(300) + @Config.RequiresMcRestart + public static int pollutionLargeGasTurbinePerSecond; + @Config.Comment("Controls the pollution released per second by the multi smelter.") + @Config.DefaultInt(400) + @Config.RequiresMcRestart + public static int pollutionMultiSmelterPerSecond; + @Config.Comment("Controls the pollution released per second by the pyrolyse oven.") + @Config.DefaultInt(300) + @Config.RequiresMcRestart + public static int pollutionPyrolyseOvenPerSecond; + @Config.Comment("Controls the pollution released per second by the small coil boiler.") + @Config.DefaultInt(20) + @Config.RequiresMcRestart + public static int pollutionSmallCoalBoilerPerSecond; + @Config.Comment("Controls the pollution released per second by the high pressure lava boiler.") + @Config.DefaultInt(20) + @Config.RequiresMcRestart + public static int pollutionHighPressureLavaBoilerPerSecond; + @Config.Comment("Controls the pollution released per second by the high pressure coil boiler.") + @Config.DefaultInt(30) + @Config.RequiresMcRestart + public static int pollutionHighPressureCoalBoilerPerSecond; + + @Config.Comment("Controls the pollution released per second by the base diesel generator.") + @Config.DefaultInt(40) + @Config.RequiresMcRestart + public static int pollutionBaseDieselGeneratorPerSecond; + + // reading double as strings, not perfect, but better than nothing + @Config.Comment({ + "Pollution released by tier, with the following formula: PollutionBaseDieselGeneratorPerSecond * PollutionDieselGeneratorReleasedByTier[Tier]", + "The first entry has meaning as it is here to since machine tier with array index: LV is 1, etc." }) + @Config.DefaultDoubleList({ 0.1, 1.0, 0.9, 0.8 }) + @Config.RequiresMcRestart + public static double[] pollutionDieselGeneratorReleasedByTier; + + @Config.Comment("Controls the pollution released per second by the base gas turbine.") + @Config.DefaultInt(40) + @Config.RequiresMcRestart + public static int pollutionBaseGasTurbinePerSecond; + + // reading double as strings, not perfect, but better than nothing + @Config.Comment({ + "Pollution released by tier, with the following formula: PollutionBaseGasTurbinePerSecond * PollutionGasTurbineReleasedByTier[Tier]", + "The first entry has meaning as it is here to since machine tier with array index: LV is 1, etc." }) + @Config.DefaultDoubleList({ 0.1, 1.0, 0.9, 0.8, 0.7, 0.6 }) + @Config.RequiresMcRestart + public static double[] pollutionGasTurbineReleasedByTier; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigBronzeSolarBoiler.java b/src/main/java/gregtech/common/config/machinestats/ConfigBronzeSolarBoiler.java new file mode 100644 index 0000000000..59042b7e41 --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigBronzeSolarBoiler.java @@ -0,0 +1,32 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "bronze_solar_boiler", + configSubDirectory = "GregTech", + filename = "MachineStats") +public class ConfigBronzeSolarBoiler { + + @Config.Comment({ "Number of run-time ticks before boiler starts calcification.", + "100% calcification and minimal output will be reached at 2 times this." }) + @Config.DefaultInt(1_080_000) + @Config.RequiresMcRestart + public static int calcificationTicks; + + @Config.Comment("Number of ticks it takes to lose 1°C.") + @Config.DefaultInt(45) + @Config.RequiresMcRestart + public static int cooldownTicks; + + @Config.DefaultInt(120) + @Config.RequiresMcRestart + public static int maxOutputPerSecond; + + @Config.DefaultInt(40) + @Config.RequiresMcRestart + public static int minOutputPerSecond; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigMachines.java b/src/main/java/gregtech/common/config/machinestats/ConfigMachines.java new file mode 100644 index 0000000000..ed93f31629 --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigMachines.java @@ -0,0 +1,34 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "machines", configSubDirectory = "GregTech", filename = "MachineStats") +public class ConfigMachines { + + @Config.Comment("Controls the damageFactorLow variable in the maintenance damage equation.") + @Config.DefaultInt(5) + @Config.RequiresMcRestart + public static int damageFactorLow; + + @Config.Comment("Controls the damageFactorHigh variable in the maintenance damage equation.") + @Config.DefaultFloat(0.6f) + @Config.RequiresMcRestart + public static float damageFactorHigh; + + @Config.Comment("if true, disable maintenance checks.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean disableMaintenanceChecks; + + @Config.Comment("If true, allows for multiple eggs on the magical energy absorber.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean allowMultipleEggs; + + @Config.Comment("If true, requires at least a free face to open a machine gui.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean forceFreeFace; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigMassFabricator.java b/src/main/java/gregtech/common/config/machinestats/ConfigMassFabricator.java new file mode 100644 index 0000000000..13cf89470b --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigMassFabricator.java @@ -0,0 +1,33 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "mass_fabricator", + configSubDirectory = "GregTech", + filename = "MachineStats") +public class ConfigMassFabricator { + + @Config.Comment("if true, requires UUA to run the mass fab.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean requiresUUA; + + @Config.Comment("Duration multiplier.") + @Config.DefaultInt(3215) + @Config.RequiresMcRestart + public static int durationMultiplier; + + @Config.Comment("mb of UUA per UUM.") + @Config.DefaultInt(1) + @Config.RequiresMcRestart + public static int UUAPerUUM; + + @Config.Comment("Speed bonus delivered by the UUA.") + @Config.DefaultInt(40) + @Config.RequiresMcRestart + public static int UUASpeedBonus; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigMicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/config/machinestats/ConfigMicrowaveEnergyTransmitter.java new file mode 100644 index 0000000000..6efec5ca12 --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigMicrowaveEnergyTransmitter.java @@ -0,0 +1,28 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "microwave_energy_transmitter", + configSubDirectory = "GregTech", + filename = "MachineStats") +public class ConfigMicrowaveEnergyTransmitter { + + @Config.Comment("if true, it has a passive energy loss.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean passiveEnergyUse; + + @Config.Comment("max loss.") + @Config.DefaultInt(50) + @Config.RequiresMcRestart + public static int maxLoss; + + @Config.Comment("max loss distance.") + @Config.DefaultInt(10_000) + @Config.RequiresMcRestart + public static int maxLossDistance; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigSteelSolarBoiler.java b/src/main/java/gregtech/common/config/machinestats/ConfigSteelSolarBoiler.java new file mode 100644 index 0000000000..c6f6ea9f2a --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigSteelSolarBoiler.java @@ -0,0 +1,32 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "steel_solar_boiler", + configSubDirectory = "GregTech", + filename = "MachineStats") +public class ConfigSteelSolarBoiler { + + @Config.Comment({ "Number of run-time ticks before boiler starts calcification.", + "100% calcification and minimal output will be reached at 2 times this." }) + @Config.DefaultInt(1_080_000) + @Config.RequiresMcRestart + public static int calcificationTicks; + + @Config.Comment("Number of ticks it takes to lose 1°C.") + @Config.DefaultInt(75) + @Config.RequiresMcRestart + public static int cooldownTicks; + + @Config.DefaultInt(360) + @Config.RequiresMcRestart + public static int maxOutputPerSecond; + + @Config.DefaultInt(120) + @Config.RequiresMcRestart + public static int minOutputPerSecond; +} diff --git a/src/main/java/gregtech/common/config/machinestats/ConfigTeleporter.java b/src/main/java/gregtech/common/config/machinestats/ConfigTeleporter.java new file mode 100644 index 0000000000..26f1f8fb4d --- /dev/null +++ b/src/main/java/gregtech/common/config/machinestats/ConfigTeleporter.java @@ -0,0 +1,28 @@ +package gregtech.common.config.machinestats; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "teleporter", + configSubDirectory = "GregTech", + filename = "MachineStats") +public class ConfigTeleporter { + + @Config.Comment("if true, allows interdim tp") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean interDimensionalTPAllowed; + + @Config.Comment("passive energy loss.") + @Config.DefaultInt(2048) + @Config.RequiresMcRestart + public static int passiveEnergyDrain; + + @Config.Comment("power multiplier.") + @Config.DefaultInt(100) + @Config.RequiresMcRestart + public static int powerMultiplier; +} diff --git a/src/main/java/gregtech/common/config/opstuff/ConfigGeneral.java b/src/main/java/gregtech/common/config/opstuff/ConfigGeneral.java new file mode 100644 index 0000000000..63cd2bc231 --- /dev/null +++ b/src/main/java/gregtech/common/config/opstuff/ConfigGeneral.java @@ -0,0 +1,48 @@ +package gregtech.common.config.opstuff; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "general", + configSubDirectory = "GregTech", + filename = "OverpoweredStuff") +public class ConfigGeneral { + + @Config.Comment("How much RF you get with 100 EU in input.") + @Config.DefaultInt(360) + @Config.RequiresMcRestart + public static int howMuchRFWith100EUInInput; + + @Config.Comment("How much EU you get with 100 RF in input.") + @Config.DefaultInt(100) + @Config.RequiresMcRestart + public static int howMuchEUWith100RFInInput; + + @Config.Comment("if true, enables RF -> EU conversion.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean inputRF; + + @Config.Comment("if true, enables EU -> RF conversion.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean outputRF; + + @Config.Comment("If true, machines will explode if RFs injected to a GT machine are above 600 * the max energy they can store.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean RFExplosions; + + @Config.Comment("if true, ignores TinkerConstruct in ore registration.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean ignoreTinkerConstruct; + + @Config.Comment("Controls the exposant used in the computation of the UUM required to replicate an element (uum = mass^replicatorExponent)") + @Config.DefaultFloat(1.2f) + @Config.RequiresMcRestart + public static float replicatorExponent; +} diff --git a/src/main/java/gregtech/common/config/other/ConfigGeneral.java b/src/main/java/gregtech/common/config/other/ConfigGeneral.java new file mode 100644 index 0000000000..495ef190c4 --- /dev/null +++ b/src/main/java/gregtech/common/config/other/ConfigGeneral.java @@ -0,0 +1,24 @@ +package gregtech.common.config.other; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config(modid = Mods.Names.GREG_TECH, category = "general", configSubDirectory = "GregTech", filename = "Other") +public class ConfigGeneral { + + @Config.Comment("How much pipes you can chain wrench to disable their input.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int pipeWrenchingChainRange; + + @Config.Comment("How much blocks you can chain paint with GT spray cans.") + @Config.DefaultInt(64) + @Config.RequiresMcRestart + public static int sprayCanChainRange; + + @Config.Comment("How much blocks you can paint with GT spray cans.") + @Config.DefaultInt(512) + @Config.RequiresMcRestart + public static int sprayCanUses; +} diff --git a/src/main/java/gregtech/common/config/worldgen/ConfigEndAsteroids.java b/src/main/java/gregtech/common/config/worldgen/ConfigEndAsteroids.java new file mode 100644 index 0000000000..c1ec0125b5 --- /dev/null +++ b/src/main/java/gregtech/common/config/worldgen/ConfigEndAsteroids.java @@ -0,0 +1,33 @@ +package gregtech.common.config.worldgen; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "end_asteroids", + configSubDirectory = "GregTech", + filename = "WorldGeneration") +public class ConfigEndAsteroids { + + @Config.Comment("The maximum size for the end asteroids.") + @Config.DefaultInt(200) + @Config.RequiresMcRestart + public static int EndAsteroidMaxSize; + + @Config.Comment("The minimum size for the end asteroids.") + @Config.DefaultInt(200) + @Config.RequiresMcRestart + public static int EndAsteroidMinSize; + + @Config.Comment("The probability weight to generate end asteroids.") + @Config.DefaultInt(300) + @Config.RequiresMcRestart + public static int EndAsteroidProbability; + + @Config.Comment("if true, enables end asteroids.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateEndAsteroids; +} diff --git a/src/main/java/gregtech/common/config/worldgen/ConfigGeneral.java b/src/main/java/gregtech/common/config/worldgen/ConfigGeneral.java new file mode 100644 index 0000000000..c978f35365 --- /dev/null +++ b/src/main/java/gregtech/common/config/worldgen/ConfigGeneral.java @@ -0,0 +1,48 @@ +package gregtech.common.config.worldgen; + +import com.gtnewhorizon.gtnhlib.config.Config; + +import gregtech.api.enums.Mods; + +@Config( + modid = Mods.Names.GREG_TECH, + category = "general", + configSubDirectory = "GregTech", + filename = "WorldGeneration") +public class ConfigGeneral { + + @Config.Comment("if true, enables basalt ore gen.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateBasaltOres; + + @Config.Comment("if true, enables black granite ore gen.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateBlackGraniteOres; + + @Config.Comment("if true, enables marble ore gen.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateMarbleOres; + + @Config.Comment("if true, enables red granite ore gen.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateRedGraniteOres; + + @Config.Comment("If true, disables vanilla oregen.") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean disableVanillaOres; + + @Config.Comment("if true, enables underground dirt gen. Does nothing if the vanilla oregen is enabled!") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateUndergroundDirtGen; + + @Config.Comment("if true, enables underground gravel gen. Does nothing if the vanilla oregen is enabled!") + @Config.DefaultBoolean(true) + @Config.RequiresMcRestart + public static boolean generateUndergroundGravelGen; +} diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index 88a7e1f69e..17d0c13f03 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -67,7 +67,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -91,6 +90,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.common.config.other.ConfigGeneral; import gregtech.common.covers.GT_Cover_Arm; import gregtech.common.covers.GT_Cover_Chest; import gregtech.common.covers.GT_Cover_ControlsWork; @@ -4068,7 +4068,7 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Spray_Empty.get(1L), ItemList.SPRAY_CAN_DYES_USED[i].get(1L), ItemList.SPRAY_CAN_DYES[i].get(1L), - GregTech_API.sSpecialFile.get(ConfigCategories.general, "SprayCanUses", 512), + ConfigGeneral.sprayCanUses, i); addItemBehavior(32000 + Spray_Colors[i], behaviourSprayColor); addItemBehavior(32000 + Spray_Colors_Used[i], behaviourSprayColor); diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java index 33cf67cfd5..f8777dcf58 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java @@ -59,7 +59,6 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TC_Aspects; @@ -618,10 +617,6 @@ public class GT_MetaGenerated_Tool_01 extends GT_MetaGenerated_Tool { } private void initCraftingShapelessRecipes() { - if (GregTech_API.sSpecialFile.get(ConfigCategories.general, "DisableFlintTools", false)) { - return; - } - GT_ModHandler.addShapelessCraftingRecipe( GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, @@ -718,37 +713,34 @@ public class GT_MetaGenerated_Tool_01 extends GT_MetaGenerated_Tool { new Object[] { " S", " I ", "S f", 'I', OrePrefixes.ingot.get(Materials.IronWood), 'S', OrePrefixes.stick.get(Materials.IronWood) }); - if (!GregTech_API.sSpecialFile.get(ConfigCategories.general, "DisableFlintTools", false)) { - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(SWORD.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "F", "F", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(PICKAXE.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "FFF", " S ", " S ", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(SHOVEL.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "F", "S", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(AXE.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.MIRRORED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "FF", "FS", " S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(HOE.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.MIRRORED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "FF", " S", " S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - GT_ModHandler.addCraftingRecipe( - INSTANCE.getToolWithStats(KNIFE.ID, 1, Materials.Flint, Materials.Wood, null), - GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[] { "F", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', - new ItemStack(Items.flint, 1) }); - } + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(SWORD.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "F", "F", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', + new ItemStack(Items.flint, 1) }); + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(PICKAXE.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "FFF", " S ", " S ", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', + new ItemStack(Items.flint, 1) }); + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(SHOVEL.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "F", "S", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', + new ItemStack(Items.flint, 1) }); + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(AXE.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.MIRRORED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "FF", "FS", " S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', + new ItemStack(Items.flint, 1) }); + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(HOE.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.MIRRORED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "FF", " S", " S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', + new ItemStack(Items.flint, 1) }); + GT_ModHandler.addCraftingRecipe( + INSTANCE.getToolWithStats(KNIFE.ID, 1, Materials.Flint, Materials.Wood, null), + GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[] { "F", "S", 'S', OrePrefixes.stick.get(Materials.Wood), 'F', new ItemStack(Items.flint, 1) }); } } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java index cbc698d474..216eb4d745 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Spray_Color.java @@ -19,14 +19,13 @@ import net.minecraftforge.common.util.ForgeDirection; import appeng.api.implementations.tiles.IColorableTile; import appeng.api.util.AEColor; import appeng.block.networking.BlockCableBus; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.common.config.other.ConfigGeneral; public class Behaviour_Spray_Color extends Behaviour_None { @@ -96,7 +95,7 @@ public class Behaviour_Spray_Color extends Behaviour_None { tUses = this.mUses; } int painted = 0; - int maxPainted = GregTech_API.sSpecialFile.get(ConfigCategories.general, "SprayCanChainRange", 256); + int maxPainted = ConfigGeneral.sprayCanChainRange; ForgeDirection lookSide; Vec3 look = aPlayer.getLookVec(); double absX = Math.abs(look.xCoord); @@ -208,10 +207,7 @@ public class Behaviour_Spray_Color extends Behaviour_None { public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { aList.add(this.mTooltip); aList.add(this.mTooltipChain); - aList.add( - String.format( - this.mTooltipChainAmount, - GregTech_API.sSpecialFile.get(ConfigCategories.general, "SprayCanChainRange", 256))); + aList.add(String.format(this.mTooltipChainAmount, ConfigGeneral.sprayCanChainRange)); NBTTagCompound tNBT = aStack.getTagCompound(); long tRemainingPaint = tNBT == null ? this.mUses : GT_Utility.areStacksEqual(aStack, this.mFull, true) ? this.mUses : tNBT.getLong("GT.RemainingPaint"); diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index 4c7eb3ce38..b10b44228d 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -1,7 +1,5 @@ package gregtech.common.tileentities.boilers; -import static gregtech.api.GregTech_API.sMachineFile; -import static gregtech.api.enums.ConfigCategories.machineconfig; import static mcp.mobius.waila.api.SpecialChars.GOLD; import static mcp.mobius.waila.api.SpecialChars.RESET; @@ -28,6 +26,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import gregtech.common.config.machinestats.ConfigBronzeSolarBoiler; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; @@ -39,37 +38,28 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { "Steam Power by the Sun%n" + "Produces %sL of Steam per second%n" + "Calcifies over time, reducing Steam output to %sL/s%n" + "Break and replace to descale"); - protected final Config mConfig; + protected int calcificationTicks = ConfigBronzeSolarBoiler.calcificationTicks; + protected int cooldownTicks = ConfigBronzeSolarBoiler.cooldownTicks; + protected int maxOutputPerSecond = ConfigBronzeSolarBoiler.maxOutputPerSecond; + protected int minOutputPerSecond = ConfigBronzeSolarBoiler.minOutputPerSecond; + protected final int basicTemperatureMod = 5; // Base Celsius gain or loss private int mRunTimeTicks = 0; public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[0]); - mConfig = createConfig(); } public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - mConfig = createConfig(); } public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - mConfig = createConfig(); - } - - protected GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - Config aConfig) { - super(aName, aTier, aDescription, aTextures); - mConfig = aConfig; - } - - protected Config createConfig() { - return new Config(machineconfig + ".boiler.solar.bronze", 1080000, 40, 120, 45); } public int getMaxOutputPerSecond() { - return mConfig.getMaxOutputPerSecond(); + return maxOutputPerSecond; } @Override @@ -83,7 +73,7 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { } public int getMinOutputPerSecond() { - return mConfig.getMinOutputPerSecond(); + return minOutputPerSecond; } @Override @@ -159,21 +149,34 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { if (mTemperature < 100) { return 0; } - if (mRunTimeTicks > mConfig.getMaxRuntimeTicks()) { - return mConfig.getMinOutputPerSecond(); - } else if (mRunTimeTicks > mConfig.getCalcificationTicks()) { + if (mRunTimeTicks > getMaxRuntimeTicks()) { + return getMinOutputPerSecond(); + } else if (mRunTimeTicks > getCalcificationTicks()) { /* * When reaching calcification ticks; discount the proportion of run-time spent on calcification from the * maximum output per second, and return this or the minimum output per second */ - return mConfig.getMaxOutputPerSecond() - - mConfig.getMaxOutputPerSecond() * (mRunTimeTicks - mConfig.getCalcificationTicks()) - / mConfig.getCalcificationTicks(); + return getMaxOutputPerSecond() + - getMaxOutputPerSecond() * (mRunTimeTicks - getCalcificationTicks()) / getCalcificationTicks(); } else { - return mConfig.getMaxOutputPerSecond(); + return getMaxOutputPerSecond(); } } + protected int getCalcificationTicks() { + return calcificationTicks; + } + + protected int getCooldownTicks() { + return cooldownTicks; + } + + protected int getMaxRuntimeTicks() { + // After which min output is reached. + return (getMaxOutputPerSecond() - getMinOutputPerSecond()) * getCalcificationTicks() / getMaxOutputPerSecond() + + getCalcificationTicks(); + } + @Override protected int getMaxTemperature() { return 500; @@ -186,7 +189,7 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { @Override protected int getCooldownInterval() { - return mConfig.getCoolDownTicks() / basicTemperatureMod; + return getCooldownTicks() / basicTemperatureMod; } @Override @@ -272,7 +275,7 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Solar(mName, mTier, mDescriptionArray, mTextures, mConfig); + return new GT_MetaTileEntity_Boiler_Solar(mName, mTier, mDescriptionArray, mTextures); } @Override @@ -305,64 +308,4 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { tag.setInteger("calcificationOutput", (getProductionPerSecond())); tag.setInteger("maxCalcificationOutput", (getMaxOutputPerSecond())); } - - protected static class Config { - - private final int calcificationTicks; - private final int minOutputPerSecond; - private final int maxOutputPerSecond; - private final int coolDownTicks; - private final int maxRuntimeTicks; - - public Config(String aCategory, int aDefaultCalcificationTicks, int aDefaultMinOutputPerSecond, - int aDefaultMaxOutputPerSecond, int aDefaultCoolDownTicks) { - calcificationTicks = get( - aCategory, - "CalcificationTicks", - aDefaultCalcificationTicks, - "Number of run-time ticks before boiler starts calcification.", - "100% calcification and minimal output will be reached at 2 times this."); - minOutputPerSecond = get(aCategory, "MinOutputPerSecond", aDefaultMinOutputPerSecond); - maxOutputPerSecond = get(aCategory, "MaxOutputPerSecond", aDefaultMaxOutputPerSecond); - coolDownTicks = get( - aCategory, - "CoolDownTicks", - aDefaultCoolDownTicks, - "Number of ticks it takes to lose 1°C."); - // After which min output is reached. - maxRuntimeTicks = (getMaxOutputPerSecond() - getMinOutputPerSecond()) * getCalcificationTicks() - / getMaxOutputPerSecond() + getCalcificationTicks(); - } - - protected int get(final String aCategory, final String aKey, final int aDefaultValue, - final String... aComments) { - final StringBuilder tCommentBuilder = new StringBuilder(); - for (String tComment : aComments) tCommentBuilder.append(tComment) - .append('\n'); - tCommentBuilder.append("Default: ") - .append(aDefaultValue); - return sMachineFile.mConfig.get(aCategory, aKey, aDefaultValue, tCommentBuilder.toString()) - .getInt(); - } - - public int getCalcificationTicks() { - return calcificationTicks; - } - - public int getMinOutputPerSecond() { - return minOutputPerSecond; - } - - public int getMaxOutputPerSecond() { - return maxOutputPerSecond; - } - - public int getCoolDownTicks() { - return coolDownTicks; - } - - public int getMaxRuntimeTicks() { - return maxRuntimeTicks; - } - } } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java index c20ea4018a..c537e388d1 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java @@ -1,7 +1,5 @@ package gregtech.common.tileentities.boilers; -import static gregtech.api.enums.ConfigCategories.machineconfig; - import gregtech.api.enums.Dyes; import gregtech.api.enums.SteamVariant; import gregtech.api.enums.Textures.BlockIcons; @@ -9,31 +7,32 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; +import gregtech.common.config.machinestats.ConfigSteelSolarBoiler; public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boiler_Solar { public GT_MetaTileEntity_Boiler_Solar_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + initBoilerStats(); } public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); + initBoilerStats(); } public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); + initBoilerStats(); } - public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures, Config aConfig) { - super(aName, aTier, aDescription, aTextures, aConfig); - } - - @Override - protected Config createConfig() { - return new Config(machineconfig + ".boiler.solar.steel", 1080000, 120, 360, 75); + protected void initBoilerStats() { + calcificationTicks = ConfigSteelSolarBoiler.calcificationTicks; + cooldownTicks = ConfigSteelSolarBoiler.cooldownTicks; + maxOutputPerSecond = ConfigSteelSolarBoiler.maxOutputPerSecond; + minOutputPerSecond = ConfigSteelSolarBoiler.minOutputPerSecond; } @Override @@ -67,11 +66,6 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Solar_Steel( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures, - this.mConfig); + return new GT_MetaTileEntity_Boiler_Solar_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java index 5047cb7624..10138bdfc2 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java @@ -31,8 +31,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.ParticleFX; import gregtech.api.interfaces.ITexture; @@ -95,10 +93,7 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "DieselGenerator.efficiency.tier." + this.mTier, - (100 - this.mTier * 5)); + this.mEfficiency = (100 - this.mTier * 5); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java index e18bc00b51..ca0a5d6958 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java @@ -25,8 +25,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; import net.minecraftforge.common.util.ForgeDirection; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -51,14 +49,12 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[aTier]) + " Pollution per second" }); this.mEfficiency = mEfficiency; - onConfigLoad(); } public GT_MetaTileEntity_GasTurbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int mEfficiency) { super(aName, aTier, aDescription, aTextures); this.mEfficiency = mEfficiency; - onConfigLoad(); } @Override @@ -86,11 +82,6 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat return 16000; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "GasTurbine.efficiency.tier." + this.mTier, this.mEfficiency); - } - @Override public int getEfficiency() { return this.mEfficiency; diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java index 7317180b5d..647aa504e5 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java @@ -12,8 +12,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; import net.minecraftforge.common.util.ForgeDirection; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -68,10 +66,7 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "MagicEnergyConverter.efficiency.tier." + this.mTier, - 100 - this.mTier * 5); + this.mEfficiency = 100 - this.mTier * 5; } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 8dc3417a84..3245607ac2 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -1,6 +1,5 @@ package gregtech.common.tileentities.generators; -import static gregtech.api.enums.ConfigCategories.machineconfig; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.Mods.Thaumcraft; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_DRAGONEGG; @@ -52,7 +51,6 @@ import com.google.common.base.Enums; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; import gregtech.api.enums.ParticleFX; import gregtech.api.enums.TC_Aspects; import gregtech.api.interfaces.ITexture; @@ -62,11 +60,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenera import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; +import gregtech.common.config.machinestats.ConfigMachines; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.AspectSourceHelper; @@ -81,10 +79,9 @@ interface MagicalEnergyBBListener { public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_BasicGenerator implements MagicalEnergyBBListener { - private static final boolean THAUMCRAFT_LOADED = Thaumcraft.isModLoaded(); private static final ConcurrentHashMap<UUID, GT_MetaTileEntity_MagicalEnergyAbsorber> sSubscribedCrystals = new ConcurrentHashMap<>( 4); - private static final List<Aspect> sPrimalAspects = (THAUMCRAFT_LOADED) ? Aspect.getPrimalAspects() + private static final List<Aspect> sPrimalAspects = (Thaumcraft.isModLoaded()) ? Aspect.getPrimalAspects() : new ArrayList<>(); private static final Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); private static boolean sAllowMultipleEggs = false; @@ -103,28 +100,21 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B public GT_MetaTileEntity_MagicalEnergyAbsorber(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Feasts on magic close to it:"); - onConfigLoad(GregTech_API.sMachineFile); + onConfigLoad(); } private GT_MetaTileEntity_MagicalEnergyAbsorber(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(GregTech_API.sMachineFile); + onConfigLoad(); } /** * Populates static variables dependant on config settings - * - * @param aConfig GT_Config */ - private static void sharedConfigLoad(GT_Config aConfig) { - sAllowMultipleEggs = aConfig.get(machineconfig, "MagicEnergyAbsorber.AllowMultipleEggs", false); - sDragonEggEnergyPerTick = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.DragonEgg", 2048); - sCreeperEggEnergyPerTick = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.CreeperEgg", 512); - sEnergyPerEndercrystal = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.EnderCrystal", 512); - if (THAUMCRAFT_LOADED) { - sEnergyFromVis = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerVis", 20); - sEnergyPerEssentia = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerEssentia", 320); + private static void sharedConfigLoad() { + sAllowMultipleEggs = ConfigMachines.allowMultipleEggs; + if (Thaumcraft.isModLoaded()) { for (Aspect tAspect : Aspect.aspects.values()) { // noinspection UnstableApiUsage sAspectsEnergy.put( @@ -142,13 +132,11 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B sActiveSiphon = aSiphon; } - @Override - public void onConfigLoad(GT_Config aConfig) { - sharedConfigLoad(aConfig); - mEfficiency = aConfig.get(machineconfig, "MagicEnergyAbsorber.efficiency.tier." + mTier, 100 - mTier * 10); - mMaxVisPerDrain = (int) Math.round( - Math.sqrt((double) (V[mTier] * 10000) / (sEnergyFromVis * (getEfficiency() != 0 ? getEfficiency() : 100)))); - if (Math.pow(mMaxVisPerDrain, 2) * sEnergyFromVis * (getEfficiency() != 0 ? getEfficiency() : 100) < V[mTier]) { + public void onConfigLoad() { + sharedConfigLoad(); + mEfficiency = 100 - mTier * 10; + mMaxVisPerDrain = (int) Math.round(Math.sqrt((double) (V[mTier] * 10000) / (sEnergyFromVis * getEfficiency()))); + if (Math.pow(mMaxVisPerDrain, 2) * sEnergyFromVis * getEfficiency() < V[mTier]) { mMaxVisPerDrain += 1; } } @@ -229,7 +217,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B if (sEnergyPerEndercrystal > 0) { description.add(LI + sEnergyPerEndercrystal + EU_PER + LIGHT_PURPLE + "Ender Crystal" + GRAY + " in range"); } - if (THAUMCRAFT_LOADED) { + if (Thaumcraft.isModLoaded()) { description.add(LI + mMaxVisPerDrain + "%%%CV/t from an " + LIGHT_PURPLE + "Energised Node" + GRAY); description.add( LI + (sEnergyPerEssentia * getEfficiency()) / 100 @@ -561,7 +549,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } private long absorbFromVisNet() { - if (!THAUMCRAFT_LOADED) return 0; + if (!Thaumcraft.isModLoaded()) return 0; long tEU; IGregTechTileEntity tBaseMetaTileEntity = getBaseMetaTileEntity(); @@ -584,7 +572,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } private long absorbFromEssentiaContainers() { - if (!THAUMCRAFT_LOADED) return 0; + if (!Thaumcraft.isModLoaded()) return 0; long tEU = 0; @@ -666,7 +654,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B mMaxTier = Math.max(Math.max(aMaxTier, 0), Math.max(aDefaultTier, 0)); mDefaultTier = Math.min(aDefaultTier, mMaxTier); mTier = mDefaultTier; - if (THAUMCRAFT_LOADED) mAvailableAspects = new ArrayList<>(Aspect.aspects.size()); + if (Thaumcraft.isModLoaded()) mAvailableAspects = new ArrayList<>(Aspect.aspects.size()); } int getTier() { @@ -734,7 +722,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } private void scanAvailableAspects() { - if (!THAUMCRAFT_LOADED) return; + if (!Thaumcraft.isModLoaded()) return; IGregTechTileEntity tBaseMetaTileEntity = mAbsorber.getBaseMetaTileEntity(); if (tBaseMetaTileEntity.isInvalidTileEntity()) return; int tRange = getRange(); diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java index ba5aaf4c64..1dd378e746 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java @@ -23,8 +23,6 @@ import static gregtech.api.enums.Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ import net.minecraftforge.common.util.ForgeDirection; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -43,7 +41,7 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe if (aTier > 8 || aTier < 4) { new Exception("Tier without Recipe Map!").printStackTrace(); } - onConfigLoad(); + mEfficiency = getBaseEff(); } public GT_MetaTileEntity_NaquadahReactor(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -51,7 +49,7 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe if (aTier > 8 || aTier < 4) { new Exception("Tier without Recipe Map!").printStackTrace(); } - onConfigLoad(); + mEfficiency = getBaseEff(); } @Override @@ -89,18 +87,13 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe @Override public int getEfficiency() { - return mEfficiency == 0 ? onConfigLoad() : mEfficiency; + return mEfficiency; } private int getBaseEff() { return mTier == 4 ? 80 : 100 + (50 * (mTier - 5)); } - public int onConfigLoad() { - return mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "SolidNaquadah.efficiency.tier." + mTier, getBaseEff()); - } - @Override public ITexture[] getFront(byte aColor) { return new ITexture[] { super.getFront(aColor)[0], diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java index 603c1439ba..fa980ce480 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java @@ -7,8 +7,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; import net.minecraftforge.common.util.ForgeDirection; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -23,17 +21,17 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe public GT_MetaTileEntity_PlasmaGenerator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Plasma into energy"); - onConfigLoad(); + setEfficiency(); } public GT_MetaTileEntity_PlasmaGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + setEfficiency(); } public GT_MetaTileEntity_PlasmaGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + setEfficiency(); } @Override @@ -133,11 +131,8 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe return new GT_MetaTileEntity_PlasmaGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "PlasmaGenerator.efficiency.tier." + this.mTier, - Math.max(10, 10 + Math.min(90, this.mTier * 10))); + public void setEfficiency() { + this.mEfficiency = Math.max(10, 10 + Math.min(90, this.mTier * 10)); } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java index 3c9a89815a..9c1b8db562 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java @@ -25,8 +25,6 @@ import static gregtech.api.enums.Textures.BlockIcons.STEAM_TURBINE_TOP_GLOW; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -46,17 +44,17 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener aNameRegional, aTier, new String[] { "Converts Steam into EU", "Base rate: 2L of Steam -> 1 EU" }); - onConfigLoad(); + this.mEfficiency = 6 + this.mTier; } public GT_MetaTileEntity_SteamTurbine(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + this.mEfficiency = 6 + this.mTier; } public GT_MetaTileEntity_SteamTurbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + this.mEfficiency = 6 + this.mTier; } @Override @@ -90,11 +88,6 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener return 24000 * this.mTier; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + this.mTier); - } - @Override public int getEfficiency() { return this.mEfficiency; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java index ef0914f6a4..7eaa8122c1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java @@ -26,7 +26,6 @@ import net.minecraftforge.fluids.FluidStack; import com.google.common.primitives.Ints; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.MachineType; import gregtech.api.enums.Materials; @@ -39,11 +38,11 @@ import gregtech.api.objects.overclockdescriber.OverclockDescriber; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.common.config.machinestats.ConfigMassFabricator; public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMachine { @@ -135,13 +134,12 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac } @Override - public void onConfigLoad(GT_Config aConfig) { - super.onConfigLoad(aConfig); - sDurationMultiplier = aConfig - .get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); - sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); - sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus); - sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA); + public void onConfigLoad() { + super.onConfigLoad(); + sDurationMultiplier = ConfigMassFabricator.durationMultiplier; + sUUAperUUM = ConfigMassFabricator.UUAPerUUM; + sUUASpeedBonus = ConfigMassFabricator.UUASpeedBonus; + sRequiresUUA = ConfigMassFabricator.requiresUUA; Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index aa8616e03d..575e98c5c6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -28,7 +28,6 @@ import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; @@ -42,8 +41,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; +import gregtech.common.config.machinestats.ConfigMicrowaveEnergyTransmitter; +import gregtech.common.config.machinestats.ConfigTeleporter; public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo, IAddUIWidgets { @@ -154,12 +154,11 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } @Override - public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); - mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss", 50), 11); - mMaxLossDistance = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLossDistance", 10000); - mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy", true); + public void onConfigLoad() { + sInterDimensionalTeleportAllowed = ConfigTeleporter.interDimensionalTPAllowed; + mMaxLoss = Math.max(ConfigMicrowaveEnergyTransmitter.maxLoss, 11); + mMaxLossDistance = ConfigMicrowaveEnergyTransmitter.maxLossDistance; + mPassiveEnergyUse = ConfigMicrowaveEnergyTransmitter.passiveEnergyUse; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index 1c95ee563d..9de00b4a0e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -50,7 +50,6 @@ import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; -import gregtech.api.enums.ConfigCategories; import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.gui.modularui.GUITextureSet; @@ -61,8 +60,8 @@ import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; +import gregtech.common.config.machinestats.ConfigTeleporter; public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo, IAddUIWidgets { @@ -246,12 +245,10 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank } @Override - public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); - sPassiveEnergyDrain = aConfig - .get(ConfigCategories.machineconfig, "Teleporter.PassiveDrain", sPassiveEnergyDrain); - sPowerMultiplyer = aConfig.get(ConfigCategories.machineconfig, "Teleporter.PowerMultipler", sPowerMultiplyer); + public void onConfigLoad() { + sInterDimensionalTeleportAllowed = ConfigTeleporter.interDimensionalTPAllowed; + sPassiveEnergyDrain = ConfigTeleporter.passiveEnergyDrain; + sPowerMultiplyer = ConfigTeleporter.powerMultiplier; sFPowerMultiplyer = sPowerMultiplyer / 100.0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index cd31b9cc1e..b0b9cdd078 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -470,6 +470,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB cfg.get("cleanroom_allowed_blocks.warded_glass", "Name", "tile.blockCosmeticOpaque"); cfg.get("cleanroom_allowed_blocks.warded_glass", "Meta", 2); cfg.get("cleanroom_allowed_blocks.warded_glass", "Percentage", 50); + cfg.save(); } public static void loadConfig(Configuration cfg) { diff --git a/src/main/java/gregtech/loaders/load/GT_Loader_MetaTileEntities_Recipes.java b/src/main/java/gregtech/loaders/load/GT_Loader_MetaTileEntities_Recipes.java index 95ee79db74..1c90187ee2 100644 --- a/src/main/java/gregtech/loaders/load/GT_Loader_MetaTileEntities_Recipes.java +++ b/src/main/java/gregtech/loaders/load/GT_Loader_MetaTileEntities_Recipes.java @@ -17,7 +17,6 @@ import net.minecraft.item.ItemStack; import codechicken.nei.api.API; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -3960,21 +3959,13 @@ public class GT_Loader_MetaTileEntities_Recipes implements Runnable { GT_ModHandler.addCraftingRecipe( ItemList.MicroTransmitter_ZPM.get(1L), bitsd, - new Object[] { "CPC", aTextCableHull, "GBG", 'M', ItemList.Hull_ZPM, 'B', - GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "EnableZPMandUVBatteries", false) - ? ItemList.Energy_Module - : ItemList.ZPM2, - 'C', ItemList.Emitter_ZPM, 'G', OrePrefixes.circuit.get(Materials.ZPM), 'P', - ItemList.Field_Generator_ZPM }); + new Object[] { "CPC", aTextCableHull, "GBG", 'M', ItemList.Hull_ZPM, 'B', ItemList.Energy_Module, 'C', + ItemList.Emitter_ZPM, 'G', OrePrefixes.circuit.get(Materials.ZPM), 'P', ItemList.Field_Generator_ZPM }); GT_ModHandler.addCraftingRecipe( ItemList.MicroTransmitter_UV.get(1L), bitsd, - new Object[] { "CPC", aTextCableHull, "GBG", 'M', ItemList.Hull_UV, 'B', - GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "EnableZPMandUVBatteries", false) - ? ItemList.Energy_Module - : ItemList.ZPM3, - 'C', ItemList.Emitter_UV, 'G', OrePrefixes.circuit.get(Materials.UV), 'P', - ItemList.Field_Generator_UV }); + new Object[] { "CPC", aTextCableHull, "GBG", 'M', ItemList.Hull_UV, 'B', ItemList.Energy_Module, 'C', + ItemList.Emitter_UV, 'G', OrePrefixes.circuit.get(Materials.UV), 'P', ItemList.Field_Generator_UV }); GT_ModHandler.addCraftingRecipe( ItemList.Machine_Multi_Assemblyline.get(1L), diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java index 7747711cd8..1245a1dbaf 100644 --- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java +++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java @@ -20,8 +20,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.ItemSmeltedEvent; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -372,13 +370,10 @@ public class GT_Achievements { "over9000", false); registerAchievement("denseaspossible", 6, 10, ItemList.FusionComputer_UV.get(1), "finalpreparations", false); - if (GregTech_API.sOPStuff.get(ConfigCategories.Recipes.gregtechrecipes, "EnableZPMandUVBatteries", false)) { - registerAchievement("zpmage", 8, 10, ItemList.Energy_Module.get(1), "denseaspossible", false); - registerAchievement("uvage", 10, 10, ItemList.Energy_Cluster.get(1), "zpmage", false); - registerAchievement("whatnow", 12, 10, ItemList.ZPM2.get(1), "uvage", false); - } else { - registerAchievement("whatnow", 8, 10, ItemList.ZPM2.get(1), "denseaspossible", false); - } + + registerAchievement("zpmage", 8, 10, ItemList.Energy_Module.get(1), "denseaspossible", false); + registerAchievement("uvage", 10, 10, ItemList.Energy_Cluster.get(1), "zpmage", false); + registerAchievement("whatnow", 12, 10, ItemList.ZPM2.get(1), "uvage", false); if (GT_Mod.gregtechproxy.mAchievements) { AchievementPage.registerAchievementPage( diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java index 945ffae386..79342a460d 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingOre.java @@ -63,17 +63,7 @@ public class ProcessingOre implements gregtech.api.interfaces.IOreRecipeRegistra .eut(TierEU.RECIPE_LV) .addTo(centrifugeRecipes); } else { - registerStandardOreRecipes( - aPrefix, - aMaterial, - GT_Utility.copyAmount(1, aStack), - Math.max( - 1, - gregtech.api.GregTech_API.sOPStuff.get( - gregtech.api.enums.ConfigCategories.Materials.oreprocessingoutputmultiplier, - aMaterial.toString(), - 1)) - * (tIsRich ? 2 : 1)); + registerStandardOreRecipes(aPrefix, aMaterial, GT_Utility.copyAmount(1, aStack), tIsRich ? 2 : 1); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingRawOre.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingRawOre.java index 5ece6f5315..2da9f4b865 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingRawOre.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingRawOre.java @@ -40,16 +40,7 @@ public class ProcessingRawOre implements gregtech.api.interfaces.IOreRecipeRegis .eut(TierEU.RECIPE_LV) .addTo(centrifugeRecipes); } else { - registerStandardOreRecipes( - aPrefix, - aMaterial, - GT_Utility.copyAmount(1, aStack), - Math.max( - 1, - gregtech.api.GregTech_API.sOPStuff.get( - gregtech.api.enums.ConfigCategories.Materials.oreprocessingoutputmultiplier, - aMaterial.toString(), - 1))); + registerStandardOreRecipes(aPrefix, aMaterial, GT_Utility.copyAmount(1, aStack), 1); } } diff --git a/src/main/java/gregtech/loaders/postload/GT_PostLoad.java b/src/main/java/gregtech/loaders/postload/GT_PostLoad.java index 7998ba1ed2..5f0310a21e 100644 --- a/src/main/java/gregtech/loaders/postload/GT_PostLoad.java +++ b/src/main/java/gregtech/loaders/postload/GT_PostLoad.java @@ -15,7 +15,6 @@ import static gregtech.api.util.GT_RecipeBuilder.TICKS; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -415,11 +414,9 @@ public class GT_PostLoad { @SuppressWarnings("UnstableApiUsage") // Stable enough for this project Stopwatch stopwatch = Stopwatch.createStarted(); GT_Mod.GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait."); - Set<Materials> replaceVanillaItemsSet = GT_Mod.gregtechproxy.mUseGreatlyShrukenReplacementList - ? Arrays.stream(Materials.values()) - .filter(GT_RecipeRegistrator::hasVanillaRecipes) - .collect(Collectors.toSet()) - : new HashSet<>(Arrays.asList(Materials.values())); + Set<Materials> replaceVanillaItemsSet = Arrays.stream(Materials.values()) + .filter(GT_RecipeRegistrator::hasVanillaRecipes) + .collect(Collectors.toSet()); ProgressManager.ProgressBar progressBar = ProgressManager .push("Register materials", replaceVanillaItemsSet.size()); diff --git a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java index 8213013bfc..921f227b08 100644 --- a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java +++ b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java @@ -1,2384 +1,33 @@ package gregtech.loaders.postload; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; +import bloodasp.galacticgreg.WorldGenGaGT; +import gregtech.api.enums.GTStones; +import gregtech.api.enums.OreMixes; +import gregtech.api.enums.SmallOres; import gregtech.api.util.GT_Log; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; -import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; -import gregtech.common.GT_Worldgen_Stone; import gregtech.common.GT_Worldgenerator; public class GT_Worldgenloader implements Runnable { public void run() { - new GT_Worldgenerator(); - new GT_Worldgen_Stone( - "overworld.stone.blackgranite.tiny", - true, - GregTech_API.sBlockGranites, - 0, - 0, - 1, - 75, - 5, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.blackgranite.small", - true, - GregTech_API.sBlockGranites, - 0, - 0, - 1, - 100, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.blackgranite.medium", - true, - GregTech_API.sBlockGranites, - 0, - 0, - 1, - 200, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.blackgranite.large", - true, - GregTech_API.sBlockGranites, - 0, - 0, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.blackgranite.huge", - true, - GregTech_API.sBlockGranites, - 0, - 0, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "overworld.stone.redgranite.tiny", - true, - GregTech_API.sBlockGranites, - 8, - 0, - 1, - 75, - 5, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.redgranite.small", - true, - GregTech_API.sBlockGranites, - 8, - 0, - 1, - 100, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.redgranite.medium", - true, - GregTech_API.sBlockGranites, - 8, - 0, - 1, - 200, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.redgranite.large", - true, - GregTech_API.sBlockGranites, - 8, - 0, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.redgranite.huge", - true, - GregTech_API.sBlockGranites, - 8, - 0, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "overworld.stone.marble.tiny", - true, - GregTech_API.sBlockStones, - 0, - 0, - 1, - 75, - 5, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.marble.small", - true, - GregTech_API.sBlockStones, - 0, - 0, - 1, - 100, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.marble.medium", - true, - GregTech_API.sBlockStones, - 0, - 0, - 1, - 200, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.marble.large", - true, - GregTech_API.sBlockStones, - 0, - 0, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.marble.huge", - true, - GregTech_API.sBlockStones, - 0, - 0, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "overworld.stone.basalt.tiny", - true, - GregTech_API.sBlockStones, - 8, - 0, - 1, - 75, - 5, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.basalt.small", - true, - GregTech_API.sBlockStones, - 8, - 0, - 1, - 100, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.basalt.medium", - true, - GregTech_API.sBlockStones, - 8, - 0, - 1, - 200, - 10, - 0, - 180, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.basalt.large", - true, - GregTech_API.sBlockStones, - 8, - 0, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "overworld.stone.basalt.huge", - true, - GregTech_API.sBlockStones, - 8, - 0, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "nether.stone.blackgranite.tiny", - false, - GregTech_API.sBlockGranites, - 0, - -1, - 1, - 50, - 45, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.blackgranite.small", - false, - GregTech_API.sBlockGranites, - 0, - -1, - 1, - 100, - 60, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.blackgranite.medium", - false, - GregTech_API.sBlockGranites, - 0, - -1, - 1, - 200, - 80, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.blackgranite.large", - false, - GregTech_API.sBlockGranites, - 0, - -1, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.blackgranite.huge", - false, - GregTech_API.sBlockGranites, - 0, - -1, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "nether.stone.redgranite.tiny", - false, - GregTech_API.sBlockGranites, - 8, - -1, - 1, - 50, - 45, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.redgranite.small", - false, - GregTech_API.sBlockGranites, - 8, - -1, - 1, - 100, - 60, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.redgranite.medium", - false, - GregTech_API.sBlockGranites, - 8, - -1, - 1, - 200, - 80, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.redgranite.large", - false, - GregTech_API.sBlockGranites, - 8, - -1, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.redgranite.huge", - false, - GregTech_API.sBlockGranites, - 8, - -1, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "nether.stone.marble.tiny", - false, - GregTech_API.sBlockStones, - 0, - -1, - 1, - 50, - 45, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.marble.small", - false, - GregTech_API.sBlockStones, - 0, - -1, - 1, - 100, - 60, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.marble.medium", - false, - GregTech_API.sBlockStones, - 0, - -1, - 1, - 200, - 80, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.marble.large", - false, - GregTech_API.sBlockStones, - 0, - -1, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.marble.huge", - false, - GregTech_API.sBlockStones, - 0, - -1, - 1, - 400, - 150, - 0, - 120, - null, - false); - - new GT_Worldgen_Stone( - "nether.stone.basalt.tiny", - false, - GregTech_API.sBlockStones, - 8, - -1, - 1, - 50, - 45, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.basalt.small", - false, - GregTech_API.sBlockStones, - 8, - -1, - 1, - 100, - 60, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.basalt.medium", - false, - GregTech_API.sBlockStones, - 8, - -1, - 1, - 200, - 80, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.basalt.large", - false, - GregTech_API.sBlockStones, - 8, - -1, - 1, - 300, - 70, - 0, - 120, - null, - false); - new GT_Worldgen_Stone( - "nether.stone.basalt.huge", - false, - GregTech_API.sBlockStones, - 8, - -1, - 1, - 400, - 150, - 0, - 120, - null, - false); + // GT Stones + for (GTStones stone : GTStones.values()) { + stone.addGTStone(); + } // GT Default Small Ores - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.copper", - true, - 60, - 180, - 32, - true, - true, - true, - true, - true, - false, - Materials.Copper); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.tin", - true, - 80, - 220, - 32, - true, - true, - true, - true, - true, - true, - Materials.Tin); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.bismuth", - true, - 80, - 120, - 8, - false, - true, - false, - true, - true, - false, - Materials.Bismuth); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.coal", - true, - 120, - 250, - 24, - true, - false, - false, - false, - false, - false, - Materials.Coal); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.iron", - true, - 40, - 100, - 16, - true, - true, - true, - true, - true, - false, - Materials.Iron); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.lead", - true, - 40, - 180, - 16, - false, - true, - true, - true, - true, - true, - Materials.Lead); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.zinc", - true, - 80, - 210, - 24, - true, - true, - true, - true, - true, - false, - Materials.Zinc); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.gold", - true, - 20, - 60, - 8, - true, - false, - true, - true, - true, - true, - Materials.Gold); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.silver", - true, - 20, - 60, - 20, - true, - true, - true, - true, - true, - true, - Materials.Silver); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.nickel", - true, - 80, - 150, - 8, - true, - false, - true, - true, - true, - true, - Materials.Nickel); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.lapis", - true, - 10, - 50, - 4, - true, - false, - false, - true, - false, - true, - Materials.Lapis); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.diamond", - true, - 5, - 15, - 2, - true, - false, - false, - true, - true, - true, - Materials.Diamond); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.emerald", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Emerald); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.ruby", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Ruby); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.sapphire", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Sapphire); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.greensapphire", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.GreenSapphire); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.olivine", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Olivine); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.topaz", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Topaz); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.tanzanite", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Tanzanite); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.amethyst", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Amethyst); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.opal", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Opal); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.jasper", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Jasper); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.bluetopaz", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.BlueTopaz); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.amber", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.Amber); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.foolsruby", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.FoolsRuby); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.garnetred", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.GarnetRed); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.garnetyellow", - true, - 5, - 35, - 2, - false, - false, - false, - false, - true, - true, - Materials.GarnetYellow); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.redstone", - true, - 5, - 25, - 8, - true, - true, - false, - true, - true, - true, - Materials.Redstone); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.netherquartz", - true, - 30, - 120, - 64, - false, - true, - false, - false, - false, - false, - Materials.NetherQuartz); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.saltpeter", - true, - 10, - 60, - 8, - false, - true, - false, - false, - false, - false, - Materials.Saltpeter); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.sulfur", - true, - 5, - 60, - 40, - false, - true, - false, - false, - false, - false, - Materials.Sulfur); - - // TODO: GTNH Custom Small Ores - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.titanium", - true, - 10, - 180, - 32, - false, - false, - false, - Materials.Titanium); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.tungsten", - true, - 10, - 120, - 16, - false, - false, - false, - Materials.Tungsten); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.meteoriciron", - true, - 50, - 70, - 8, - false, - false, - false, - Materials.MeteoricIron); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.firestone", - true, - 5, - 15, - 2, - false, - false, - false, - Materials.Firestone); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.neutronium", - true, - 5, - 15, - 8, - false, - false, - false, - Materials.Neutronium); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.chromite", - true, - 20, - 40, - 8, - false, - false, - false, - Materials.Chromite); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.tungstate", - true, - 20, - 40, - 8, - false, - false, - false, - Materials.Tungstate); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.naquadah", - true, - 5, - 25, - 8, - false, - false, - false, - Materials.Naquadah); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.quantium", - true, - 5, - 25, - 6, - false, - false, - false, - Materials.Quantium); - new GT_Worldgen_GT_Ore_SmallPieces("ore.small.mythril", true, 5, 25, 6, false, false, false, Materials.Mytryl); - new GT_Worldgen_GT_Ore_SmallPieces("ore.small.ledox", true, 40, 60, 4, false, false, false, Materials.Ledox); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.oriharukon", - true, - 20, - 40, - 6, - false, - false, - false, - Materials.Oriharukon); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.draconium", - true, - 5, - 15, - 4, - false, - false, - false, - Materials.Draconium); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.awdraconium", - true, - 5, - 15, - 2, - false, - false, - false, - Materials.DraconiumAwakened); - new GT_Worldgen_GT_Ore_SmallPieces("ore.small.desh", true, 10, 30, 6, false, false, false, Materials.Desh); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.blackplutonium", - true, - 25, - 45, - 6, - false, - false, - false, - Materials.BlackPlutonium); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.infinitycatalyst", - true, - 40, - 80, - 6, - false, - false, - false, - Materials.InfinityCatalyst); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.infinity", - true, - 2, - 40, - 2, - false, - false, - false, - Materials.Infinity); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.bedrockium", - true, - 5, - 25, - 6, - false, - false, - false, - Materials.Bedrockium); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.realgar", - true, - 15, - 85, - 32, - false, - true, - false, - Materials.Realgar); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.certusquartz", - true, - 5, - 115, - 16, - false, - true, - false, - Materials.CertusQuartz); - new GT_Worldgen_GT_Ore_SmallPieces("ore.small.jade", true, 5, 35, 2, false, false, false, Materials.Jade); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.deepiron", - true, - 5, - 40, - 8, - false, - false, - false, - Materials.DeepIron); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.redgarnet", - true, - 5, - 35, - 2, - false, - false, - false, - Materials.GarnetRed); - new GT_Worldgen_GT_Ore_SmallPieces( - "ore.small.chargedcertus", - true, - 5, - 115, - 4, - false, - false, - false, - Materials.CertusQuartzCharged); - - // GT Default Veins - - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.naquadah", - true, - 10, - 90, - 30, - 4, - 32, - false, - false, - false, - Materials.Naquadah, - Materials.Naquadah, - Materials.Naquadah, - Materials.NaquadahEnriched); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.lignite", - true, - 80, - 210, - 160, - 7, - 32, - true, - false, - false, - Materials.Lignite, - Materials.Lignite, - Materials.Lignite, - Materials.Coal); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.coal", - true, - 30, - 80, - 80, - 5, - 32, - true, - false, - false, - Materials.Coal, - Materials.Coal, - Materials.Coal, - Materials.Lignite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.magnetite", - true, - 60, - 180, - 160, - 2, - 32, - true, - false, - false, - Materials.Magnetite, - Materials.Magnetite, - Materials.Iron, - Materials.VanadiumMagnetite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.gold", - true, - 30, - 60, - 160, - 2, - 32, - true, - false, - true, - Materials.Magnetite, - Materials.Magnetite, - Materials.VanadiumMagnetite, - Materials.Gold); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.iron", - true, - 10, - 40, - 120, - 3, - 24, - true, - true, - false, - Materials.BrownLimonite, - Materials.YellowLimonite, - Materials.BandedIron, - Materials.Malachite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.cassiterite", - true, - 60, - 220, - 50, - 4, - 24, - true, - false, - true, - Materials.Tin, - Materials.Tin, - Materials.Cassiterite, - Materials.Tin); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.tetrahedrite", - true, - 80, - 120, - 70, - 3, - 24, - false, - true, - true, - Materials.Tetrahedrite, - Materials.Tetrahedrite, - Materials.Copper, - Materials.Stibnite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.netherquartz", - true, - 40, - 80, - 80, - 4, - 24, - false, - true, - false, - Materials.NetherQuartz, - Materials.NetherQuartz, - Materials.NetherQuartz, - Materials.Quartzite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.sulfur", - true, - 5, - 20, - 100, - 4, - 24, - false, - true, - false, - Materials.Sulfur, - Materials.Sulfur, - Materials.Pyrite, - Materials.Sphalerite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.copper", - true, - 5, - 60, - 80, - 3, - 24, - true, - true, - true, - Materials.Chalcopyrite, - Materials.Iron, - Materials.Pyrite, - Materials.Copper); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.bauxite", - true, - 10, - 80, - 80, - 3, - 24, - false, - false, - false, - Materials.Bauxite, - Materials.Ilmenite, - Materials.Aluminium, - Materials.Ilmenite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.salts", - true, - 50, - 70, - 50, - 2, - 24, - true, - false, - false, - Materials.RockSalt, - Materials.Salt, - Materials.Lepidolite, - Materials.Spodumene); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.redstone", - true, - 5, - 40, - 60, - 2, - 24, - true, - true, - false, - Materials.Redstone, - Materials.Redstone, - Materials.Ruby, - Materials.Cinnabar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.soapstone", - true, - 20, - 50, - 40, - 2, - 16, - true, - false, - false, - Materials.Soapstone, - Materials.Talc, - Materials.Glauconite, - Materials.Pentlandite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.nickel", - true, - 10, - 40, - 40, - 2, - 16, - false, - false, - true, - Materials.Garnierite, - Materials.Nickel, - Materials.Cobaltite, - Materials.Pentlandite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.platinum", - true, - 40, - 50, - 5, - 2, - 16, - false, - false, - false, - Materials.Cooperite, - Materials.Palladium, - Materials.Platinum, - Materials.Iridium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.pitchblende", - true, - 30, - 60, - 40, - 2, - 16, - false, - false, - false, - Materials.Pitchblende, - Materials.Pitchblende, - Materials.Uraninite, - Materials.Uraninite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.monazite", - true, - 20, - 40, - 30, - 2, - 16, - false, - false, - false, - Materials.Bastnasite, - Materials.Bastnasite, - Materials.Monazite, - Materials.Neodymium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.molybdenum", - true, - 20, - 50, - 5, - 2, - 16, - false, - true, - true, - Materials.Wulfenite, - Materials.Molybdenite, - Materials.Molybdenum, - Materials.Powellite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.tungstate", - true, - 20, - 60, - 10, - 2, - 16, - false, - false, - false, - Materials.Scheelite, - Materials.Scheelite, - Materials.Tungstate, - Materials.Lithium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.sapphire", - true, - 10, - 40, - 60, - 2, - 16, - false, - false, - false, - Materials.Almandine, - Materials.Pyrope, - Materials.Sapphire, - Materials.GreenSapphire); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.manganese", - true, - 20, - 30, - 20, - 2, - 16, - true, - true, - false, - Materials.Grossular, - Materials.Spessartine, - Materials.Pyrolusite, - Materials.Tantalite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.quartz", - true, - 80, - 120, - 30, - 2, - 16, - false, - true, - false, - Materials.Quartzite, - Materials.Barite, - Materials.CertusQuartz, - Materials.CertusQuartz); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.diamond", - true, - 5, - 20, - 40, - 1, - 16, - true, - false, - false, - Materials.Graphite, - Materials.Graphite, - Materials.Diamond, - Materials.Coal); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.olivine", - true, - 10, - 40, - 60, - 2, - 16, - false, - false, - false, - Materials.Bentonite, - Materials.Magnesite, - Materials.Olivine, - Materials.Glauconite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.apatite", - true, - 40, - 60, - 60, - 2, - 16, - true, - false, - false, - Materials.Apatite, - Materials.Apatite, - Materials.TricalciumPhosphate, - Materials.Pyrochlore); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.galena", - true, - 5, - 45, - 40, - 4, - 16, - false, - false, - false, - Materials.Galena, - Materials.Galena, - Materials.Silver, - Materials.Lead); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.lapis", - true, - 20, - 50, - 40, - 4, - 16, - true, - false, - false, - Materials.Lazurite, - Materials.Sodalite, - Materials.Lapis, - Materials.Calcite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.beryllium", - true, - 5, - 30, - 30, - 2, - 16, - false, - true, - true, - Materials.Beryllium, - Materials.Beryllium, - Materials.Emerald, - Materials.Thorium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.uranium", - true, - 20, - 30, - 20, - 2, - 16, - false, - false, - false, - Materials.Uraninite, - Materials.Uraninite, - Materials.Uranium, - Materials.Uranium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.oilsand", - true, - 50, - 80, - 40, - 5, - 16, - true, - false, - false, - Materials.Oilsands, - Materials.Oilsands, - Materials.Oilsands, - Materials.Oilsands); - - /* - * TODO: custom GTNH OreMixes WARNING: NO DUPLICATES IN aName OR DEPRECATED MATERIALS IN HERE. Materials can be - * used unlimited, since achievements for Ores are turned off. - */ - - // aName, aDefault, aMinY, aMaxY, aWeight, aDensity, aSize, aOverworld, aNether, aEnd, aPrimary, aSecondary, - // aBetween, aSporadic - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.neutronium", - true, - 5, - 30, - 10, - 2, - 16, - false, - false, - false, - Materials.Neutronium, - Materials.Adamantium, - Materials.Naquadah, - Materials.Titanium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.aquaignis", - true, - 5, - 35, - 16, - 2, - 16, - false, - false, - false, - Materials.InfusedWater, - Materials.InfusedFire, - Materials.Amber, - Materials.Cinnabar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.terraaer", - true, - 5, - 35, - 16, - 2, - 16, - false, - false, - false, - Materials.InfusedEarth, - Materials.InfusedAir, - Materials.Amber, - Materials.Cinnabar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.perditioordo", - true, - 5, - 35, - 16, - 2, - 16, - false, - false, - false, - Materials.InfusedEntropy, - Materials.InfusedOrder, - Materials.Amber, - Materials.Cinnabar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.coppertin", - true, - 80, - 200, - 80, - 3, - 24, - true, - false, - false, - Materials.Chalcopyrite, - Materials.Vermiculite, - Materials.Cassiterite, - Materials.Alunite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.titaniumchrome", - true, - 10, - 70, - 16, - 2, - 16, - false, - false, - false, - Materials.Ilmenite, - Materials.Chromite, - Materials.Uvarovite, - Materials.Perlite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.mineralsand", - true, - 50, - 60, - 80, - 3, - 24, - true, - false, - false, - Materials.BasalticMineralSand, - Materials.GraniticMineralSand, - Materials.FullersEarth, - Materials.Gypsum); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.garnettin", - true, - 50, - 60, - 80, - 3, - 24, - true, - false, - false, - Materials.CassiteriteSand, - Materials.GarnetSand, - Materials.Asbestos, - Materials.Diatomite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.kaolinitezeolite", - true, - 50, - 70, - 60, - 4, - 16, - true, - false, - false, - Materials.Kaolinite, - Materials.Zeolite, - Materials.FullersEarth, - Materials.GlauconiteSand); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.mica", - true, - 20, - 40, - 20, - 2, - 16, - true, - false, - false, - Materials.Kyanite, - Materials.Mica, - Materials.Cassiterite, - Materials.Pollucite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.dolomite", - true, - 150, - 200, - 40, - 4, - 24, - true, - false, - false, - Materials.Dolomite, - Materials.Wollastonite, - Materials.Trona, - Materials.Andradite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.platinumchrome", - true, - 5, - 30, - 10, - 2, - 16, - false, - false, - false, - Materials.Platinum, - Materials.Chrome, - Materials.Cooperite, - Materials.Palladium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.iridiummytryl", - true, - 15, - 40, - 10, - 2, - 16, - false, - false, - false, - Materials.Nickel, - Materials.Iridium, - Materials.Palladium, - Materials.Mithril); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.osmium", - true, - 5, - 30, - 10, - 2, - 16, - false, - false, - false, - Materials.Nickel, - Materials.Osmium, - Materials.Iridium, - Materials.Nickel); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.saltpeterelectrotine", - true, - 5, - 45, - 40, - 3, - 16, - false, - true, - false, - Materials.Saltpeter, - Materials.Diatomite, - Materials.Electrotine, - Materials.Alunite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.desh", - true, - 5, - 40, - 30, - 2, - 16, - false, - false, - false, - Materials.Desh, - Materials.Desh, - Materials.Scheelite, - Materials.Tungstate); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.draconium", - true, - 20, - 40, - 40, - 1, - 16, - false, - false, - false, - Materials.Draconium, - Materials.Electrotine, - Materials.Jade, - Materials.Vinteum); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.quantium", - true, - 5, - 25, - 30, - 3, - 24, - false, - false, - false, - Materials.Quantium, - Materials.Amethyst, - Materials.Rutile, - Materials.Ardite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.callistoice", - true, - 40, - 60, - 40, - 2, - 16, - false, - false, - false, - Materials.CallistoIce, - Materials.Topaz, - Materials.BlueTopaz, - Materials.Alduorite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.mytryl", - true, - 10, - 30, - 40, - 2, - 16, - false, - false, - false, - Materials.Mytryl, - Materials.Jasper, - Materials.Ceruclase, - Materials.Vulcanite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.ledox", - true, - 55, - 65, - 30, - 2, - 24, - false, - false, - false, - Materials.Ledox, - Materials.Opal, - Materials.Orichalcum, - Materials.Rubracium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.oriharukon", - true, - 30, - 60, - 40, - 2, - 16, - false, - false, - false, - Materials.Oriharukon, - Materials.Tanzanite, - Materials.Vyroxeres, - Materials.Mirabilite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.blackplutonium", - true, - 5, - 25, - 40, - 2, - 24, - false, - false, - false, - Materials.BlackPlutonium, - Materials.GarnetRed, - Materials.GarnetYellow, - Materials.Borax); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.infusedgold", - true, - 15, - 40, - 30, - 2, - 16, - false, - false, - false, - Materials.Gold, - Materials.Gold, - Materials.InfusedGold, - Materials.Platinum); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.niobium", - true, - 5, - 30, - 60, - 2, - 24, - false, - false, - false, - Materials.Niobium, - Materials.Yttrium, - Materials.Gallium, - Materials.Gallium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.tungstenirons", - true, - 5, - 25, - 16, - 2, - 30, - false, - false, - false, - Materials.Tungsten, - Materials.Silicon, - Materials.DeepIron, - Materials.ShadowIron); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.uraniumgtnh", - true, - 10, - 30, - 60, - 2, - 24, - false, - false, - false, - Materials.Thorium, - Materials.Uranium, - Materials.Plutonium241, - Materials.Uranium235); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.vanadiumgold", - true, - 10, - 50, - 60, - 2, - 24, - false, - false, - false, - Materials.Vanadium, - Materials.Magnetite, - Materials.Gold, - Materials.Chrome); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.netherstar", - true, - 20, - 60, - 60, - 2, - 24, - false, - false, - false, - Materials.GarnetSand, - Materials.NetherStar, - Materials.GarnetRed, - Materials.GarnetYellow); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.garnet", - true, - 10, - 30, - 40, - 2, - 16, - false, - false, - false, - Materials.GarnetRed, - Materials.GarnetYellow, - Materials.Chrysotile, - Materials.Realgar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.rareearth", - true, - 30, - 60, - 40, - 2, - 24, - false, - false, - false, - Materials.Cadmium, - Materials.Caesium, - Materials.Lanthanum, - Materials.Cerium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.richnuclear", - true, - 55, - 120, - 5, - 2, - 8, - false, - false, - false, - Materials.Uranium, - Materials.Plutonium, - Materials.Thorium, - Materials.Thorium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.heavypentele", - true, - 40, - 60, - 60, - 5, - 32, - false, - false, - false, - Materials.Arsenic, - Materials.Bismuth, - Materials.Antimony, - Materials.Antimony); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.europa", - true, - 55, - 65, - 110, - 4, - 24, - false, - false, - false, - Materials.Magnesite, - Materials.BandedIron, - Materials.Sulfur, - Materials.Opal); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.europacore", - true, - 5, - 15, - 5, - 2, - 16, - false, - false, - false, - Materials.Chrome, - Materials.Tungstate, - Materials.Molybdenum, - Materials.Manganese); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.secondlanthanid", - true, - 10, - 40, - 10, - 3, - 24, - false, - false, - false, - Materials.Samarium, - Materials.Neodymium, - Materials.Tartarite, - Materials.Tartarite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.quartzspace", - true, - 40, - 80, - 20, - 3, - 16, - false, - false, - false, - Materials.Quartzite, - Materials.Barite, - Materials.CertusQuartz, - Materials.CertusQuartz); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.rutile", - true, - 5, - 20, - 8, - 4, - 12, - false, - false, - false, - Materials.Rutile, - Materials.Titanium, - Materials.Bauxite, - Materials.MeteoricIron); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.tfgalena", - true, - 5, - 35, - 40, - 4, - 16, - false, - false, - false, - Materials.Galena, - Materials.Silver, - Materials.Lead, - Materials.Cryolite); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.luvtantalite", - true, - 20, - 30, - 10, - 4, - 16, - false, - false, - false, - Materials.Pyrolusite, - Materials.Apatite, - Materials.Tantalite, - Materials.Pyrochlore); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.certusquartz", - true, - 40, - 80, - 60, - 5, - 32, - false, - false, - false, - Materials.CertusQuartz, - Materials.CertusQuartz, - Materials.CertusQuartzCharged, - Materials.QuartzSand); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.infinitycatalyst", - true, - 5, - 20, - 15, - 2, - 16, - false, - false, - false, - Materials.Neutronium, - Materials.Adamantium, - Materials.InfinityCatalyst, - Materials.Bedrockium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.cosmicneutronium", - true, - 5, - 20, - 15, - 2, - 16, - false, - false, - false, - Materials.Neutronium, - Materials.CosmicNeutronium, - Materials.BlackPlutonium, - Materials.Bedrockium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.dilithium", - true, - 30, - 100, - 30, - 3, - 24, - false, - false, - false, - Materials.Dilithium, - Materials.Dilithium, - Materials.MysteriousCrystal, - Materials.Vinteum); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.naquadria", - true, - 10, - 90, - 40, - 4, - 24, - false, - false, - false, - Materials.Naquadah, - Materials.NaquadahEnriched, - Materials.Naquadria, - Materials.Trinium); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.awakeneddraconium", - true, - 20, - 40, - 20, - 3, - 16, - false, - false, - false, - Materials.Draconium, - Materials.Draconium, - Materials.DraconiumAwakened, - Materials.NetherStar); - new GT_Worldgen_GT_Ore_Layer( - "ore.mix.tengam", - true, - 30, - 180, - 80, - 2, - 32, - false, - false, - false, - Materials.TengamRaw, - Materials.TengamRaw, - Materials.Electrotine, - Materials.Samarium); + for (SmallOres smallOre : SmallOres.values()) { + smallOre.addGTSmallOre(); + } - // DO NOT DELETE V THIS V - this is needed so that gregtech generates its Ore Layer's first (the ones up there), - // which can then be transformed into "GT_Worldgen_GT_Ore_Layer_Space". Also, Reflexion is slow. - try { - Class<?> clazz = Class.forName("bloodasp.galacticgreg.WorldGenGaGT"); - Constructor<?> constructor = clazz.getConstructor(); - Method method = clazz.getMethod("run"); - method.invoke(constructor.newInstance()); - GT_Log.out.println("Started Galactic Greg ore gen code"); - // this function calls Galactic Greg and enables its generation. - } catch (Exception e) { - // ClassNotFound is expected if Galactic Greg is absent, so only report if other problem - if (!(e instanceof ClassNotFoundException)) { - GT_Log.err.println("Unable to start Galactic Greg ore gen code"); - e.printStackTrace(GT_Log.err); - } + // GT Veins registration + for (OreMixes oreMix : OreMixes.values()) { + oreMix.addGTOreLayer(); } - // DO NOT DELETE ^ THIS ^ + new WorldGenGaGT().run(); + GT_Log.out.println("Started Galactic Greg ore gen code"); } } diff --git a/src/main/java/gregtech/loaders/postload/recipes/DistilleryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/DistilleryRecipes.java index 449bda7b27..dfbb2501f0 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/DistilleryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/DistilleryRecipes.java @@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -1201,16 +1200,6 @@ public class DistilleryRecipes implements Runnable { Materials.Carbon.getDustTiny(3), 120, 120); - - if (GregTech_API.sSpecialFile.get("general", "EnableLagencyOilGalactiCraft", false) - && FluidRegistry.getFluid("oilgc") != null) - addUniversalDistillationRecipe( - new FluidStack(FluidRegistry.getFluid("oilgc"), 50), - new FluidStack[] { Materials.SulfuricHeavyFuel.getFluid(15), Materials.SulfuricLightFuel.getFluid(50), - Materials.SulfuricNaphtha.getFluid(20), Materials.SulfuricGas.getGas(60) }, - null, - 20, - 96); } public void addUniversalDistillationRecipewithCircuit(FluidStack aInput, ItemStack[] aCircuit, diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java index ce69a4fa27..fda6c4c9e8 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java @@ -31,7 +31,6 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -2061,59 +2060,33 @@ public class GT_Loader_Item_Block_And_Fluid implements Runnable { GT_OreDictUnificator .set(OrePrefixes.ingot, Materials.Void, GT_ModHandler.getModItem(Thaumcraft.ID, "ItemResource", 1L, 16)); - if (GregTech_API.sUnification - .get(ConfigCategories.specialunificationtargets + "." + "railcraft", "plateIron", true)) { - GT_OreDictUnificator - .set(OrePrefixes.plate, Materials.Iron, GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 0)); - } else { - GT_OreDictUnificator.set( - OrePrefixes.plate, - Materials.Iron, - GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 0), - false, - false); - } + GT_OreDictUnificator.set( + OrePrefixes.plate, + Materials.Iron, + GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 0), + false, + false); - if (GregTech_API.sUnification - .get(ConfigCategories.specialunificationtargets + "." + "railcraft", "plateSteel", true)) { - GT_OreDictUnificator - .set(OrePrefixes.plate, Materials.Steel, GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 1)); - } else { - GT_OreDictUnificator.set( - OrePrefixes.plate, - Materials.Steel, - GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 1), - false, - false); - } + GT_OreDictUnificator.set( + OrePrefixes.plate, + Materials.Steel, + GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 1), + false, + false); - if (GregTech_API.sUnification - .get(ConfigCategories.specialunificationtargets + "." + "railcraft", "plateTinAlloy", true)) { - GT_OreDictUnificator.set( - OrePrefixes.plate, - Materials.TinAlloy, - GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 2)); - } else { - GT_OreDictUnificator.set( - OrePrefixes.plate, - Materials.TinAlloy, - GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 2), - false, - false); - } + GT_OreDictUnificator.set( + OrePrefixes.plate, + Materials.TinAlloy, + GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 2), + false, + false); - if (GregTech_API.sUnification - .get(ConfigCategories.specialunificationtargets + "." + "railcraft", "plateCopper", true)) { - GT_OreDictUnificator - .set(OrePrefixes.plate, Materials.Copper, GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 3)); - } else { - GT_OreDictUnificator.set( - OrePrefixes.plate, - Materials.Copper, - GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 3), - false, - false); - } + GT_OreDictUnificator.set( + OrePrefixes.plate, + Materials.Copper, + GT_ModHandler.getModItem(Railcraft.ID, "part.plate", 1L, 3), + false, + false); GT_OreDictUnificator.set( OrePrefixes.dust, diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java index 26d75c7933..a2e6137cff 100644 --- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java +++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java @@ -2,7 +2,6 @@ package gregtech.loaders.preload; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.Mods.CraftTweaker; -import static gregtech.api.enums.Mods.EnderIO; import static gregtech.api.enums.Mods.GalacticraftCore; import static gregtech.api.enums.Mods.GregTech; @@ -14,7 +13,6 @@ import java.io.PrintStream; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; -import java.util.Calendar; import java.util.List; import java.util.Objects; import java.util.regex.Matcher; @@ -35,7 +33,6 @@ import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ModDiscoverer; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -50,6 +47,16 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_RecipeBuilder; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Proxy; +import gregtech.common.config.client.ConfigColorModulation; +import gregtech.common.config.client.ConfigInterface; +import gregtech.common.config.client.ConfigRender; +import gregtech.common.config.client.ConfigWaila; +import gregtech.common.config.gregtech.ConfigDebug; +import gregtech.common.config.gregtech.ConfigFeatures; +import gregtech.common.config.gregtech.ConfigGeneral; +import gregtech.common.config.gregtech.ConfigMachines; +import gregtech.common.config.gregtech.ConfigOreDropBehavior; +import gregtech.common.config.gregtech.ConfigPollution; import gregtech.common.tileentities.machines.long_distance.GT_MetaTileEntity_LongDistancePipelineBase; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Cleanroom; @@ -126,33 +133,28 @@ public class GT_PreLoad { .addStringLocalization("Material." + aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName)); } - public static Configuration getConfiguration(File configDir) { - File tFile = new File(new File(configDir, "GregTech"), "GregTech.cfg"); - Configuration tMainConfig = new Configuration(tFile); - tMainConfig.load(); - tFile = new File(new File(configDir, "GregTech"), "IDs.cfg"); + public static void getConfiguration(File configDir) { + File tFile = new File(new File(configDir, "GregTech"), "IDs.cfg"); GT_Config.sConfigFileIDs = new Configuration(tFile); GT_Config.sConfigFileIDs.load(); GT_Config.sConfigFileIDs.save(); - GregTech_API.sMachineFile = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "MachineStats.cfg"))); - GregTech_API.sWorldgenFile = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "WorldGeneration.cfg"))); - GregTech_API.sMaterialProperties = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "MaterialProperties.cfg"))); - GregTech_API.sUnification = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "Unification.cfg"))); - GregTech_API.sSpecialFile = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "Other.cfg"))); - GregTech_API.sOPStuff = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "OverpoweredStuff.cfg"))); - - GregTech_API.sClientDataFile = new GT_Config( - new Configuration(new File(new File(configDir, "GregTech"), "Client.cfg"))); - return tMainConfig; + + tFile = new File(new File(configDir, "GregTech"), "Cleanroom.cfg"); + GT_Config.cleanroomFile = new Configuration(tFile); + GT_Config.cleanroomFile.load(); + GT_Config.cleanroomFile.save(); + + tFile = new File(new File(configDir, "GregTech"), "UndergroundFluids.cfg"); + GT_Config.undergroundFluidsFile = new Configuration(tFile); + GT_Config.undergroundFluidsFile.load(); + GT_Config.undergroundFluidsFile.save(); + + GregTech_API.NEIClientFIle = new GT_Config( + new Configuration(new File(new File(configDir, "GregTech"), "NEIClient.cfg"))); + } - public static void createLogFiles(File parentFile, Configuration tMainConfig) { + public static void createLogFiles(File parentFile) { GT_Log.mLogFile = new File(parentFile, "logs/GregTech.log"); if (!GT_Log.mLogFile.exists()) { try { @@ -163,8 +165,7 @@ public class GT_PreLoad { GT_Log.out = GT_Log.err = new PrintStream(GT_Log.mLogFile); } catch (FileNotFoundException ignored) {} - if (tMainConfig.get(GT_Mod.aTextGeneral, "LoggingOreDict", false) - .getBoolean(false)) { + if (ConfigGeneral.loggingOreDict) { GT_Log.mOreDictLogFile = new File(parentFile, "logs/OreDict.log"); if (!GT_Log.mOreDictLogFile.exists()) { try { @@ -183,8 +184,7 @@ public class GT_PreLoad { GT_Log.ore.println("******************************************************************************"); tList.forEach(GT_Log.ore::println); } - if (tMainConfig.get(GT_Mod.aTextGeneral, "LoggingExplosions", true) - .getBoolean(true)) { + if (ConfigGeneral.loggingExplosions) { GT_Log.mExplosionLog = new File(parentFile, "logs/Explosion.log"); if (!GT_Log.mExplosionLog.exists()) { try { @@ -196,8 +196,7 @@ public class GT_PreLoad { } catch (Throwable ignored) {} } - if (tMainConfig.get(GT_Mod.aTextGeneral, "LoggingPlayerActivity", true) - .getBoolean(true)) { + if (ConfigGeneral.loggingPlayerActicity) { GT_Log.mPlayerActivityLogFile = new File(parentFile, "logs/PlayerActivity.log"); if (!GT_Log.mPlayerActivityLogFile.exists()) { try { @@ -371,270 +370,126 @@ public class GT_PreLoad { GT_ModHandler.addScrapboxDrop(200.0F, GT_ModHandler.getIC2Item("scrap", 1L)); } - public static void loadConfig(Configuration tMainConfig) { - GT_Values.D1 = tMainConfig.get(GT_Mod.aTextGeneral, "Debug", false) - .getBoolean(false); - GT_Values.D2 = tMainConfig.get(GT_Mod.aTextGeneral, "Debug2", false) - .getBoolean(false); - GT_Values.allow_broken_recipemap = tMainConfig.get(GT_Mod.aTextGeneral, "debug allow broken recipemap", false) - .getBoolean(false); - GT_Values.debugCleanroom = tMainConfig.get(GT_Mod.aTextGeneral, "debugCleanroom", false) - .getBoolean(false); - GT_Values.debugDriller = tMainConfig.get(GT_Mod.aTextGeneral, "debugDriller", false) - .getBoolean(false); - GT_Values.debugWorldGen = tMainConfig.get(GT_Mod.aTextGeneral, "debugWorldGen", false) - .getBoolean(false); - GT_Values.debugOrevein = tMainConfig.get(GT_Mod.aTextGeneral, "debugOrevein", false) - .getBoolean(false); - GT_Values.debugSmallOres = tMainConfig.get(GT_Mod.aTextGeneral, "debugSmallOres", false) - .getBoolean(false); - GT_Values.debugStones = tMainConfig.get(GT_Mod.aTextGeneral, "debugStones", false) - .getBoolean(false); - GT_Values.debugBlockMiner = tMainConfig.get(GT_Mod.aTextGeneral, "debugBlockMiner", false) - .getBoolean(false); - GT_Values.debugBlockPump = tMainConfig.get(GT_Mod.aTextGeneral, "debugBlockPump", false) - .getBoolean(false); - GT_Values.debugEntityCramming = tMainConfig.get(GT_Mod.aTextGeneral, "debugEntityCramming", false) - .getBoolean(false); - GT_Values.debugWorldData = tMainConfig.get(GT_Mod.aTextGeneral, "debugWorldData", false) - .getBoolean(false); - GT_Values.oreveinPercentage = tMainConfig.get(GT_Mod.aTextGeneral, "oreveinPercentage_100", 100) - .getInt(100); - GT_Values.oreveinAttempts = tMainConfig.get(GT_Mod.aTextGeneral, "oreveinAttempts_64", 64) - .getInt(64); - GT_Values.oreveinMaxPlacementAttempts = tMainConfig.get(GT_Mod.aTextGeneral, "oreveinMaxPlacementAttempts_8", 8) - .getInt(8); - GT_Values.oreveinPlacerOres = tMainConfig.get(GT_Mod.aTextGeneral, "oreveinPlacerOres", true) - .getBoolean(true); - GT_Values.oreveinPlacerOresMultiplier = tMainConfig.get(GT_Mod.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.blacklistedTileEntiyClassNamesForWA = tMainConfig.getStringList( - "blacklistedTileEntiyClassNamesForWA", - "machines", - GT_Values.blacklistedTileEntiyClassNamesForWA, - "class names to be blacklisted from the world accelerator"); - 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); - GT_Values.disableDigitalChestsExternalAccess = tMainConfig - .get("machines", "disableDigitalChestsExternalAccess", false) - .getBoolean(false); - GT_Values.enableMultiTileEntities = tMainConfig.get( - "machines", - "enableMultiTileEntities", - false, - "This enabled MuTEs(multitile entities) to be added to the game. MuTEs are in the start of development and its not recommended to enable them unless you know what you are doing.") - .getBoolean(false) - // Make sure MuTEs are enabled in development - || (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); - GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig - .get(GT_Mod.aTextGeneral, "TicksForLagAveragingWithScanner", 25) - .getInt(25); - GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig - .get(GT_Mod.aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100) - .getInt(100); - if (tMainConfig.get(GT_Mod.aTextGeneral, "disable_STDOUT", false) - .getBoolean(false)) { - GT_FML_LOGGER.info("Disableing Console Messages."); - GT_FML_LOGGER.exit(); - System.out.close(); - System.err.close(); + public static void loadConfig() { + // general + GT_Values.D1 = ConfigDebug.D1; + GT_Values.D2 = ConfigDebug.D2; + GT_Values.allow_broken_recipemap = ConfigDebug.allowBrokenRecipeMap; + GT_Values.debugCleanroom = ConfigDebug.debugCleanroom; + GT_Values.debugDriller = ConfigDebug.debugDriller; + GT_Values.debugWorldGen = ConfigDebug.debugWorldgen; + GT_Values.debugOrevein = ConfigDebug.debugOrevein; + GT_Values.debugSmallOres = ConfigDebug.debugSmallOres; + GT_Values.debugStones = ConfigDebug.debugStones; + GT_Values.debugBlockMiner = ConfigDebug.debugBlockMiner; + GT_Values.debugBlockPump = ConfigDebug.debugBlockPump; + GT_Values.debugEntityCramming = ConfigDebug.debugEntityCramming; + GT_Values.debugWorldData = ConfigDebug.debugWorldData; + GT_Values.oreveinPercentage = ConfigGeneral.oreveinPercentage; + GT_Values.oreveinAttempts = ConfigGeneral.oreveinAttempts; + GT_Values.oreveinMaxPlacementAttempts = ConfigGeneral.oreveinMaxPlacementAttempts; + GT_Values.oreveinPlacerOres = ConfigGeneral.oreveinPlacerOres; + GT_Values.oreveinPlacerOresMultiplier = ConfigGeneral.oreveinPlacerOresMultiplier; + GregTech_API.TICKS_FOR_LAG_AVERAGING = ConfigGeneral.ticksForLagAveraging; + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = ConfigGeneral.millisecondThesholdUntilLagWarning; + GregTech_API.sTimber = ConfigGeneral.timber; + GregTech_API.sDrinksAlwaysDrinkable = ConfigGeneral.drinksAlwaysDrinkable; + GregTech_API.sDoShowAllItemsInCreative = ConfigGeneral.doShowAllItemsInCreative; + GregTech_API.sMultiThreadedSounds = ConfigGeneral.multiThreadedSounds; + GT_Mod.gregtechproxy.mMaxEqualEntitiesAtOneSpot = ConfigGeneral.maxEqualEntitiesAtOneSpot; + GT_Mod.gregtechproxy.mFlintChance = ConfigGeneral.flintChance; + GT_Mod.gregtechproxy.mItemDespawnTime = ConfigGeneral.itemDespawnTime; + GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation = ConfigGeneral.allowSmallBoilerAutomation; + GT_Mod.gregtechproxy.mDisableVanillaOres = gregtech.common.config.worldgen.ConfigGeneral.disableVanillaOres; + GT_Mod.gregtechproxy.mIncreaseDungeonLoot = ConfigGeneral.increaseDungeonLoot; + GT_Mod.gregtechproxy.mAxeWhenAdventure = ConfigGeneral.axeWhenAdventure; + GT_Mod.gregtechproxy.mSurvivalIntoAdventure = ConfigGeneral.survivalIntoAdventure; + GT_Mod.gregtechproxy.mHungerEffect = ConfigGeneral.hungerEffect; + GT_Mod.gregtechproxy.mInventoryUnification = ConfigGeneral.inventoryUnification; + GT_Mod.gregtechproxy.mGTBees = ConfigGeneral.GTBees; + GT_Mod.gregtechproxy.mCraftingUnification = ConfigGeneral.craftingUnification; + GT_Mod.gregtechproxy.mNerfedWoodPlank = ConfigGeneral.nerfedWoodPlank; + GT_Mod.gregtechproxy.mNerfedVanillaTools = ConfigGeneral.nerfedVanillaTools; + GT_Mod.gregtechproxy.mAchievements = ConfigGeneral.achievements; + GT_Mod.gregtechproxy.mHideUnusedOres = ConfigGeneral.hideUnusedOres; + GT_Mod.gregtechproxy.mEnableAllMaterials = ConfigGeneral.enableAllMaterials; + GT_Mod.gregtechproxy.mExplosionItemDrop = ConfigGeneral.explosionItemDrop; + GT_Mod.gregtechproxy.mEnableCleanroom = ConfigGeneral.enableCleanroom; + GT_Mod.gregtechproxy.mLowGravProcessing = GalacticraftCore.isModLoaded() && ConfigGeneral.lowGravProcessing; + GT_Mod.gregtechproxy.mCropNeedBlock = ConfigGeneral.cropNeedBlock; + GT_Mod.gregtechproxy.mAMHInteraction = ConfigGeneral.autoMaintenaceHatchesInteraction; + GT_Mod.gregtechproxy.mMixedOreOnlyYieldsTwoThirdsOfPureOre = ConfigGeneral.mixedOreOnlyYieldsTwoThirdsOfPureOre; + GT_Mod.gregtechproxy.mRichOreYieldMultiplier = ConfigGeneral.richOreYieldMultiplier; + GT_Mod.gregtechproxy.mNetherOreYieldMultiplier = ConfigGeneral.netherOreYieldMultiplier; + GT_Mod.gregtechproxy.mEndOreYieldMultiplier = ConfigGeneral.endOreYieldMultiplier; + GT_Mod.gregtechproxy.gt6Pipe = ConfigGeneral.gt6Pipe; + GT_Mod.gregtechproxy.gt6Cable = ConfigGeneral.gt6Cable; + GT_Mod.gregtechproxy.ic2EnergySourceCompat = ConfigGeneral.ic2EnergySourceCompat; + GT_Mod.gregtechproxy.costlyCableConnection = ConfigGeneral.costlyCableConnection; + GT_Mod.gregtechproxy.crashOnNullRecipeInput = ConfigGeneral.crashOnNullRecipeInput; + if ((boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) { + GT_Mod.gregtechproxy.crashOnNullRecipeInput = false; // Use flags in GT_RecipeBuilder instead! + } + GT_LanguageManager.i18nPlaceholder = ConfigGeneral.i18nPlaceholder; + GT_MetaTileEntity_LongDistancePipelineBase.minimalDistancePoints = ConfigGeneral.minimalDistancePoints; + GT_Values.mCTMEnabledBlock.addAll(Arrays.asList(ConfigGeneral.CTMWhitelist)); + GT_Values.mCTMDisabledBlock.addAll(Arrays.asList(ConfigGeneral.CTMBlacklist)); + if (ConfigGeneral.harderMobSpawner) { + Blocks.mob_spawner.setHardness(500.0F) + .setResistance(6000000.0F); } - GregTech_API.sMachineExplosions = tMainConfig.get("machines", "machines_explosion_damage", true) - .getBoolean(false); - GregTech_API.sMachineFlammable = tMainConfig.get("machines", "machines_flammable", true) - .getBoolean(false); - GregTech_API.sMachineNonWrenchExplosions = tMainConfig.get("machines", "explosions_on_nonwrenching", true) - .getBoolean(false); - GregTech_API.sMachineWireFire = tMainConfig.get("machines", "wirefire_on_explosion", true) - .getBoolean(false); - GregTech_API.sMachineFireExplosions = tMainConfig.get("machines", "fire_causes_explosions", true) - .getBoolean(false); - GregTech_API.sMachineRainExplosions = tMainConfig.get("machines", "rain_causes_explosions", true) - .getBoolean(false); - GregTech_API.sMachineThunderExplosions = tMainConfig.get("machines", "lightning_causes_explosions", true) - .getBoolean(false); - GregTech_API.sConstantEnergy = tMainConfig.get("machines", "constant_need_of_energy", true) - .getBoolean(false); - GregTech_API.sColoredGUI = tMainConfig.get("machines", "colored_guis_when_painted", true) - .getBoolean(false); - GregTech_API.sMachineMetalGUI = tMainConfig.get("machines", "guis_in_consistent_machine_metal_color", false) - .getBoolean(false); + // machines + GT_Values.ticksBetweenSounds = ConfigMachines.ticksBetweenSounds; + GT_Values.blacklistedTileEntiyClassNamesForWA = ConfigMachines.blacklistedTileEntiyClassNamesForWA; + GT_Values.cleanroomGlass = ConfigMachines.cleanroomGlass; + GT_Values.enableChunkloaders = ConfigMachines.enableChunkloaders; + GT_Values.alwaysReloadChunkloaders = ConfigMachines.alwaysReloadChunkloaders; + GT_Values.debugChunkloaders = ConfigDebug.debugChunkloaders; + GT_Values.disableDigitalChestsExternalAccess = ConfigMachines.disableDigitalChestsExternalAccess; + GT_Values.enableMultiTileEntities = ConfigMachines.enableMultiTileEntities + || (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + GregTech_API.sMachineExplosions = ConfigMachines.machineExplosions; + GregTech_API.sMachineFlammable = ConfigMachines.machineFlammable; + GregTech_API.sMachineNonWrenchExplosions = ConfigMachines.machineNonWrenchExplosions; + GregTech_API.sMachineWireFire = ConfigMachines.machineWireFire; + GregTech_API.sMachineFireExplosions = ConfigMachines.machineFireExplosions; + GregTech_API.sMachineRainExplosions = ConfigMachines.machineRainExplosions; + GregTech_API.sMachineThunderExplosions = ConfigMachines.machineThunderExplosions; + GregTech_API.sColoredGUI = ConfigMachines.coloredGUI; + GregTech_API.sMachineMetalGUI = ConfigMachines.machineMetalGUI; // Implementation for this is actually handled in NewHorizonsCoreMod in MainRegistry.java! - GregTech_API.sUseMachineMetal = tMainConfig.get("machines", "use_machine_metal_tint", true) - .getBoolean(true); - - GregTech_API.sTimber = tMainConfig.get(GT_Mod.aTextGeneral, "timber_axe", true) - .getBoolean(true); - GregTech_API.sDrinksAlwaysDrinkable = tMainConfig.get(GT_Mod.aTextGeneral, "drinks_always_drinkable", false) - .getBoolean(false); - GregTech_API.sDoShowAllItemsInCreative = tMainConfig - .get(GT_Mod.aTextGeneral, "show_all_metaitems_in_creative_and_NEI", false) - .getBoolean(false); - GregTech_API.sMultiThreadedSounds = tMainConfig.get(GT_Mod.aTextGeneral, "sound_multi_threading", false) - .getBoolean(false); + GregTech_API.sUseMachineMetal = ConfigMachines.useMachineMetal; + // client loadClientConfig(); - GT_Mod.gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig - .get(GT_Mod.aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3) - .getInt(3); - GT_Mod.gregtechproxy.mSkeletonsShootGTArrows = tMainConfig - .get(GT_Mod.aTextGeneral, "SkeletonsShootGTArrows", 16) - .getInt(16); - GT_Mod.gregtechproxy.mFlintChance = tMainConfig.get(GT_Mod.aTextGeneral, "FlintAndSteelChance", 30) - .getInt(30); - GT_Mod.gregtechproxy.mItemDespawnTime = tMainConfig.get(GT_Mod.aTextGeneral, "ItemDespawnTime", 6000) - .getInt(6000); - GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation = tMainConfig - .get(GT_Mod.aTextGeneral, "AllowSmallBoilerAutomation", false) - .getBoolean(false); - GT_Mod.gregtechproxy.mDisableVanillaOres = tMainConfig.get(GT_Mod.aTextGeneral, "DisableVanillaOres", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mIncreaseDungeonLoot = tMainConfig.get(GT_Mod.aTextGeneral, "IncreaseDungeonLoot", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mAxeWhenAdventure = tMainConfig.get(GT_Mod.aTextGeneral, "AdventureModeStartingAxe", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mSurvivalIntoAdventure = tMainConfig.get(GT_Mod.aTextGeneral, "forceAdventureMode", false) - .getBoolean(false); - GT_Mod.gregtechproxy.mHungerEffect = tMainConfig.get(GT_Mod.aTextGeneral, "AFK_Hunger", false) - .getBoolean(false); - GT_Mod.gregtechproxy.mInventoryUnification = tMainConfig.get(GT_Mod.aTextGeneral, "InventoryUnification", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mGTBees = tMainConfig.get(GT_Mod.aTextGeneral, "GTBees", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mCraftingUnification = tMainConfig.get(GT_Mod.aTextGeneral, "CraftingUnification", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mNerfedWoodPlank = tMainConfig.get(GT_Mod.aTextGeneral, "WoodNeedsSawForCrafting", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mNerfedVanillaTools = tMainConfig - .get(GT_Mod.aTextGeneral, "smallerVanillaToolDurability", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mAchievements = tMainConfig.get(GT_Mod.aTextGeneral, "EnableAchievements", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mHideUnusedOres = tMainConfig.get(GT_Mod.aTextGeneral, "HideUnusedOres", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mEnableAllMaterials = tMainConfig.get("general", "EnableAllMaterials", false) - .getBoolean(false); - - // Pollution: edit GT_Proxy.java to change default values - GT_Mod.gregtechproxy.mPollution = tMainConfig - .get("Pollution", "EnablePollution", GT_Mod.gregtechproxy.mPollution) - .getBoolean(GT_Mod.gregtechproxy.mPollution); - GT_Mod.gregtechproxy.mPollutionSmogLimit = tMainConfig - .get("Pollution", "SmogLimit", GT_Mod.gregtechproxy.mPollutionSmogLimit) - .getInt(GT_Mod.gregtechproxy.mPollutionSmogLimit); - GT_Mod.gregtechproxy.mPollutionPoisonLimit = tMainConfig - .get("Pollution", "PoisonLimit", GT_Mod.gregtechproxy.mPollutionPoisonLimit) - .getInt(GT_Mod.gregtechproxy.mPollutionPoisonLimit); - GT_Mod.gregtechproxy.mPollutionVegetationLimit = tMainConfig - .get("Pollution", "VegetationLimit", GT_Mod.gregtechproxy.mPollutionVegetationLimit) - .getInt(GT_Mod.gregtechproxy.mPollutionVegetationLimit); - GT_Mod.gregtechproxy.mPollutionSourRainLimit = tMainConfig - .get("Pollution", "SourRainLimit", GT_Mod.gregtechproxy.mPollutionSourRainLimit) - .getInt(GT_Mod.gregtechproxy.mPollutionSourRainLimit); - GT_Mod.gregtechproxy.mPollutionOnExplosion = tMainConfig - .get("Pollution", "SourRainLimit", GT_Mod.gregtechproxy.mPollutionOnExplosion) - .getInt(GT_Mod.gregtechproxy.mPollutionOnExplosion); - GT_Mod.gregtechproxy.mExplosionItemDrop = tMainConfig - .get("general", "ExplosionItemDrops", GT_Mod.gregtechproxy.mExplosionItemDrop) - .getBoolean(GT_Mod.gregtechproxy.mExplosionItemDrop); - GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond = tMainConfig - .get( - "Pollution", - "PollutionPrimitiveBlastFurnace", - GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond); - GT_Mod.gregtechproxy.mPollutionCharcoalPitPerSecond = tMainConfig - .get("Pollution", "PollutionCharcoalPit", GT_Mod.gregtechproxy.mPollutionCharcoalPitPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionCharcoalPitPerSecond); - GT_Mod.gregtechproxy.mPollutionEBFPerSecond = tMainConfig - .get("Pollution", "PollutionEBF", GT_Mod.gregtechproxy.mPollutionEBFPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionEBFPerSecond); - GT_Mod.gregtechproxy.mPollutionLargeCombustionEnginePerSecond = tMainConfig - .get( - "Pollution", - "PollutionLargeCombustionEngine", - GT_Mod.gregtechproxy.mPollutionLargeCombustionEnginePerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeCombustionEnginePerSecond); - GT_Mod.gregtechproxy.mPollutionExtremeCombustionEnginePerSecond = tMainConfig - .get( - "Pollution", - "PollutionExtremeCombustionEngine", - GT_Mod.gregtechproxy.mPollutionExtremeCombustionEnginePerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionExtremeCombustionEnginePerSecond); - GT_Mod.gregtechproxy.mPollutionImplosionCompressorPerSecond = tMainConfig - .get( - "Pollution", - "PollutionImplosionCompressor", - GT_Mod.gregtechproxy.mPollutionImplosionCompressorPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionImplosionCompressorPerSecond); - GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond = tMainConfig - .get("Pollution", "PollutionLargeBronzeBoiler", GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond = tMainConfig - .get("Pollution", "PollutionLargeSteelBoiler", GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond = tMainConfig - .get( - "Pollution", - "PollutionLargeTitaniumBoiler", - GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond = tMainConfig - .get( - "Pollution", - "PollutionLargeTungstenSteelBoiler", - GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionReleasedByThrottle = tMainConfig - .get("Pollution", "PollutionReleasedByThrottle", GT_Mod.gregtechproxy.mPollutionReleasedByThrottle) - .getDouble(GT_Mod.gregtechproxy.mPollutionReleasedByThrottle); - GT_Mod.gregtechproxy.mPollutionLargeGasTurbinePerSecond = tMainConfig - .get("Pollution", "PollutionLargeGasTurbine", GT_Mod.gregtechproxy.mPollutionLargeGasTurbinePerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionLargeGasTurbinePerSecond); - GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond = tMainConfig - .get("Pollution", "PollutionMultiSmelter", GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond); - GT_Mod.gregtechproxy.mPollutionPyrolyseOvenPerSecond = tMainConfig - .get("Pollution", "PollutionPyrolyseOven", GT_Mod.gregtechproxy.mPollutionPyrolyseOvenPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionPyrolyseOvenPerSecond); - GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond = tMainConfig - .get("Pollution", "PollutionSmallCoalBoiler", GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond = tMainConfig - .get( - "Pollution", - "PollutionHighPressureLavaBoiler", - GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond = tMainConfig - .get( - "Pollution", - "PollutionHighPressureCoalBoiler", - GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond); - GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond = tMainConfig - .get( - "Pollution", - "PollutionBaseDieselGenerator", - GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond); - double[] mPollutionDieselGeneratorReleasedByTier = tMainConfig - .get( - "Pollution", - "PollutionReleasedByTierDieselGenerator", - GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier) - .getDoubleList(); + // Pollution + GT_Mod.gregtechproxy.mPollution = ConfigPollution.pollution; + GT_Mod.gregtechproxy.mPollutionSmogLimit = ConfigPollution.pollutionSmogLimit; + GT_Mod.gregtechproxy.mPollutionPoisonLimit = ConfigPollution.pollutionPoisonLimit; + GT_Mod.gregtechproxy.mPollutionVegetationLimit = ConfigPollution.pollutionVegetationLimit; + GT_Mod.gregtechproxy.mPollutionSourRainLimit = ConfigPollution.pollutionSourRainLimit; + GT_Mod.gregtechproxy.mPollutionOnExplosion = ConfigPollution.pollutionOnExplosion; + GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond = ConfigPollution.pollutionPrimitveBlastFurnacePerSecond; + GT_Mod.gregtechproxy.mPollutionCharcoalPitPerSecond = ConfigPollution.pollutionCharcoalPitPerSecond; + GT_Mod.gregtechproxy.mPollutionEBFPerSecond = ConfigPollution.pollutionEBFPerSecond; + GT_Mod.gregtechproxy.mPollutionLargeCombustionEnginePerSecond = ConfigPollution.pollutionLargeCombustionEnginePerSecond; + GT_Mod.gregtechproxy.mPollutionExtremeCombustionEnginePerSecond = ConfigPollution.pollutionExtremeCombustionEnginePerSecond; + GT_Mod.gregtechproxy.mPollutionImplosionCompressorPerSecond = ConfigPollution.pollutionImplosionCompressorPerSecond; + GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond = ConfigPollution.pollutionLargeBronzeBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond = ConfigPollution.pollutionLargeSteelBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond = ConfigPollution.pollutionLargeTitaniumBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond = ConfigPollution.pollutionLargeTungstenSteelBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionReleasedByThrottle = ConfigPollution.pollutionReleasedByThrottle; + GT_Mod.gregtechproxy.mPollutionLargeGasTurbinePerSecond = ConfigPollution.pollutionLargeGasTurbinePerSecond; + GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond = ConfigPollution.pollutionMultiSmelterPerSecond; + GT_Mod.gregtechproxy.mPollutionPyrolyseOvenPerSecond = ConfigPollution.pollutionPyrolyseOvenPerSecond; + GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond = ConfigPollution.pollutionSmallCoalBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond = ConfigPollution.pollutionHighPressureLavaBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond = ConfigPollution.pollutionHighPressureCoalBoilerPerSecond; + GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond = ConfigPollution.pollutionBaseDieselGeneratorPerSecond; + double[] mPollutionDieselGeneratorReleasedByTier = ConfigPollution.pollutionDieselGeneratorReleasedByTier; if (mPollutionDieselGeneratorReleasedByTier.length == GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier.length) { GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier = mPollutionDieselGeneratorReleasedByTier; @@ -642,18 +497,8 @@ public class GT_PreLoad { GT_FML_LOGGER .error("The Length of the Diesel Turbine Pollution Array Config must be the same as the Default"); } - GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond = tMainConfig - .get( - "Pollution", - "PollutionBaseGasTurbineGenerator", - GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond) - .getInt(GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond); - double[] mPollutionGasTurbineReleasedByTier = tMainConfig - .get( - "Pollution", - "PollutionReleasedByTierGasTurbineGenerator", - GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier) - .getDoubleList(); + GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond = ConfigPollution.pollutionBaseGasTurbinePerSecond; + double[] mPollutionGasTurbineReleasedByTier = ConfigPollution.pollutionGasTurbineReleasedByTier; if (mPollutionGasTurbineReleasedByTier.length == GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier.length) { GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier = mPollutionGasTurbineReleasedByTier; @@ -661,223 +506,107 @@ public class GT_PreLoad { GT_FML_LOGGER.error("The Length of the Gas Turbine Pollution Array Config must be the same as the Default"); } - GT_Mod.gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid"); - GT_Mod.gregtechproxy.enableUndergroundGravelGen = GregTech_API.sWorldgenFile - .get("general", "enableUndergroundGravelGen", GT_Mod.gregtechproxy.enableUndergroundGravelGen); - GT_Mod.gregtechproxy.enableUndergroundDirtGen = GregTech_API.sWorldgenFile - .get("general", "enableUndergroundDirtGen", GT_Mod.gregtechproxy.enableUndergroundDirtGen); - GT_Mod.gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true) - .getBoolean(true); - if (GT_Mod.gregtechproxy.mEnableCleanroom) GT_MetaTileEntity_Cleanroom.loadConfig(tMainConfig); - GT_Mod.gregtechproxy.mLowGravProcessing = GalacticraftCore.isModLoaded() - && tMainConfig.get("general", "LowGravProcessing", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mUseGreatlyShrukenReplacementList = tMainConfig - .get("general", "GTNH Optimised Material Loading", true) - .getBoolean(true); - Calendar now = Calendar.getInstance(); - GT_Mod.gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get( - ConfigCategories.general, - "AprilFool", - now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1); - GT_Mod.gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true) - .getBoolean(true); - GT_Mod.gregtechproxy.mAMHInteraction = tMainConfig.get("general", "AllowAutoMaintenanceHatchInteraction", false) - .getBoolean(false); - GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true); - GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false); - GregTech_API.mEUtoRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "100EUtoRF", 360); - 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 = EnderIO.isModLoaded(); - GT_Mod.gregtechproxy.mForceFreeFace = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "forceFreeFace", true); - GT_Mod.gregtechproxy.mBrickedBlastFurnace = tMainConfig.get("general", "BrickedBlastFurnace", true) - .getBoolean(true); - - GT_Mod.gregtechproxy.mMixedOreOnlyYieldsTwoThirdsOfPureOre = tMainConfig - .get("general", "MixedOreOnlyYieldsTwoThirdsOfPureOre", false) - .getBoolean(false); - GT_Mod.gregtechproxy.mRichOreYieldMultiplier = tMainConfig.get("general", "RichOreYieldMultiplier", true) - .getBoolean(false); - GT_Mod.gregtechproxy.mNetherOreYieldMultiplier = tMainConfig.get("general", "NetherOreYieldMultiplier", true) - .getBoolean(false); - GT_Mod.gregtechproxy.mEndOreYieldMultiplier = tMainConfig.get("general", "EndOreYieldMultiplier", true) - .getBoolean(false); - GT_Mod.gregtechproxy.enableBlackGraniteOres = GregTech_API.sWorldgenFile - .get("general", "enableBlackGraniteOres", GT_Mod.gregtechproxy.enableBlackGraniteOres); - GT_Mod.gregtechproxy.enableRedGraniteOres = GregTech_API.sWorldgenFile - .get("general", "enableRedGraniteOres", GT_Mod.gregtechproxy.enableRedGraniteOres); - GT_Mod.gregtechproxy.enableMarbleOres = GregTech_API.sWorldgenFile - .get("general", "enableMarbleOres", GT_Mod.gregtechproxy.enableMarbleOres); - GT_Mod.gregtechproxy.enableBasaltOres = GregTech_API.sWorldgenFile - .get("general", "enableBasaltOres", GT_Mod.gregtechproxy.enableBasaltOres); - GT_Mod.gregtechproxy.gt6Pipe = tMainConfig.get("general", "GT6StyledPipesConnection", true) - .getBoolean(true); - GT_Mod.gregtechproxy.gt6Cable = tMainConfig.get("general", "GT6StyledWiresConnection", true) - .getBoolean(true); - GT_Mod.gregtechproxy.ic2EnergySourceCompat = tMainConfig.get("general", "Ic2EnergySourceCompat", true) - .getBoolean(true); - GT_Mod.gregtechproxy.costlyCableConnection = tMainConfig - .get("general", "CableConnectionRequiresSolderingMaterial", false) - .getBoolean(false); - GT_Mod.gregtechproxy.crashOnNullRecipeInput = tMainConfig.get("general", "crashOnNullRecipeInput", false) - .getBoolean(false); - GT_LanguageManager.i18nPlaceholder = tMainConfig - .get("general", "EnablePlaceholderForMaterialNamesInLangFile", true) - .getBoolean(true); - GT_MetaTileEntity_LongDistancePipelineBase.minimalDistancePoints = tMainConfig - .get("general", "LongDistancePipelineMinimalDistancePoints", 64) - .getInt(64); - try { - String setting_string = tMainConfig.get( - "OreDropBehaviour", - "general", - "FortuneItem", - "Settings: \n'PerDimBlock': Sets the drop to the block variant of the ore block based on dimension, defaults to stone type, \n'UnifiedBlock': Sets the drop to the stone variant of the ore block, \n'Block': Sets the drop to the ore mined, \n'FortuneItem': Sets the drop to the new ore item and makes it affected by fortune, \n'Item': Sets the drop to the new ore item, \nDefaults to: 'FortuneItem'") - .getString(); - GT_Log.out.println("Trying to set it to: " + setting_string); - GT_Proxy.OreDropSystem setting = GT_Proxy.OreDropSystem.valueOf(setting_string); - GT_Mod.gregtechproxy.oreDropSystem = setting; + // cleanroom file + if (GT_Mod.gregtechproxy.mEnableCleanroom) GT_MetaTileEntity_Cleanroom.loadConfig(GT_Config.cleanroomFile); + + // underground fluids file + GT_Mod.gregtechproxy.mUndergroundOil.getConfig(GT_Config.undergroundFluidsFile, "undergroundfluid"); + + // Worldgeneration.cfg + GT_Mod.gregtechproxy.enableUndergroundGravelGen = gregtech.common.config.worldgen.ConfigGeneral.generateUndergroundGravelGen; + GT_Mod.gregtechproxy.enableUndergroundDirtGen = gregtech.common.config.worldgen.ConfigGeneral.generateUndergroundDirtGen; + GT_Mod.gregtechproxy.enableBlackGraniteOres = gregtech.common.config.worldgen.ConfigGeneral.generateBlackGraniteOres; + GT_Mod.gregtechproxy.enableRedGraniteOres = gregtech.common.config.worldgen.ConfigGeneral.generateBlackGraniteOres; + GT_Mod.gregtechproxy.enableMarbleOres = gregtech.common.config.worldgen.ConfigGeneral.generateMarbleOres; + GT_Mod.gregtechproxy.enableBasaltOres = gregtech.common.config.worldgen.ConfigGeneral.generateBasaltOres; + + // OverpoweredStuff.cfg + GregTech_API.mOutputRF = gregtech.common.config.opstuff.ConfigGeneral.outputRF; + GregTech_API.mInputRF = gregtech.common.config.opstuff.ConfigGeneral.inputRF; + GregTech_API.mEUtoRF = gregtech.common.config.opstuff.ConfigGeneral.howMuchRFWith100EUInInput; + GregTech_API.mRFtoEU = gregtech.common.config.opstuff.ConfigGeneral.howMuchEUWith100RFInInput; + GregTech_API.mRFExplosions = gregtech.common.config.opstuff.ConfigGeneral.RFExplosions; + + // MachineStats.cfg + GT_Mod.gregtechproxy.mForceFreeFace = gregtech.common.config.machinestats.ConfigMachines.forceFreeFace; + // ore_drop_behavior + try { + GT_Log.out.println("Trying to set it to: " + ConfigOreDropBehavior.setting); + GT_Mod.gregtechproxy.oreDropSystem = GT_Proxy.OreDropSystem.valueOf(ConfigOreDropBehavior.setting);; } catch (IllegalArgumentException e) { GT_Log.err.println(e); GT_Mod.gregtechproxy.oreDropSystem = GT_Proxy.OreDropSystem.FortuneItem; } - GT_Mod.gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties - .get("havestLevel", "activateHarvestLevelChange", false); // TODO CHECK - if (GT_Mod.gregtechproxy.mChangeHarvestLevels) { - GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties - .get("havestLevel", "graniteHarvestLevel", 3); - GT_Mod.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 < GT_Mod.gregtechproxy.mHarvestLevel.length - && tMaterial.mMetaItemSubID >= 0) - .forEach( - tMaterial -> GT_Mod.gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties - .get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality)); - } - - if (tMainConfig.get("general", "hardermobspawners", true) - .getBoolean(true)) { - Blocks.mob_spawner.setHardness(500.0F) - .setResistance(6000000.0F); - } - - GT_Mod.gregtechproxy.mUpgradeCount = Math.min( - 64, - Math.max( - 1, - tMainConfig.get("features", "UpgradeStacksize", 4) - .getInt())); + // features + GT_Mod.gregtechproxy.mUpgradeCount = Math.min(64, Math.max(1, ConfigFeatures.upgradeStackSize)); for (OrePrefixes tPrefix : OrePrefixes.values()) { if (tPrefix.mIsUsedForOreProcessing) { - tPrefix.mDefaultStackSize = ((byte) Math.min( - 64, - Math.max( - 1, - tMainConfig.get("features", "MaxOreStackSize", 64) - .getInt()))); + tPrefix.mDefaultStackSize = ((byte) Math.min(64, Math.max(1, ConfigFeatures.maxOreStackSize))); } else if (tPrefix == OrePrefixes.plank) { - tPrefix.mDefaultStackSize = ((byte) Math.min( - 64, - Math.max( - 16, - tMainConfig.get("features", "MaxPlankStackSize", 64) - .getInt()))); + tPrefix.mDefaultStackSize = ((byte) Math.min(64, Math.max(16, ConfigFeatures.maxPlankStackSize))); } else if ((tPrefix == OrePrefixes.wood) || (tPrefix == OrePrefixes.treeLeaves) || (tPrefix == OrePrefixes.treeSapling) || (tPrefix == OrePrefixes.log)) { - tPrefix.mDefaultStackSize = ((byte) Math.min( - 64, - Math.max( - 16, - tMainConfig.get("features", "MaxLogStackSize", 64) - .getInt()))); + tPrefix.mDefaultStackSize = ((byte) Math.min(64, Math.max(16, ConfigFeatures.maxLogStackSize))); } else if (tPrefix.mIsUsedForBlocks) { - tPrefix.mDefaultStackSize = ((byte) Math.min( - 64, - Math.max( - 16, - tMainConfig.get("features", "MaxOtherBlockStackSize", 64) - .getInt()))); + tPrefix.mDefaultStackSize = ((byte) Math + .min(64, Math.max(16, ConfigFeatures.maxOtherBlocksStackSize))); } } - GT_Values.mCTMEnabledBlock - .addAll( - Arrays - .asList( - tMainConfig - .get( - "general", - "ctm_block_whitelist", - new String[] { "team.chisel.block.BlockCarvable", - "team.chisel.block.BlockCarvableGlass" }) - .getStringList())); - GT_Values.mCTMDisabledBlock.addAll( - Arrays.asList( - tMainConfig.get("general", "ctm_block_blacklist", new String[] { "team.chisel.block.BlockRoadLine" }) - .getStringList())); - GT_RecipeBuilder.onConfigLoad(); } + public static void parseHex(Dyes dye, String hexString) { + dye.mRGBa[0] = Short.parseShort(hexString.substring(1, 3), 16); + dye.mRGBa[1] = Short.parseShort(hexString.substring(3, 5), 16); + dye.mRGBa[2] = Short.parseShort(hexString.substring(5), 16); + } + public static void loadClientConfig() { - final String sBDye0 = "ColorModulation."; 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.mOriginalRGBa[0])))); - tDye.mRGBa[1] = ((short) Math - .min(255, Math.max(0, GregTech_API.sClientDataFile.get(sBDye1, "G", tDye.mOriginalRGBa[1])))); - tDye.mRGBa[2] = ((short) Math - .min(255, Math.max(0, GregTech_API.sClientDataFile.get(sBDye1, "B", tDye.mOriginalRGBa[2])))); + .filter(dye -> (dye != Dyes._NULL) && (dye.mIndex < 0)) + .forEach(dye -> { + switch (dye.toString() + .toLowerCase()) { + case "cable_insulation" -> parseHex(dye, ConfigColorModulation.cableInsulation); + case "construction_foam" -> parseHex(dye, ConfigColorModulation.constructionFoam); + case "machine_metal" -> parseHex(dye, ConfigColorModulation.machineMetal); + default -> { + GT_FML_LOGGER.warn( + "unknown color modulation entry: " + dye + + ". Report this pls, as config is missing this entry being parsed in code."); + } + } }); - GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile - .get("render", "TileAmbientOcclusion", true); - GT_Mod.gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true); - GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile - .get("render", "RenderFlippedMachinesFlipped", true); - GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch = GregTech_API.sClientDataFile - .get("render", "RenderIndicatorsOnHatch", true); - GT_Mod.gregtechproxy.mRenderDirtParticles = GregTech_API.sClientDataFile - .get("render", "RenderDirtParticles", true); - GT_Mod.gregtechproxy.mRenderPollutionFog = GregTech_API.sClientDataFile - .get("render", "RenderPollutionFog", true); - GT_Mod.gregtechproxy.mRenderItemDurabilityBar = GregTech_API.sClientDataFile - .get("render", "RenderItemDurabilityBar", true); - GT_Mod.gregtechproxy.mRenderItemChargeBar = GregTech_API.sClientDataFile - .get("render", "RenderItemChargeBar", true); - GT_Mod.gregtechproxy.mUseBlockUpdateHandler = GregTech_API.sClientDataFile - .get("render", "UseBlockUpdateHandler", false); - - GT_Mod.gregtechproxy.mCoverTabsVisible = GregTech_API.sClientDataFile - .get("interface", "DisplayCoverTabs", true); - GT_Mod.gregtechproxy.mCoverTabsFlipped = GregTech_API.sClientDataFile.get("interface", "FlipCoverTabs", false); - GT_Mod.gregtechproxy.mTooltipVerbosity = GregTech_API.sClientDataFile.get("interface", "TooltipVerbosity", 2); - GT_Mod.gregtechproxy.mTooltipShiftVerbosity = GregTech_API.sClientDataFile - .get("interface", "TooltipShiftVerbosity", 3); - GT_Mod.gregtechproxy.mTitleTabStyle = GregTech_API.sClientDataFile.get("interface", "TitleTabStyle", 0); - - GT_Mod.gregtechproxy.mNEIRecipeSecondMode = GregTech_API.sClientDataFile.get("nei", "RecipeSecondMode", true); - GT_Mod.gregtechproxy.mNEIRecipeOwner = GregTech_API.sClientDataFile.get("nei", "RecipeOwner", false); - GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace = GregTech_API.sClientDataFile + GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = ConfigRender.renderTileAmbientOcclusion; + GT_Mod.gregtechproxy.mRenderGlowTextures = ConfigRender.renderGlowTextures; + GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped = ConfigRender.renderFlippedMachinesFlipped; + GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch = ConfigRender.renderIndicatorsOnHatch; + GT_Mod.gregtechproxy.mRenderDirtParticles = ConfigRender.renderDirtParticles; + GT_Mod.gregtechproxy.mRenderPollutionFog = ConfigRender.renderPollutionFog; + GT_Mod.gregtechproxy.mRenderItemDurabilityBar = ConfigRender.renderItemDurabilityBar; + GT_Mod.gregtechproxy.mRenderItemChargeBar = ConfigRender.renderItemChargeBar; + GT_Mod.gregtechproxy.mUseBlockUpdateHandler = ConfigRender.useBlockUpdateHandler; + + GT_Mod.gregtechproxy.mCoverTabsVisible = ConfigInterface.coverTabsVisible; + GT_Mod.gregtechproxy.mCoverTabsFlipped = ConfigInterface.coverTabsFlipped; + GT_Mod.gregtechproxy.mTooltipVerbosity = ConfigInterface.tooltipVerbosity; + GT_Mod.gregtechproxy.mTooltipShiftVerbosity = ConfigInterface.tooltipShiftVerbosity; + GT_Mod.gregtechproxy.mTitleTabStyle = ConfigInterface.titleTabStyle; + + GT_Mod.gregtechproxy.mNEIRecipeSecondMode = GregTech_API.NEIClientFIle.get("nei", "RecipeSecondMode", true); + GT_Mod.gregtechproxy.mNEIRecipeOwner = GregTech_API.NEIClientFIle.get("nei", "RecipeOwner", false); + GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace = GregTech_API.NEIClientFIle .get("nei", "RecipeOwnerStackTrace", false); - GT_Mod.gregtechproxy.mNEIOriginalVoltage = GregTech_API.sClientDataFile.get("nei", "OriginalVoltage", false); + GT_Mod.gregtechproxy.mNEIOriginalVoltage = GregTech_API.NEIClientFIle.get("nei", "OriginalVoltage", false); GT_Mod.gregtechproxy.recipeCategorySettings.clear(); for (RecipeCategory recipeCategory : findRecipeCategories()) { RecipeCategorySetting setting = RecipeCategorySetting.find( - GregTech_API.sClientDataFile.getWithValidValues( + GregTech_API.NEIClientFIle.getWithValidValues( "nei.recipe_categories", recipeCategory.unlocalizedName, RecipeCategorySetting.NAMES, @@ -886,15 +615,8 @@ public class GT_PreLoad { GT_Mod.gregtechproxy.recipeCategorySettings.put(recipeCategory, setting); } - GT_Mod.gregtechproxy.mWailaTransformerVoltageTier = GregTech_API.sClientDataFile - .get("waila", "WailaTransformerVoltageTier", true); - GT_Mod.gregtechproxy.wailaAverageNS = GregTech_API.sClientDataFile.get("waila", "WailaAverageNS", false); - - final String[] Circuits = GregTech_API.sClientDataFile.get("interface", "CircuitsOrder"); - GT_Mod.gregtechproxy.mCircuitsOrder.clear(); - for (int i = 0; i < Circuits.length; i++) { - GT_Mod.gregtechproxy.mCircuitsOrder.putIfAbsent(Circuits[i], i); - } + GT_Mod.gregtechproxy.mWailaTransformerVoltageTier = ConfigWaila.wailaTransformerVoltageTier; + GT_Mod.gregtechproxy.wailaAverageNS = ConfigWaila.wailaAverageNS; GT_Mod.gregtechproxy.reloadNEICache(); } diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java index 773109a818..90aea7b71a 100644 --- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java +++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java @@ -110,21 +110,7 @@ public class WorldGen_GT_Ore_Layer extends WorldGen_GT { this.mSecondaryMeta = aSecondary.getOreBlock(1); this.mBetweenMeta = aBetween.getOreBlock(1); this.mSporadicMeta = aSporadic.getOreBlock(1); - this.mRestrictBiome = HANDLER_GT.sCustomWorldgenFile - .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"); - // if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new - // IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does - // not exist"); - // if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new - // IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does - // not exist"); + this.mRestrictBiome = "None"; if (this.mEnabled) { sWeight += this.mWeight; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index e9046d229f..cc5f539a76 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -20,7 +20,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; import gregtech.common.GT_Pollution; import gtPlusPlus.core.item.general.ItemAirFilter; import gtPlusPlus.core.lib.CORE; @@ -33,8 +32,8 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch protected int SLOT_FILTER = 0; @Override - public void onConfigLoad(GT_Config aConfig) { - super.onConfigLoad(aConfig); + public void onConfigLoad() { + super.onConfigLoad(); try { int a1 = GT_Mod.gregtechproxy.mPollutionSmogLimit; if (a1 > 0) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index 7fc2b50f68..33dbfee6d4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -29,7 +29,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; @@ -172,7 +171,7 @@ public class GT_MetaTileEntity_TesseractGenerator extends GT_MetaTileEntity_Basi } @Override - public void onConfigLoad(final GT_Config aConfig) { + public void onConfigLoad() { int J = 4; TESSERACT_ENERGY_COST = 128 * J; TESSERACT_ENERGY_COST_DIMENSIONAL = 512 * J; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index 659f34e0d8..28b567e06c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -20,7 +20,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.PlayerUtils; @@ -136,7 +135,7 @@ public class GT_MetaTileEntity_TesseractTerminal extends GT_MetaTileEntity_Basic } @Override - public void onConfigLoad(final GT_Config aConfig) { + public void onConfigLoad() { sInterDimensionalTesseractAllowed = true; TESSERACT_ENERGY_COST = 512; TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 993b0e9035..bbb5ae9da4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -6,8 +6,6 @@ import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.ArrayUtils; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -29,13 +27,11 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi public GT_MetaTileEntity_SemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Requires semi-fluid Fuel", new ITexture[0]); - onConfigLoad(); } public GT_MetaTileEntity_SemiFluidGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); } @Override @@ -49,13 +45,6 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi return 16000; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "SemiFluidGenerator.efficiency.tier." + this.mTier, - 100 - (this.mTier * 5)); - } - @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_SemiFluidGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index e1f1c8a2e6..af235556c8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -7,8 +7,6 @@ import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.ArrayUtils; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.gui.modularui.GT_UIInfos; @@ -30,13 +28,13 @@ public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity public GregtechMetaTileEntityGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); - this.onConfigLoad(); + this.setEfficiency(); } public GregtechMetaTileEntityGeothermalGenerator(final String aName, final int aTier, final String[] aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - this.onConfigLoad(); + this.setEfficiency(); } @Override @@ -61,11 +59,8 @@ public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity return 5000 * this.mTier; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "ThermalGenerator.efficiency.tier." + this.mTier, - (100 - (this.mTier * 7))); + public void setEfficiency() { + this.mEfficiency = (100 - (this.mTier * 7)); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java index 45d4177709..5b1a45e16f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -4,8 +4,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -25,13 +23,12 @@ public class GregtechMetaTileEntityRocketFuelGenerator extends GregtechRocketFue public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels", new ITexture[0]); - this.onConfigLoad(); } public GregtechMetaTileEntityRocketFuelGenerator(final String aName, final int aTier, final String[] aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - this.onConfigLoad(); + this.mEfficiency = getEfficiency(); } @Override @@ -59,17 +56,9 @@ public class GregtechMetaTileEntityRocketFuelGenerator extends GregtechRocketFue return 32000; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, - "RocketEngine.efficiency.tier." + this.mTier, - 80 - (10 * (this.mTier - 4))); - } - @Override public int getEfficiency() { - int eff = 80 - (10 * (this.mTier - 4)); - return eff; + return 80 - (10 * (this.mTier - 4)); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java deleted file mode 100644 index 24770e9503..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_CombustionGenerator.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV; - -import static gregtech.api.enums.GT_Values.V; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.tileentities.generators.GT_MetaTileEntity_DieselGenerator; -import gtPlusPlus.core.lib.CORE; - -public class GT_MetaTileEntity_ULV_CombustionGenerator extends GT_MetaTileEntity_DieselGenerator { - - public GT_MetaTileEntity_ULV_CombustionGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_ULV_CombustionGenerator(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.addAll( - this.mDescriptionArray, - "Produces " + (this.getPollution() * 20) + " pollution/sec", - "Fuel Efficiency: " + this.getEfficiency() + "%", - CORE.GT_Tooltip.get()); - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU()); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ULV_CombustionGenerator( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "DieselGenerator.efficiency.tier." + this.mTier, 95); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java deleted file mode 100644 index 26429b1486..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/ULV/GT_MetaTileEntity_ULV_SteamTurbine.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators.ULV; - -import static gregtech.api.enums.GT_Values.V; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.common.tileentities.generators.GT_MetaTileEntity_SteamTurbine; - -public class GT_MetaTileEntity_ULV_SteamTurbine extends GT_MetaTileEntity_SteamTurbine { - - public GT_MetaTileEntity_ULV_SteamTurbine(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 0); - } - - public GT_MetaTileEntity_ULV_SteamTurbine(String aName, String[] aDescription, ITexture[][][] aTextures) { - super(aName, 0, aDescription, aTextures); - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[1] * 80L + getMinimumStoredEU()); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ULV_SteamTurbine(this.mName, this.mDescriptionArray, this.mTextures); - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + 1); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java index 7f2e7db51f..ee989d22ca 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java @@ -38,7 +38,6 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.enums.TAE; import gregtech.api.enums.TierEU; @@ -51,11 +50,11 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.util.GT_Config; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.common.config.machinestats.ConfigMassFabricator; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; @@ -145,14 +144,12 @@ public class GregtechMetaTileEntity_MassFabricator } @Override - public void onConfigLoad(final GT_Config aConfig) { - super.onConfigLoad(aConfig); - sDurationMultiplier = aConfig - .get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); - sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); - sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus); - sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA); - // Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus); + public void onConfigLoad() { + super.onConfigLoad(); + sDurationMultiplier = ConfigMassFabricator.durationMultiplier; + sUUAperUUM = ConfigMassFabricator.UUAPerUUM; + sUUASpeedBonus = ConfigMassFabricator.UUASpeedBonus; + sRequiresUUA = ConfigMassFabricator.requiresUUA; } public static boolean sInit = false; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java index 8501ebabb1..ceced6a78e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -1,22 +1,28 @@ package pers.gwyog.gtneioreplugin; -import java.io.File; - -import net.minecraftforge.common.config.Configuration; - -import cpw.mods.fml.common.event.FMLPreInitializationEvent; - +@com.gtnewhorizon.gtnhlib.config.Config( + modid = GTNEIOrePlugin.MODID, + category = "general", + filename = GTNEIOrePlugin.MODID) public class Config { - public final Configuration tConfig; + @com.gtnewhorizon.gtnhlib.config.Config.Comment("if true, generate both csv files.") + @com.gtnewhorizon.gtnhlib.config.Config.DefaultBoolean(false) + @com.gtnewhorizon.gtnhlib.config.Config.RequiresMcRestart + public static boolean printCsv; + + @com.gtnewhorizon.gtnhlib.config.Config.Comment("the name of the file you want for the ore sheet, it'll appear at the root of your instance.") + @com.gtnewhorizon.gtnhlib.config.Config.DefaultString("GTNH-Oresheet.csv") + @com.gtnewhorizon.gtnhlib.config.Config.RequiresMcRestart + public static String CSVName; - public Config(FMLPreInitializationEvent preinit, String cfgname) { - File tFile = new File(preinit.getModConfigurationDirectory(), cfgname); - tConfig = new Configuration(tFile); - tConfig.load(); - } + @com.gtnewhorizon.gtnhlib.config.Config.Comment("the name of the file you want for the small ore sheet, it'll appear at the root of your instance.") + @com.gtnewhorizon.gtnhlib.config.Config.DefaultString("GTNH-Small-Ores-Sheet.csv") + @com.gtnewhorizon.gtnhlib.config.Config.RequiresMcRestart + public static String CSVnameSmall; - public void save() { - if (tConfig.hasChanged()) tConfig.save(); - } + @com.gtnewhorizon.gtnhlib.config.Config.Comment("Maximum number of lines the dimension names tooltip can have before it wraps around.") + @com.gtnewhorizon.gtnhlib.config.Config.DefaultInt(11) + @com.gtnewhorizon.gtnhlib.config.Config.RequiresMcRestart + public static int maxTooltipLines; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index e277ba915c..7ae7b0bc1c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -1,11 +1,16 @@ package pers.gwyog.gtneioreplugin; +import java.io.File; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.gtnewhorizon.gtnhlib.config.ConfigException; +import com.gtnewhorizon.gtnhlib.config.ConfigurationManager; + import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -28,14 +33,19 @@ import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { + static { + try { + ConfigurationManager.registerConfig(Config.class); + } catch (ConfigException e) { + throw new RuntimeException(e); + } + } + public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; public static final String VERSION = GT_Version.VERSION; public static final Logger LOG = LogManager.getLogger(NAME); - public static boolean csv = false; - public static String CSVname; - public static String CSVnameSmall; - public static int maxTooltipLines = 11; + public static File instanceDir; public static final CreativeTabs creativeTab = new CreativeTabs(MODID) { @Override @@ -50,31 +60,8 @@ public class GTNEIOrePlugin { @EventHandler public void preinit(FMLPreInitializationEvent event) { - Config c = new Config(event, MODID + ".cfg"); - csv = c.tConfig.getBoolean( - "print csv", - "ALL", - false, - "print csv, you need apache commons collections to be injected in the minecraft jar."); - CSVname = c.tConfig.getString( - "CSV_name", - "ALL", - event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", - "rename the oresheet here, it will appear in /config"); - CSVnameSmall = c.tConfig.getString( - "CSV_name_for_Small_Ore_Sheet", - "ALL", - event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", - "rename the oresheet here, it will appear in /config"); - maxTooltipLines = c.tConfig.getInt( - "MaxToolTipLines", - "ALL", - 11, - 1, - Integer.MAX_VALUE, - "Maximum number of lines the dimension names tooltip can have before it wraps around."); - - c.save(); + instanceDir = event.getModConfigurationDirectory() + .getParentFile(); } @EventHandler @@ -89,7 +76,7 @@ public class GTNEIOrePlugin { GT5OreSmallHelper.init(); GT5UndergroundFluidHelper.init(); if (event.getSide() == Side.CLIENT) { - if (csv) { + if (Config.printCsv) { new CSVMaker().run(); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 1cf0157354..7e42f912a7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -131,7 +131,9 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { private String[] getDimNameArrayFromVeinName(String veinName) { OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(veinName); - String[] dims = DimensionHelper.parseDimNames(GT5OreSmallHelper.bufferedDims.get(oreSmall)); + String[] dims = GT5OreSmallHelper.bufferedDims.get(oreSmall) + .keySet() + .toArray(new String[0]); Arrays.sort( dims, Comparator.comparingInt( diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 0f3322a500..81aff90ba9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -135,7 +135,9 @@ public class PluginGT5VeinStat extends PluginGT5Base { private String[] getDimNameArrayFromVeinName(String veinName) { OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); - String[] dims = DimensionHelper.parseDimNames(GT5OreLayerHelper.bufferedDims.get(oreLayer)); + String[] dims = (GT5OreLayerHelper.bufferedDims.get(oreLayer) + .keySet() + .toArray(new String[0])); Arrays.sort( dims, Comparator.comparingInt( diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index 1a99b469af..61fdff46a2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -1,136 +1,60 @@ package pers.gwyog.gtneioreplugin.util; +import static pers.gwyog.gtneioreplugin.Config.CSVName; +import static pers.gwyog.gtneioreplugin.Config.CSVnameSmall; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.instanceDir; + import java.io.BufferedWriter; import java.nio.file.Files; -import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import com.opencsv.CSVWriter; -import com.opencsv.bean.ColumnPositionMappingStrategy; -import com.opencsv.bean.StatefulBeanToCsv; -import com.opencsv.bean.StatefulBeanToCsvBuilder; - -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; +// todo: yeet any opencsv usage. public class CSVMaker implements Runnable { - public CSVMaker() {} - - public static List<Oremix> Combsort(List<Oremix> list) { - try { - List<Oremix> list2 = new ArrayList<>(list.size()); - list2.addAll(list); - - int step = list2.size(); - boolean swapped; - do { - swapped = false; - if (step > 1) { - step = (int) (step / 1.3); - } - for (int i = 0; i < list2.size() - step; i++) { - if (list2.get(i) - .getOreName() - .substring(0, 3) - .compareTo( - (list2.get(i + step) - .getOreName() - .substring(0, 3))) - > 0) { - Oremix tmp = list2.get(i); - list2.set(i, list2.get(i + step)); - list2.set(i + step, tmp); - swapped = true; - } - } - } while (swapped || step > 1); - return list2; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - public void runSmallOres() { try { Iterator<Map.Entry<String, GT5OreSmallHelper.OreSmallWrapper>> it = GT5OreSmallHelper.mapOreSmallWrapper .entrySet() .iterator(); - List<Oremix> OreVeins = new ArrayList<>(); + List<SmallOre> SmallOreVeins = new ArrayList<>(); while (it.hasNext()) { - Oremix oremix = new Oremix(); + SmallOre oremix = new SmallOre(); Map.Entry<String, GT5OreSmallHelper.OreSmallWrapper> pair = it.next(); - String Dims = GT5OreSmallHelper.bufferedDims.get(pair.getValue()); GT5OreSmallHelper.OreSmallWrapper oreLayer = pair.getValue(); - oremix.setOreName(oreLayer.oreGenName.split("\\.")[2]); + + Map<String, Boolean> Dims = GT5OreSmallHelper.bufferedDims.get(oreLayer); + + oremix.setOreName(oreLayer.oreGenName); + oremix.setOreMeta(oreLayer.oreMeta); oremix.setHeight(oreLayer.worldGenHeightRange); - oremix.setDensity(oreLayer.amountPerChunk); - oremix.an = Dims.contains("An"); - oremix.as = Dims.contains("As"); - oremix.bc = Dims.contains("BC"); - oremix.be = Dims.contains("BE"); - oremix.bf = Dims.contains("BF"); - oremix.ca = Dims.contains("Ca"); - oremix.cb = Dims.contains("CA"); - oremix.ce = Dims.contains("Ce"); - oremix.dd = Dims.contains("DD"); - oremix.de = Dims.contains("De"); - oremix.ea = Dims.contains("EA"); - oremix.en = Dims.contains("En"); - oremix.eu = Dims.contains("Eu"); - oremix.ga = Dims.contains("Ga"); - oremix.ha = Dims.contains("Ha"); - oremix.ho = Dims.contains("Ho"); - oremix.io = Dims.contains("Io"); - oremix.kb = Dims.contains("KB"); - oremix.make = Dims.contains("MM"); - oremix.ma = Dims.contains("Ma"); - oremix.mb = Dims.contains("MB"); - oremix.me = Dims.contains("Me"); - oremix.mh = Dims.contains("Mh"); - oremix.mi = Dims.contains("Mi"); - oremix.mo = Dims.contains("Mo"); - oremix.np = Dims.contains("Np"); - oremix.ob = Dims.contains("Ob"); - oremix.ph = Dims.contains("Ph"); - oremix.pl = Dims.contains("Pl"); - oremix.pr = Dims.contains("Pr"); - oremix.se = Dims.contains("Se"); - oremix.tcetie = Dims.contains("TE"); - oremix.tf = Dims.contains("TF"); - oremix.ti = Dims.contains("Ti"); - oremix.tr = Dims.contains("Tr"); - oremix.vb = Dims.contains("VB"); - oremix.ve = Dims.contains("Ve"); - oremix.setOverworld(Dims.contains("Ow")); - oremix.setNether(Dims.contains("Ne")); - oremix.setEnd(Dims.contains("EN")); - OreVeins.add(oremix); + oremix.setAmount(oreLayer.amountPerChunk); + oremix.setDims(Dims); + + SmallOreVeins.add(oremix); - System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); // avoids a ConcurrentModificationException } - BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); - ColumnPositionMappingStrategy<Oremix> strat = new ColumnPositionMappingStrategy<>(); - strat.setType(Oremix.class); - String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie,an,ho,np,mh,mb,se" - .split("\\,"); - strat.setColumnMapping(columns); - StatefulBeanToCsv<Oremix> beanToCsv = new StatefulBeanToCsvBuilder<Oremix>(one) - .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) - .withMappingStrategy(strat) - .build(); - List<Oremix> towrite = Combsort(OreVeins); - one.write( - "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E,Anubis,Horus,Neper,Maahes,Mehen Belt,Seth"); + + BufferedWriter one = Files.newBufferedWriter( + instanceDir.toPath() + .resolve(CSVnameSmall)); + Collections.sort(SmallOreVeins); + + // header first + one.write(SmallOre.getCsvHeader()); one.newLine(); - beanToCsv.write(towrite); + for (SmallOre ore : SmallOreVeins) { + one.write(ore.getCsvEntry()); + one.newLine(); + } one.flush(); one.close(); } catch (Exception e) { @@ -153,84 +77,41 @@ public class CSVMaker implements Runnable { Oremix oremix = new Oremix(); Map.Entry<String, OreLayerWrapper> pair = it.next(); - String Dims = GT5OreLayerHelper.bufferedDims.get(pair.getValue()); + Map<String, Boolean> Dims = GT5OreLayerHelper.bufferedDims.get(pair.getValue()); OreLayerWrapper oreLayer = pair.getValue(); - oremix.setOreName(oreLayer.veinName.split("\\.")[2]); + oremix.setOreMixName(oreLayer.veinName); oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); oremix.setInbetween(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[2])); - oremix.setAround(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[3])); + oremix.setSporadic(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[3])); oremix.setSize(oreLayer.size); oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.density); oremix.setWeight(oreLayer.randomWeight); - oremix.setMix( + oremix.setOreMixIDs( Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); - oremix.an = Dims.contains("An"); - oremix.as = Dims.contains("As"); - oremix.bc = Dims.contains("BC"); - oremix.be = Dims.contains("BE"); - oremix.bf = Dims.contains("BF"); - oremix.ca = Dims.contains("Ca"); - oremix.cb = Dims.contains("CA"); - oremix.ce = Dims.contains("Ce"); - oremix.dd = Dims.contains("DD"); - oremix.de = Dims.contains("De"); - oremix.ea = Dims.contains("EA"); - oremix.en = Dims.contains("En"); - oremix.eu = Dims.contains("Eu"); - oremix.ga = Dims.contains("Ga"); - oremix.ha = Dims.contains("Ha"); - oremix.ho = Dims.contains("Ho"); - oremix.io = Dims.contains("Io"); - oremix.kb = Dims.contains("KB"); - oremix.make = Dims.contains("MM"); - oremix.ma = Dims.contains("Ma"); - oremix.mb = Dims.contains("MB"); - oremix.me = Dims.contains("Me"); - oremix.mh = Dims.contains("Mh"); - oremix.mi = Dims.contains("Mi"); - oremix.mo = Dims.contains("Mo"); - oremix.np = Dims.contains("Np"); - oremix.ob = Dims.contains("Ob"); - oremix.ph = Dims.contains("Ph"); - oremix.pl = Dims.contains("Pl"); - oremix.pr = Dims.contains("Pr"); - oremix.se = Dims.contains("Se"); - oremix.tcetie = Dims.contains("TE"); - oremix.tf = Dims.contains("TF"); - oremix.ti = Dims.contains("Ti"); - oremix.tr = Dims.contains("Tr"); - oremix.vb = Dims.contains("VB"); - oremix.ve = Dims.contains("Ve"); - oremix.setOverworld(Dims.contains("Ow")); - oremix.setNether(Dims.contains("Ne")); - oremix.setEnd(Dims.contains("EN")); + oremix.setDims(Dims); OreVeins.add(oremix); - System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); // avoids a ConcurrentModificationException } - BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); - ColumnPositionMappingStrategy<Oremix> strat = new ColumnPositionMappingStrategy<>(); - strat.setType(Oremix.class); - String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie,an,ho,np,mh,mb,se" - .split("\\,"); - strat.setColumnMapping(columns); - StatefulBeanToCsv<Oremix> beanToCsv = new StatefulBeanToCsvBuilder<Oremix>(one) - .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) - .withMappingStrategy(strat) - .build(); - List<Oremix> towrite = Combsort(OreVeins); - one.write( - "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E,Anubis,Horus,Neper,Maahes,Mehen Belt,Seth"); + BufferedWriter one = Files.newBufferedWriter( + instanceDir.toPath() + .resolve(CSVName)); + Collections.sort(OreVeins); + + // header first + one.write(Oremix.getCsvHeader()); one.newLine(); - beanToCsv.write(towrite); + for (Oremix ore : OreVeins) { + one.write(ore.getCsvEntry()); + one.newLine(); + } one.flush(); one.close(); } catch (Exception e) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index e416713208..db7201323b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -1,18 +1,59 @@ package pers.gwyog.gtneioreplugin.util; -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ANUBIS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ASTEROIDS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.BARNARDC; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.BARNARDE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.BARNARDF; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.CALLISTO; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.CENTAURIA; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.CERES; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.DEEPDARK; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.DEIMOS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ENCELADUS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ENDASTEROIDS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.EUROPA; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.GANYMEDE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.HAUMEA; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.HORUS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.IO; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.KUIPERBELT; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MAAHES; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MAKEMAKE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MARS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MEHENBELT; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MERCURY; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MIRANDA; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.MOON; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.NEPER; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.OBERON; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.PHOBOS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.PLUTO; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.PROTEUS; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ROSS128B; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.ROSS128BA; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.SETH; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.TCETIE; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.TITAN; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.TRITON; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.VEGAB; +import static bloodasp.galacticgreg.api.enums.DimensionDef.DimNames.VENUS; +import static pers.gwyog.gtneioreplugin.Config.maxTooltipLines; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Map; import net.minecraft.util.StatCollector; +import gregtech.common.OreMixBuilder; + public class DimensionHelper { public static final String[] DimName = { // Non GC dimensions in progression order instead of alphabetical - "Overworld", "Nether", "Twilight", "TheEnd", "Vanilla_EndAsteroids", "EndAsteroid", + "Overworld", "Nether", "Twilight", "TheEnd", "EndAsteroid", // T1 "GalacticraftCore_Moon", // T2 @@ -42,8 +83,7 @@ public class DimensionHelper { n -> n.replaceAll("GalacticraftCore_", "") .replaceAll("GalacticraftMars_", "") .replaceAll("GalaxySpace_", "") - .replaceAll("GalacticraftAmunRa_", "") - .replaceAll("Vanilla_", "Vanilla ")) + .replaceAll("GalacticraftAmunRa_", "")) .toArray(String[]::new); public static final String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except @@ -54,7 +94,6 @@ public class DimensionHelper { "Ne", // Nether "TF", // Twilight "ED", // TheEnd because En = Encalus - "VA", // Vanilla_EndAsteroids "EA", // EndAsteroid // T1 "Mo", // GalacticraftCore_Moon @@ -155,6 +194,157 @@ public class DimensionHelper { return dims; } + public static Map<String, Boolean> getDims(GT5OreLayerHelper.OreLayerWrapper oreLayer) { + Map<String, Boolean> enabledDims = new HashMap<>(); + Map<String, Boolean> origNames = oreLayer.allowedDimWithOrigNames; + + for (String dimName : origNames.keySet()) { + String abbr = getDimAbbreviatedName(dimName); + if (!origNames.getOrDefault(dimName, false)) { + continue; + } + enabledDims.put(abbr, true); + } + return enabledDims; + } + + public static Map<String, Boolean> getDims(GT5OreSmallHelper.OreSmallWrapper ore) { + Map<String, Boolean> enabledDims = new HashMap<>(); + Map<String, Boolean> origNames = ore.allowedDimWithOrigNames; + + for (String dimName : origNames.keySet()) { + String abbr = getDimAbbreviatedName(dimName); + if (!origNames.getOrDefault(dimName, false)) { + continue; + } + enabledDims.put(abbr, true); + } + return enabledDims; + } + + public static String getDimAbbreviatedName(String dimName) { + String abbreviatedName; + switch (dimName) { + case (OreMixBuilder.OW) -> abbreviatedName = "Ow"; // Overworld + case OreMixBuilder.NETHER -> abbreviatedName = "Ne"; // Nether + case OreMixBuilder.TWILIGHT_FOREST -> abbreviatedName = "TF"; // Twilight + case OreMixBuilder.THE_END -> abbreviatedName = "ED"; // TheEnd because En = Encalus + case ENDASTEROIDS -> abbreviatedName = "EA"; // EndAsteroid + // T1 + case MOON -> abbreviatedName = "Mo"; // GalacticraftCore_Moon + // T2 + case DEIMOS -> abbreviatedName = "De"; // GalaxySpace_Deimos + case MARS -> abbreviatedName = "Ma"; // GalacticraftMars_Mars + case PHOBOS -> abbreviatedName = "Ph"; // GalaxySpace_Phobos + // T3 + case ASTEROIDS -> abbreviatedName = "As"; // GalacticraftMars_Asteroids + case CALLISTO -> abbreviatedName = "Ca"; // GalaxySpace_Callisto + case CERES -> abbreviatedName = "Ce"; // GalaxySpace_Ceres + case EUROPA -> abbreviatedName = "Eu"; // GalaxySpace_Europa + case GANYMEDE -> abbreviatedName = "Ga"; // GalaxySpace_Ganymede + case ROSS128B -> abbreviatedName = "Rb"; // Ross128b + // T4 + case IO -> abbreviatedName = "Io"; // GalaxySpace_Io + case MERCURY -> abbreviatedName = "Me"; // GalaxySpace_Mercury + case VENUS -> abbreviatedName = "Ve"; // GalaxySpace_Venus + // T5 + case ENCELADUS -> abbreviatedName = "En"; // GalaxySpace_Enceladus + case MIRANDA -> abbreviatedName = "Mi"; // GalaxySpace_Miranda + case OBERON -> abbreviatedName = "Ob"; // GalaxySpace_Oberon + case TITAN -> abbreviatedName = "Ti"; // GalaxySpace_Titan + case ROSS128BA -> abbreviatedName = "Ra"; // Ross128ba + // T6 + case PROTEUS -> abbreviatedName = "Pr"; // GalaxySpace_Proteus + case TRITON -> abbreviatedName = "Tr"; // GalaxySpace_Triton + // T7 + case HAUMEA -> abbreviatedName = "Ha"; // GalaxySpace_Haumea + case KUIPERBELT -> abbreviatedName = "KB"; // GalaxySpace_Kuiperbelt + case MAKEMAKE -> abbreviatedName = "MM"; // GalaxySpace_MakeMake + case PLUTO -> abbreviatedName = "Pl"; // GalaxySpace_Pluto + // T8 + case BARNARDC -> abbreviatedName = "BC"; // GalaxySpace_BarnardC + case BARNARDE -> abbreviatedName = "BE"; // GalaxySpace_BarnardE + case BARNARDF -> abbreviatedName = "BF"; // GalaxySpace_BarnardF + case CENTAURIA -> abbreviatedName = "CB"; // GalaxySpace_CentauriA is actually α Centauri Bb + case TCETIE -> abbreviatedName = "TE"; // GalaxySpace_TcetiE + case VEGAB -> abbreviatedName = "VB"; // GalaxySpace_VegaB + // T9 + case ANUBIS -> abbreviatedName = "An"; // GalacticraftAmunRa_Anubis + case HORUS -> abbreviatedName = "Ho"; // GalacticraftAmunRa_Horus + case MAAHES -> abbreviatedName = "Mh"; // GalacticraftAmunRa_Maahes + case MEHENBELT -> abbreviatedName = "MB"; // GalacticraftAmunRa_MehenBelt + case NEPER -> abbreviatedName = "Np"; // GalacticraftAmunRa_Neper + case SETH -> abbreviatedName = "Se"; // GalacticraftAmunRa_Seth + // T10 + case DEEPDARK -> abbreviatedName = "DD"; // Underdark + default -> { + throw new IllegalStateException("String: " + dimName + " has no abbredged name!"); + } + } + return abbreviatedName; + } + + public static String getFullName(String dimName) { + + return switch (dimName) { + case "Ow" -> (OreMixBuilder.OW); // Overworld + case "Ne" -> OreMixBuilder.NETHER; // Nether + case "TF" -> OreMixBuilder.TWILIGHT_FOREST; // Twilight + case "ED" -> OreMixBuilder.THE_END; // TheEnd because En = Encalus + case "EA" -> ENDASTEROIDS; // EndAsteroid + // T1 + case "Mo" -> MOON; // GalacticraftCore_Moon + // T2 + case "De" -> DEIMOS; // GalaxySpace_Deimos + case "Ma" -> MARS; // GalacticraftMars_Mars + case "Ph" -> PHOBOS; // GalaxySpace_Phobos + // T3 + case "As" -> ASTEROIDS; // GalacticraftMars_Asteroids + case "Ca" -> CALLISTO; // GalaxySpace_Callisto + case "Ce" -> CERES; // GalaxySpace_Ceres + case "Eu" -> EUROPA; // GalaxySpace_Europa + case "Ga" -> GANYMEDE; // GalaxySpace_Ganymede + case "Rb" -> ROSS128B; // Ross128b + // T4 + case "Io" -> IO; // GalaxySpace_Io + case "Me" -> MERCURY; // GalaxySpace_Mercury + case "Ve" -> VENUS; // GalaxySpace_Venus + // T5 + case "En" -> ENCELADUS; // GalaxySpace_Enceladus + case "Mi" -> MIRANDA; // GalaxySpace_Miranda + case "Ob" -> OBERON; // GalaxySpace_Oberon + case "Ti" -> TITAN; // GalaxySpace_Titan + case "Ra" -> ROSS128BA; // Ross128ba + // T6 + case "Pr" -> PROTEUS; // GalaxySpace_Proteus + case "Tr" -> TRITON; // GalaxySpace_Triton + // T7 + case "Ha" -> HAUMEA; // GalaxySpace_Haumea + case "KB" -> KUIPERBELT; // GalaxySpace_Kuiperbelt + case "MM" -> MAKEMAKE; // GalaxySpace_MakeMake + case "Pl" -> PLUTO; // GalaxySpace_Pluto + // T8 + case "BC" -> BARNARDC; // GalaxySpace_BarnardC + case "BE" -> BARNARDE; // GalaxySpace_BarnardE + case "BF" -> BARNARDF; // GalaxySpace_BarnardF + case "CB" -> CENTAURIA; // GalaxySpace_CentauriA is actually α Centauri Bb + case "TE" -> TCETIE; // GalaxySpace_TcetiE + case "VB" -> VEGAB; // GalaxySpace_VegaB + // T9 + case "An" -> ANUBIS; // GalacticraftAmunRa_Anubis + case "Ho" -> HORUS; // GalacticraftAmunRa_Horus + case "Mh" -> MAAHES; // GalacticraftAmunRa_Maahes + case "MB" -> MEHENBELT; // GalacticraftAmunRa_MehenBelt + case "Np" -> NEPER; // GalacticraftAmunRa_Neper + case "Se" -> SETH; // GalacticraftAmunRa_Seth + // T10 + case "DD" -> DEEPDARK; // Underdark + default -> { + throw new IllegalStateException("String: " + dimName + " has no abbredged name!"); + } + }; + } + public static List<String> convertCondensedStringToToolTip(String line) { return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java deleted file mode 100644 index 7394edea58..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ /dev/null @@ -1,225 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -import cpw.mods.fml.common.FMLLog; -import gregtech.api.GregTech_API; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class GT5CFGHelper { - - // Do NOT ever put a comma in this or it will break split calls later in the code. Bad, but it is what it is. - public static final String oreVeinNotInAnyDim = "Not available in any Galactic Dim!"; - - private static final File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); - - public static String GT5CFGSmallOres(String Veinname) { - List<String> raw = new ArrayList<>(); - List<String> rawbools = new ArrayList<>(); - String st; - Configuration c = new Configuration(F); - ConfigCategory configCategory = c.getCategory("worldgen." + Veinname); - for (Property p : configCategory.getOrderedValues()) { - if (p.isBooleanValue() && p.getBoolean()) { - raw.add(p.getName() + "=" + p.getBoolean()); - } - } - if (!raw.isEmpty()) { - for (String s : raw) { - for (int j = 0; j < DimensionHelper.DimName.length; j++) { - if (s.contains(DimensionHelper.DimName[j])) { - rawbools.add(s); - } - } - } - } else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); - - StringBuilder ret = new StringBuilder(" "); - - HashSet<String> rawboolsset = new HashSet<>(); - if (!rawbools.isEmpty()) { - for (String rawbool : rawbools) { - st = rawbool.replace("B:", "") - .replace("_true", "") - .replace("_false", "") - .replaceAll(" ", "") - .replaceAll("\"", ""); - rawboolsset.add(st); - } - rawbools = new ArrayList<>(rawboolsset); - for (int j = 0; j < DimensionHelper.DimName.length; j++) { - for (String rawbool : rawbools) { - st = rawbool; - if (st.contains(DimensionHelper.DimName[j]) && st.contains("=true")) { - ret.append(DimensionHelper.DimNameDisplayed[j]) - .append(","); - } - } - } - } - ret = new StringBuilder( - ret.toString() - .trim()); - if (ret.toString() - .equals("") - || ret.toString() - .equals(" ")) { - ret = new StringBuilder(oreVeinNotInAnyDim); - } - return ret.toString(); - } - - public static String GT5CFG(String Veinname) { - // FMLLog.info(Veinname); - if (F == null) { - FMLLog.bigWarning("GT_CFG_NOT_found[0]"); - return "Error while Loading CFG"; - } else try { - int buffer = (int) (0.1 * Runtime.getRuntime() - .freeMemory()); - if (buffer > F.length()) { - buffer = (int) F.length(); - } - // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available - // FMLLog.info("GT_CFG_found[0]"); - FileReader in = new FileReader(F); - // FMLLog.info("FileReader created"); - BufferedReader reader = new BufferedReader(in, buffer); - // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st; - List<String> raw = new ArrayList<>(); - List<String> rawbools = new ArrayList<>(); - Boolean[] found = new Boolean[2]; - found[0] = false; - found[1] = false; - - do { - // FMLLog.info("erste"); - // read until reached eof or mix { - st = reader.readLine(); - // FMLLog.info("st: "+st); - if (st != null && st.trim() - .equals("mix {")) { - while (!(st == null || found[0])) { - // FMLLog.info("zweite"); - st = reader.readLine(); - // read until reached eof or Veinname { - // FMLLog.info("MIXst: "+st); - if (st != null && st.trim() - .equals(Veinname + " {")) { - // FMLLog.info("VEINNAMEst: "+st); - while (!(st == null || found[0])) { - st = reader.readLine(); - if ((!(st == null)) && st.trim() - .equals("}")) { - found[0] = true; - } - // FMLLog.info("dritte"); - // add everything below Veinname { undtil } to raw - raw.add(st); - } - } - } - } - - if (st != null && st.trim() - .equals("dimensions {")) { - while (!(st == null || found[1])) { - // FMLLog.info("zweite"); - st = reader.readLine(); - if (st != null && (st.trim() - .equals("mix {"))) { - while (!(st == null || found[1])) { - // FMLLog.info("dritte"); - st = reader.readLine(); - // read until reached eof or Veinname { - // FMLLog.info("MIXst: "+st); - if (st != null && st.trim() - .equals(Veinname + " {")) { - // FMLLog.info("VEINNAMEst: "+st); - while (!(st == null || found[1])) { - st = reader.readLine(); - if ((!(st == null)) && st.trim() - .equals("}")) { - found[1] = true; - } - // FMLLog.info("vierte"); - // add everything below Veinname { undtil } to raw - raw.add(st); - } - } - } - } - } - } - } while (st != null); - reader.close(); // not needed anymore - - if (!raw.isEmpty()) { - for (String s : raw) { - // filter needed booleans from raw - /// FMLLog.info("raw contains"+raw.get(i)); - for (int j = 0; j < DimensionHelper.DimName.length; j++) { - if (s.contains(DimensionHelper.DimName[j])) { - rawbools.add(s); - } - } - // FMLLog.info("rawbools: "+rawbools.get(i)); - } - } else { - GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); - } - - StringBuilder ret = new StringBuilder(" "); - - HashSet<String> rawboolsset = new HashSet<>(); - if (!rawbools.isEmpty()) { - // remove dublicates - for (String rawbool : rawbools) { - st = rawbool.replace("B:", "") - .replace("_true", "") - .replace("_false", "") - .replaceAll(" ", "") - .replaceAll("\"", ""); - rawboolsset.add(st); - } - rawbools = new ArrayList<>(rawboolsset); - // filter for dims set to true - for (int j = 0; j < DimensionHelper.DimName.length; j++) { - // FMLLog.info("RawBools:"+st); - for (String rawbool : rawbools) { - st = rawbool; - if (st.contains(DimensionHelper.DimName[j]) && st.contains("=true")) { - ret.append(DimensionHelper.DimNameDisplayed[j]) - .append(","); - } - } - } - } - ret = new StringBuilder( - ret.toString() - .trim()); - // FMLLog.info("ret:"+ret); - if (ret.toString() - .equals("") - || ret.toString() - .equals(" ")) { - ret = new StringBuilder(oreVeinNotInAnyDim); - } - return ret.toString(); - } catch (IOException e) { - e.printStackTrace(); - return "Error while Loading CFG"; - } - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index ccb8c88e75..246ace7fda 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -1,20 +1,20 @@ package pers.gwyog.gtneioreplugin.util; -import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; +import static pers.gwyog.gtneioreplugin.util.DimensionHelper.getDims; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Map; import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import gregtech.api.enums.OreMixes; +import gregtech.common.OreMixBuilder; public class GT5OreLayerHelper { @@ -39,14 +39,14 @@ public class GT5OreLayerHelper { public static final Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; public static final Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static final HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<>(); - public static final HashMap<OreLayerWrapper, String> bufferedDims = new HashMap<>(); + public static final HashMap<OreLayerWrapper, Map<String, Boolean>> bufferedDims = new HashMap<>(); public static final HashMap<String, NormalOreDimensionWrapper> dimToOreWrapper = new HashMap<>(); public static void init() { Arrays.fill(weightPerWorld, 0); Arrays.fill(DimIDs, 0); - for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) - mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); + for (OreMixes mix : OreMixes.values()) + mapOreLayerWrapper.put(mix.oreMixBuilder.oreMixName, new OreLayerWrapper(mix.oreMixBuilder)); for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { bufferedDims.put(layer, getDims(layer)); } @@ -55,17 +55,12 @@ public class GT5OreLayerHelper { // Get dims as "Ow,Ne,Ma" etc. bufferedDims.forEach((veinInfo, dims) -> { - if (dims.equals(oreVeinNotInAnyDim)) { - return; - } - for (String dim : dims.split(",")) { - if (!dim.isEmpty()) { - NormalOreDimensionWrapper dimensionOres = dimToOreWrapper - .getOrDefault(dim, new NormalOreDimensionWrapper()); - dimensionOres.internalDimOreList.add(veinInfo); - dimToOreWrapper.put(dim, dimensionOres); - } + for (String dim : dims.keySet()) { + NormalOreDimensionWrapper dimensionOres = dimToOreWrapper + .getOrDefault(dim, new NormalOreDimensionWrapper()); + dimensionOres.internalDimOreList.add(veinInfo); + dimToOreWrapper.put(dim, dimensionOres); } // Calculate probabilities for each dim. @@ -77,48 +72,36 @@ public class GT5OreLayerHelper { // --- End of handling for dimToOreWrapper --- } - public static String getDims(OreLayerWrapper oreLayer) { - return GT5CFGHelper.GT5CFG( - oreLayer.veinName.replace("ore.mix.custom" + ".", "") - .replace("ore.mix.", "")); - } - public static class OreLayerWrapper { public final String veinName, worldGenHeightRange; public final short[] Meta = new short[4]; public final short randomWeight, size, density; + public final Map<String, Boolean> allowedDimWithOrigNames; public final Materials mPrimaryVeinMaterial; public final Materials mSecondaryMaterial; public final Materials mBetweenMaterial; public final Materials mSporadicMaterial; - public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { - this.veinName = worldGen.mWorldGenName; - this.Meta[0] = worldGen.mPrimaryMeta; - this.Meta[1] = worldGen.mSecondaryMeta; - this.Meta[2] = worldGen.mBetweenMeta; - this.Meta[3] = worldGen.mSporadicMeta; - - // Black magic, don't ask me how it works, I have no idea. - ItemData primaryVeinData = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)); - this.mPrimaryVeinMaterial = primaryVeinData != null ? primaryVeinData.mMaterial.mMaterial : null; - ItemData secondaryVeinData = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)); - this.mSecondaryMaterial = secondaryVeinData != null ? secondaryVeinData.mMaterial.mMaterial : null; - ItemData betweenVeinData = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)); - this.mBetweenMaterial = betweenVeinData != null ? betweenVeinData.mMaterial.mMaterial : null; - ItemData sporadicVeinData = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)); - this.mSporadicMaterial = sporadicVeinData != null ? sporadicVeinData.mMaterial.mMaterial : null; - - this.size = worldGen.mSize; - this.density = worldGen.mDensity; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.randomWeight = worldGen.mWeight; + public OreLayerWrapper(OreMixBuilder mix) { + this.veinName = mix.oreMixName; + this.Meta[0] = (short) mix.primary.mMetaItemSubID; + this.Meta[1] = (short) mix.secondary.mMetaItemSubID; + this.Meta[2] = (short) mix.between.mMetaItemSubID; + this.Meta[3] = (short) mix.sporadic.mMetaItemSubID; + + this.mPrimaryVeinMaterial = mix.primary; + this.mSecondaryMaterial = mix.secondary; + this.mBetweenMaterial = mix.between; + this.mSporadicMaterial = mix.sporadic; + + this.size = (short) mix.size; + this.density = (short) mix.density; + this.worldGenHeightRange = mix.minY + "-" + mix.maxY; + this.randomWeight = (short) mix.weight; + + this.allowedDimWithOrigNames = mix.dimsEnabled; } public List<ItemStack> getVeinLayerOre(int maximumMaterialIndex, int veinLayer) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 725b0c2819..bed47193b9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -1,20 +1,22 @@ package pers.gwyog.gtneioreplugin.util; -import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; +import static pers.gwyog.gtneioreplugin.util.DimensionHelper.getDims; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.objects.ItemData; +import gregtech.api.enums.SmallOres; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.world.GT_Worldgen; import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; +import gregtech.common.SmallOreBuilder; public class GT5OreSmallHelper { @@ -24,7 +26,7 @@ public class GT5OreSmallHelper { public static final HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<>(); public static final HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<>(); public static final HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<>(); - public static final HashMap<OreSmallWrapper, String> bufferedDims = new HashMap<>(); + public static final HashMap<OreSmallWrapper, Map<String, Boolean>> bufferedDims = new HashMap<>(); public static final HashMap<String, SmallOreDimensionWrapper> dimToSmallOreWrapper = new HashMap<>(); public static class SmallOreDimensionWrapper { @@ -50,89 +52,89 @@ public class GT5OreSmallHelper { ItemStack stack; Materials material; short meta; - for (GT_Worldgen worldGen : GregTech_API.sWorldgenList) - if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces) { - GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces) worldGen; - meta = worldGenSmallPieces.mMeta; - if (meta < 0) break; - material = GregTech_API.sGeneratedMaterials[meta]; - mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); - if (!mapOreMetaToOreDrops.containsKey(meta)) { - List<ItemStack> stackList = new ArrayList<>(); - stack = GT_OreDictUnificator.get( - OrePrefixes.gemExquisite, - material, - GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), - 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get( - OrePrefixes.gemFlawless, - material, - GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), - 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get( - OrePrefixes.gemFlawed, - material, - GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), - 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get( - OrePrefixes.gemChipped, - material, - GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), - 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { - mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); - stackList.add(stack); - } - oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + SMALL_ORE_BASE_META)); - mapOreMetaToOreDrops.put(meta, stackList); - } + Map<String, SmallOreBuilder> smallOreDefMap = new HashMap<>(); + + for (SmallOres ore : SmallOres.values()) { + smallOreDefMap.put(ore.smallOreBuilder.smallOreName, ore.smallOreBuilder); + } + + for (GT_Worldgen worldGen : GregTech_API.sWorldgenList) { + if (!worldGen.mWorldGenName.startsWith("ore.small.") + || !(worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces)) { + continue; + } + + GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces) worldGen; + meta = worldGenSmallPieces.mMeta; + if (meta < 0) break; + material = GregTech_API.sGeneratedMaterials[meta]; + mapOreSmallWrapper.put( + worldGen.mWorldGenName, + new OreSmallWrapper(smallOreDefMap.get(worldGenSmallPieces.mWorldGenName))); + if (mapOreMetaToOreDrops.containsKey(meta)) { + continue; + } + + List<ItemStack> stackList = new ArrayList<>(); + stack = GT_OreDictUnificator + .get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + stack = GT_OreDictUnificator + .get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); } + stack = GT_OreDictUnificator + .get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + stack = GT_OreDictUnificator.get( + OrePrefixes.gemChipped, + material, + GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), + 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + SMALL_ORE_BASE_META)); + mapOreMetaToOreDrops.put(meta, stackList); + + } for (OreSmallWrapper oreSmallWrapper : mapOreSmallWrapper.values()) { - bufferedDims.put(oreSmallWrapper, GT5CFGHelper.GT5CFGSmallOres(oreSmallWrapper.oreGenName)); + bufferedDims.put(oreSmallWrapper, getDims(oreSmallWrapper)); } // --- Handling of dimToOreWrapper --- // Get dims as "Ow,Ne,Ma" etc. bufferedDims.forEach((veinInfo, dims) -> { - if (dims.equals(oreVeinNotInAnyDim)) { - return; - } - - for (String dim : dims.split(",")) { - if (!dim.isEmpty()) { - SmallOreDimensionWrapper dimensionSmallOres = dimToSmallOreWrapper - .getOrDefault(dim, new SmallOreDimensionWrapper()); - dimensionSmallOres.internalDimOreList.add(veinInfo); - dimToSmallOreWrapper.put(dim, dimensionSmallOres); - } + for (String dim : dims.keySet()) { + SmallOreDimensionWrapper dimensionSmallOres = dimToSmallOreWrapper + .getOrDefault(dim, new SmallOreDimensionWrapper()); + dimensionSmallOres.internalDimOreList.add(veinInfo); + dimToSmallOreWrapper.put(dim, dimensionSmallOres); } // Calculate probabilities for each dim. @@ -169,6 +171,8 @@ public class GT5OreSmallHelper { public final String worldGenHeightRange; public final short amountPerChunk; + public final Map<String, Boolean> allowedDimWithOrigNames; + @SuppressWarnings("unused") public Materials getOreMaterial() { return oreMaterial; @@ -176,14 +180,14 @@ public class GT5OreSmallHelper { private final Materials oreMaterial; - public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { - this.oreGenName = worldGen.mWorldGenName; - this.oreMeta = worldGen.mMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.amountPerChunk = worldGen.mAmount; - ItemData oreData = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)); - this.oreMaterial = oreData != null ? oreData.mMaterial.mMaterial : null; + public OreSmallWrapper(SmallOreBuilder ore) { + this.oreGenName = ore.smallOreName; + this.oreMeta = (short) ore.ore.mMetaItemSubID; + this.worldGenHeightRange = ore.minY + "-" + ore.maxY; + this.amountPerChunk = (short) ore.amount; + this.oreMaterial = ore.ore; + + this.allowedDimWithOrigNames = ore.dimsEnabled; } public List<ItemStack> getMaterialDrops(int maximumIndex) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index 401cadc09f..aba9497dbe 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -1,600 +1,121 @@ package pers.gwyog.gtneioreplugin.util; -import com.opencsv.bean.CsvBindByName; -import com.opencsv.bean.CsvCustomBindByName; +import static pers.gwyog.gtneioreplugin.util.DimensionHelper.DimNameDisplayed; -@SuppressWarnings("unused") -public class Oremix { +import java.util.Map; - @CsvCustomBindByName(column = "Moon", converter = XtoBool.class) - public boolean mo; +public class Oremix implements Comparable<Oremix> { - @CsvCustomBindByName(column = "End Asteroids", converter = XtoBool.class) - public boolean ea; + private String oreMixName; - @CsvCustomBindByName(column = "AstroidBelt", converter = XtoBool.class) - public boolean as; - - @CsvCustomBindByName(column = "Barnard C", converter = XtoBool.class) - public boolean bc; - - @CsvCustomBindByName(column = "Barnard E", converter = XtoBool.class) - public boolean be; - - @CsvCustomBindByName(column = "Barnard F", converter = XtoBool.class) - public boolean bf; - - @CsvCustomBindByName(column = "Mars", converter = XtoBool.class) - public boolean ma; - - @CsvCustomBindByName(column = "Callisto", converter = XtoBool.class) - public boolean ca; - - @CsvCustomBindByName(column = "Centauri Bb", converter = XtoBool.class) - public boolean cb; - - @CsvCustomBindByName(column = "Ceres", converter = XtoBool.class) - public boolean ce; - - @CsvCustomBindByName(column = "Twilight Forest", converter = XtoBool.class) - public boolean tf; - - @CsvCustomBindByName(column = "Deep Dark", converter = XtoBool.class) - public boolean dd; - - @CsvCustomBindByName(column = "Phobos", converter = XtoBool.class) - public boolean ph; - - @CsvCustomBindByName(column = "Deimos", converter = XtoBool.class) - public boolean de; - - @CsvCustomBindByName(column = "Europa", converter = XtoBool.class) - public boolean eu; - - @CsvCustomBindByName(column = "Ganymede", converter = XtoBool.class) - public boolean ga; - - @CsvCustomBindByName(column = "Io", converter = XtoBool.class) - public boolean io; - - @CsvCustomBindByName(column = "Venus", converter = XtoBool.class) - public boolean ve; - - @CsvCustomBindByName(column = "Mercury", converter = XtoBool.class) - public boolean me; - - @CsvCustomBindByName(column = "Enceladus", converter = XtoBool.class) - public boolean en; - - @CsvCustomBindByName(column = "Titan", converter = XtoBool.class) - public boolean ti; - - @CsvCustomBindByName(column = "Miranda", converter = XtoBool.class) - public boolean mi; - - @CsvCustomBindByName(column = "Oberon", converter = XtoBool.class) - public boolean ob; - - @CsvCustomBindByName(column = "Triton", converter = XtoBool.class) - public boolean tr; - - @CsvCustomBindByName(column = "Proteus", converter = XtoBool.class) - public boolean pr; - - @CsvCustomBindByName(column = "Pluto", converter = XtoBool.class) - public boolean pl; - - @CsvCustomBindByName(column = "Kuiper Belt", converter = XtoBool.class) - public boolean kb; - - @CsvCustomBindByName(column = "Haumea", converter = XtoBool.class) - public boolean ha; - - @CsvCustomBindByName(column = "Makemake", converter = XtoBool.class) - public boolean make; - - @CsvCustomBindByName(column = "Vega B", converter = XtoBool.class) - public boolean vb; - - @CsvCustomBindByName(column = "T Ceti E", converter = XtoBool.class) - public boolean tcetie; - - @CsvCustomBindByName(column = "Anubis", required = false, converter = XtoBool.class) - public boolean an; - - @CsvCustomBindByName(column = "Horus", required = false, converter = XtoBool.class) - public boolean ho; - - @CsvCustomBindByName(column = "Neper", required = false, converter = XtoBool.class) - public boolean np; - - @CsvCustomBindByName(column = "Maahes", required = false, converter = XtoBool.class) - public boolean mh; - - @CsvCustomBindByName(column = "Mehen Belt", required = false, converter = XtoBool.class) - public boolean mb; - - @CsvCustomBindByName(column = "Seth", required = false, converter = XtoBool.class) - public boolean se; - - @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) - private String oreName; - - @CsvBindByName(column = "Primary") private String primary = ""; - @CsvBindByName(column = "Secondary") private String secondary = ""; - @CsvBindByName(column = "Inbetween") private String inbetween = ""; - @CsvBindByName(column = "Around") - private String around = ""; - - @CsvBindByName(column = "ID ") - private String mix = ""; + private String sporadic = ""; - @CsvBindByName(column = "Tier") - private String tier = ""; + private String oreMixIDs = ""; - @CsvBindByName(column = "Height") private String height = ""; - @CsvBindByName(column = "Density") private int density; - @CsvBindByName(column = "Size") private int size; - @CsvBindByName(column = "Weight") private int weight; - @CsvCustomBindByName(column = "Overworld", converter = XtoBool.class) - private boolean overworld; - - @CsvCustomBindByName(column = "Nether", converter = XtoBool.class) - private boolean nether; - - @CsvCustomBindByName(column = "End", converter = XtoBool.class) - private boolean end; - - private int miny, maxy; - - public Oremix() {} - - public boolean isMo() { - return mo; - } - - public void setMo(boolean mo) { - this.mo = mo; - } - - public boolean isEa() { - return ea; - } - - public void setEa(boolean ea) { - this.ea = ea; - } - - public boolean isAs() { - return as; - } - - public void setAs(boolean as) { - this.as = as; - } - - public boolean isBc() { - return bc; - } - - public void setBc(boolean bc) { - this.bc = bc; - } - - public boolean isBe() { - return be; - } - - public void setBe(boolean be) { - this.be = be; - } - - public boolean isBf() { - return bf; - } - - public void setBf(boolean bf) { - this.bf = bf; - } - - public boolean isMa() { - return ma; - } - - public void setMa(boolean ma) { - this.ma = ma; - } - - public boolean isCa() { - return ca; - } - - public void setCa(boolean ca) { - this.ca = ca; - } - - public boolean isCb() { - return cb; - } - - public void setCb(boolean cb) { - this.cb = cb; - } - - public boolean isCe() { - return ce; - } - - public void setCe(boolean ce) { - this.ce = ce; - } - - public boolean isTf() { - return tf; - } - - public void setTf(boolean tf) { - this.tf = tf; - } - - public boolean isDd() { - return dd; - } - - public void setDd(boolean dd) { - this.dd = dd; - } - - public boolean isPh() { - return ph; - } - - public void setPh(boolean ph) { - this.ph = ph; - } - - public boolean isDe() { - return de; - } - - public void setDe(boolean de) { - this.de = de; - } - - public boolean isEu() { - return eu; - } - - public void setEu(boolean eu) { - this.eu = eu; - } - - public boolean isGa() { - return ga; - } - - public void setGa(boolean ga) { - this.ga = ga; - } - - public boolean isIo() { - return io; - } - - public void setIo(boolean io) { - this.io = io; - } - - public boolean isVe() { - return ve; - } - - public void setVe(boolean ve) { - this.ve = ve; - } - - public boolean isMe() { - return me; - } - - public void setMe(boolean me) { - this.me = me; - } - - public boolean isEn() { - return en; - } - - public void setEn(boolean en) { - this.en = en; - } - - public boolean isTi() { - return ti; - } - - public void setTi(boolean ti) { - this.ti = ti; - } - - public boolean isMi() { - return mi; - } - - public void setMi(boolean mi) { - this.mi = mi; - } - - public boolean isOb() { - return ob; - } - - public void setOb(boolean ob) { - this.ob = ob; - } - - public boolean isTr() { - return tr; - } - - public void setTr(boolean tr) { - this.tr = tr; - } - - public boolean isPr() { - return pr; - } - - public void setPr(boolean pr) { - this.pr = pr; - } - - public boolean isPl() { - return pl; - } - - public void setPl(boolean pl) { - this.pl = pl; - } - - public boolean isKb() { - return kb; - } - - public void setKb(boolean kb) { - this.kb = kb; - } - - public boolean isHa() { - return ha; - } + private static final int sizeData = 10; // hors dims - public void setHa(boolean ha) { - this.ha = ha; - } + private Map<String, Boolean> dimensions; - public boolean isMake() { - return make; + public void setDims(Map<String, Boolean> dims) { + this.dimensions = dims; } - public void setMake(boolean make) { - this.make = make; + public String getOreMixName() { + return this.oreMixName; } - public boolean isVb() { - return vb; - } - - public void setVb(boolean vb) { - this.vb = vb; - } - - public boolean isTcetie() { - return tcetie; - } - - public void setTcetie(boolean tcetie) { - this.tcetie = tcetie; - } - - public boolean isAn() { - return an; - } - - public void setAn(boolean an) { - this.an = an; - } - - public boolean isHo() { - return ho; - } - - public void setHo(boolean ho) { - this.ho = ho; - } - - public boolean isNp() { - return np; - } - - public void setNp(boolean np) { - this.np = np; - } - - public boolean isMh() { - return mh; - } - - public void setMh(boolean mh) { - this.mh = mh; - } - - public boolean isMb() { - return mb; - } - - public void setMb(boolean mb) { - this.mb = mb; - } - - public boolean isSe() { - return se; - } - - public void setSe(boolean se) { - this.se = se; - } - - public String getOreName() { - return this.oreName; - } - - public void setOreName(String s) { - this.oreName = s; - } - - public String getPrimary() { - return this.primary; + public void setOreMixName(String s) { + this.oreMixName = s; } public void setPrimary(String s) { this.primary = s; } - public String getSecondary() { - return this.secondary; - } - public void setSecondary(String s) { this.secondary = s; } - public String getInbetween() { - return this.inbetween; - } - public void setInbetween(String s) { this.inbetween = s; } - public String getAround() { - return this.around; - } - - public void setAround(String s) { - this.around = s; - } - - public String getMix() { - return this.mix; - } - - public void setMix(String s) { - this.mix = s; - } - - public String getTier() { - return this.tier; - } - - public void setTier(String s) { - this.tier = s; + public void setSporadic(String s) { + this.sporadic = s; } - public String getHeight() { - return this.height; + public void setOreMixIDs(String s) { + this.oreMixIDs = s; } public void setHeight(String s) { this.height = s; } - public int getDensity() { - return this.density; - } - public void setDensity(int i) { this.density = i; } - public int getSize() { - return this.size; - } - public void setSize(int i) { this.size = i; } - public int getWeight() { - return this.weight; - } - public void setWeight(int i) { this.weight = i; } - public int getMinY() { - calculateminmax(); - return this.miny; - } - - public void setMinY(int i) { - this.miny = i; - } - - public int getMaxY() { - calculateminmax(); - return this.maxy; - } - - public void setMaxY(int i) { - this.maxy = i; - } - - public boolean getOverworld() { - return this.overworld; - } - - public void setOverworld(boolean s) { - this.overworld = s; - } - - public boolean getNether() { - return this.nether; - } - - public void setNether(boolean s) { - this.nether = s; - } - - public boolean getEnd() { - return this.end; - } - - public void setEnd(boolean s) { - this.end = s; - } - - private void calculateminmax() { - this.miny = Integer.parseInt(this.height.split("-")[0]); - this.maxy = Integer.parseInt(this.height.split("-")[1]); - } - - public String getHeightcalced() { - return this.miny + "-" + this.maxy; + @Override + public int compareTo(Oremix ore) { + return ore.oreMixName.compareTo(ore.oreMixName); + } + + public static String getCsvHeader() { + String[] headers = new String[sizeData + DimNameDisplayed.length]; + headers[0] = "Ore Mix Name"; + headers[1] = "Primary Ore"; + headers[2] = "Secondary Ore"; + headers[3] = "InBetween Ore"; + headers[4] = "Sporadic Ore"; + headers[5] = "Ore Meta IDs"; + headers[6] = "Height"; + headers[7] = "Density"; + headers[8] = "Size"; + headers[9] = "Weight"; + for (int i = 0; i < DimNameDisplayed.length; i++) { + headers[sizeData + i] = DimensionHelper.getFullName(DimNameDisplayed[i]); + } + return String.join(",", headers); + } + + public String getCsvEntry() { + String[] values = new String[sizeData + DimNameDisplayed.length]; + values[0] = oreMixName; + values[1] = primary; + values[2] = secondary; + values[3] = inbetween; + values[4] = sporadic; + values[5] = oreMixIDs; + values[6] = height; + values[7] = Integer.toString(density); + values[8] = Integer.toString(size); + values[9] = Integer.toString(weight); + for (int i = 0; i < DimNameDisplayed.length; i++) { + values[sizeData + i] = Boolean.toString(dimensions.getOrDefault(DimNameDisplayed[i], false)); + } + return String.join(",", values); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/SmallOre.java b/src/main/java/pers/gwyog/gtneioreplugin/util/SmallOre.java new file mode 100644 index 0000000000..75a691ad1c --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/SmallOre.java @@ -0,0 +1,82 @@ +package pers.gwyog.gtneioreplugin.util; + +import static pers.gwyog.gtneioreplugin.util.DimensionHelper.DimNameDisplayed; + +import java.util.Map; + +@SuppressWarnings("unused") +public class SmallOre implements Comparable<SmallOre> { + + private String oreName; + private int oreMeta; + private int amount; + private String height = ""; + private static final int sizeData = 4; // hors dims + + private Map<String, Boolean> dimensions; + + public void setDims(Map<String, Boolean> dims) { + this.dimensions = dims; + } + + public String getOreName() { + return this.oreName; + } + + public void setOreName(String s) { + this.oreName = s; + } + + public int getOreMeta() { + return this.oreMeta; + } + + public void setOreMeta(int meta) { + this.oreMeta = meta; + } + + public String getHeight() { + return this.height; + } + + public void setHeight(String s) { + this.height = s; + } + + public void setAmount(int i) { + this.amount = i; + } + + public int getAmount() { + return this.amount; + } + + public static String getCsvHeader() { + String[] headers = new String[sizeData + DimNameDisplayed.length]; + headers[0] = "Ore Name"; + headers[1] = "Block Meta"; + headers[2] = "Height"; + headers[3] = "Amount Per Chunk"; + for (int i = 0; i < DimNameDisplayed.length; i++) { + headers[sizeData + i] = DimensionHelper.getFullName(DimNameDisplayed[i]); + } + return String.join(",", headers); + } + + public String getCsvEntry() { + String[] values = new String[sizeData + DimNameDisplayed.length]; + values[0] = oreName; + values[1] = Integer.toString(oreMeta); + values[2] = getHeight(); + values[3] = Integer.toString(amount); + for (int i = 0; i < DimNameDisplayed.length; i++) { + values[sizeData + i] = Boolean.toString(dimensions.getOrDefault(DimNameDisplayed[i], false)); + } + return String.join(",", values); + } + + @Override + public int compareTo(SmallOre other) { + return oreName.compareTo(other.oreName); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java deleted file mode 100644 index 346573e2a9..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java +++ /dev/null @@ -1,23 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import com.opencsv.bean.AbstractBeanField; - -public class Veinrenamer<T> extends AbstractBeanField<T> { - - @Override - protected Object convert(String value) { - String ret; - CharSequence s = "/"; - - if (value.contains(s)) { - ret = value.split("/")[1]; - ret = ret.replaceAll("&", ""); - ret = ret.replaceAll(" ", ""); - ret = ret.replaceAll("\\.", ""); - ret = ret.toLowerCase(); - } else ret = value; - ret = ret.replaceAll(" ", ""); - ret = ret.toLowerCase(); - return ret; - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java deleted file mode 100644 index 4c15cdecb6..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java +++ /dev/null @@ -1,34 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.util.ResourceBundle; - -import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.beanutils.Converter; -import org.apache.commons.beanutils.converters.BooleanConverter; - -import com.opencsv.bean.AbstractBeanField; -import com.opencsv.exceptions.CsvDataTypeMismatchException; - -public class XtoBool<T> extends AbstractBeanField<T> { - - @Override - protected Object convert(String value) throws CsvDataTypeMismatchException { - if (value.isEmpty()) { - return null; - } - String[] trueStrings = { "x", "X" }; - String[] falseStrings = { "" }; - Converter bc = new BooleanConverter(trueStrings, falseStrings); - try { - return bc.convert(Boolean.class, value.trim()); - } catch (ConversionException e) { - CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException( - value, - field.getType(), - ResourceBundle.getBundle("convertGermanToBoolean", errorLocale) - .getString("input.not.boolean")); - csve.initCause(e); - throw csve; - } - } -} |