diff options
| author | boubou19 <miisterunknown@gmail.com> | 2024-08-27 20:50:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-27 18:50:30 +0000 |
| commit | 4908d5967c3dfeff5616c65144e701859b9e30a2 (patch) | |
| tree | 3e58a4b8ebd8b70745e81c4c71c765980e4ec4f4 /src/main/java/bloodasp | |
| parent | 3c574facfb224029c0b69865e281023da6170ce0 (diff) | |
| download | GT5-Unofficial-4908d5967c3dfeff5616c65144e701859b9e30a2.tar.gz GT5-Unofficial-4908d5967c3dfeff5616c65144e701859b9e30a2.tar.bz2 GT5-Unofficial-4908d5967c3dfeff5616c65144e701859b9e30a2.zip | |
Config/gregtech.cfg (#2939)
* first pass on config migration
* second pass on config migration
* removing bad configs
* rename config classes and register them
* move debug options to its own debug category
* migrate pollution
* finish migrating general config
* removing useless config
* finish GregTech.cfg port to GTNHLib
* don't accidentally force panic mode in dev env
* typo
* defaults are now handled by the confg handler
* remove dead config
* force config save after defaults are being written
* stop messing with the GregTech.cfg externally
* removing comments
* new underground fluid builder and porting default underground fluids to code
* move config handlers of gregtech.cfg in their own package
* process MachineStats.cfg
* yeeted MaterialProperties.cfg
* remove unused compat in GTNH
* process OverpoweredStuff.cfg
* process Other.cfg
* ungregify some config variables
* remove unused variables
* fix Ids.cfg not being populated
* delete duplicate printing of MTE IDs in GT5U clients
* bump hodgepodge version to get mod phase timers
* process Client.cfg
* fix bad category naming
* registering all the config handlers in gui
* bump GTNHLib version
* actually only registering client configs
* use proper double arrays now
* move GT ore mixes to patternbuilders
* dead code
* fix multifiles config not being handled properly
* import class from NHCore
* removing reflection
* use enums for registration
* yeet config for Asteroid dimensions
* remove unused since 2015 enum entry
* todo
* rework oremix enums
* imported dimension data in enums
* convert old dirty predicate into proper one
* hook gagreg onto the OreMixes enum
* finally nuke worldgen.ore.mix config category!
* hook gagreg small ores onto the SmallOres enum
* imported dim values in enum
* fix dirty work around in vm predicate
* yeet unused classes
* hook GT stones to GTStones enum
* yeet all the remaining booleans in the worldgen category
* port endasteroids category
* port general category
* deprecated
* yeet unused bw compat
* finish worldgen config migration
* hardcode config into code
* remove not generated config entry
* remove Unification.cfg
* fix build
* migrate oreveins away from config
* migrate small ores away from config
* delete config parser
* forgotten
* fix EoH recipe crash in dev
* fix GT NEI Ore Plugin config and csv paths
* shade opencsv
* rewrite csv generator
* spotless apply
Diffstat (limited to 'src/main/java/bloodasp')
18 files changed, 836 insertions, 1142 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"); |
