Skip to content

Commit

Permalink
Merge branch 'master' into nanochip-assembly-complex
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Sep 2, 2024
2 parents c005595 + c0ee194 commit 669672f
Show file tree
Hide file tree
Showing 494 changed files with 18,902 additions and 10,749 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-forbidden-getmoditems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Detect forbidden getModItem calls
shell: bash
run: |
! grep -E -r 'getModItem\(("(bartworks|galacticgreg|ggfab|GoodGenerator|gregtech|gtnhlanth|miscutils|kekztech|kubatech|tectech)"|(BartWorks|GalactiGreg|GGFab|GoodGenerator|GTNHLanthanides|GTPlusPlus|KekzTech|KubaTech|TecTech)\.ID)' src/main/java
! grep -E -r 'getModItem\(("(bartworks|galacticgreg|ggfab|GoodGenerator|gregtech|gtnhlanth|miscutils|kekztech|kubatech|tectech|gtneioreplugin)"|.*(BartWorks|GalactiGreg|GGFab|GoodGenerator|GregTech|GTNHLanthanides|GTPlusPlus|KekzTech|KubaTech|TecTech|NEIOrePlugin)\.ID)' src/main/java
18 changes: 18 additions & 0 deletions .github/workflows/test-forbidden-ismodloaded.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Forbidden isModLoaded

on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]

jobs:
test-forbidden-getmoditems:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect forbidden isModLoaded calls
shell: bash
run: |
! grep -E -r '(BartWorks|GalactiGreg|GGFab|GoodGenerator|GTNHLanthanides|GregTech|GTPlusPlus|KekzTech|KubaTech|TecTech|NEIOrePlugin)\.isModLoaded' src/main/java
38 changes: 21 additions & 17 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,70 @@
dependencies {
api("com.github.GTNewHorizons:StructureLib:1.3.4:dev")
api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.6.26-GTNH:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.6.33-GTNH:dev")
api("com.github.GTNewHorizons:NotEnoughIds:2.1.0:dev")
api("com.github.GTNewHorizons:GTNHLib:0.4.8:dev")
api("com.github.GTNewHorizons:GTNHLib:0.4.9:dev")
api("com.github.GTNewHorizons:ModularUI:1.2.0:dev")
api("com.github.GTNewHorizons:ModularUI2:2.1.2-1.7.10:dev")
api("com.github.GTNewHorizons:ModularUI2:2.1.3-1.7.10:dev")
api("com.github.GTNewHorizons:waila:1.8.1:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-436-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.26-gtnh:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-442-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.33-gtnh:dev")
api('com.github.GTNewHorizons:Yamcl:0.6.0:dev')
api("com.github.GTNewHorizons:Postea:1.0.9:dev")

compileOnlyApi('com.github.GTNewHorizons:ThaumicTinkerer:2.10.1:dev')
compileOnlyApi("com.github.GTNewHorizons:Mobs-Info:0.4.2-GTNH:dev")
compileOnlyApi("com.github.GTNewHorizons:Mobs-Info:0.4.5-GTNH:dev")
compileOnlyApi("com.github.GTNewHorizons:Navigator:1.0.6:dev")
implementation('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive=false}
// Required to prevent an older bauble api from Extra Utilities from loading first in the javac classpath
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive=false}

runtimeOnlyNonPublishable('com.github.GTNewHorizons:ForestryMC:4.9.10:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:neiaddons:1.16.0:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:MagicBees:2.8.2-GTNH:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.1:dev')
runtimeOnlyNonPublishable('com.github.GTNewHorizons:EnderIO:2.8.17:dev')

devOnlyNonPublishable("com.github.GTNewHorizons:Infernal-Mobs:1.8.1-GTNH:dev")

compileOnlyApi("com.github.GTNewHorizons:Avaritia:1.51:dev")
// this is required because forestry is an hidden hard dep, revert this if you fixed the hidden hard dep
implementation("com.github.GTNewHorizons:ForestryMC:4.9.7:dev") { transitive = false }
implementation("com.github.GTNewHorizons:ForestryMC:4.9.10:dev") { transitive = false }

compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta4:api') { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:AppleCore:3.3.0:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.39:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:EnderIO:2.8.17:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:ProjectRed:4.10.2-GTNH:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:Railcraft:9.15.11:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:Railcraft:9.15.12:dev") { transitive = false }

compileOnly("TGregworks:TGregworks:1.7.10-GTNH-1.0.26:deobf") {transitive = false}
compileOnly("com.github.GTNewHorizons:ThaumicBases:1.7.5:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderCore:0.4.6:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.10:dev') { transitive = false }

compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.1-GTNH:dev") { transitive = false }
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.6-GTNH:dev")
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.8-GTNH:dev")

compileOnly("com.github.GTNewHorizons:Chisel:2.15.2-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Translocators:1.2.1:dev") { transitive = false }
compileOnly rfg.deobf("curse.maven:cofh-core-69162:2388751")
compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.6.2:dev") { transitive = false }
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.49:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.52:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Botania:1.11.5-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:HoloInventory:2.4.12-GTNH:dev') { transitive = false }
compileOnly rfg.deobf("curse.maven:extra-utilities-225561:2264384")
compileOnly rfg.deobf('curse.maven:minefactory-reloaded-66672:2366150')
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.21-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.22-GTNH:dev") {transitive = false}
// https://www.curseforge.com/minecraft/mc-mods/advancedsolarpanels
compileOnlyApi rfg.deobf('curse.maven:advsolar-362768:2885953')
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.22-GTNH:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:BloodMagic:1.6.2:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.4.0:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:BetterLoadingScreen:1.7.0-GTNH:dev") { transitive = false }

compileOnly('com.github.GTNewHorizons:SC2:2.1.1:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:SC2:2.2.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Binnie:2.4.1:dev') {transitive = false}
compileOnly('curse.maven:PlayerAPI-228969:2248928') {transitive=false}
compileOnly('com.github.GTNewHorizons:BlockRenderer6343:1.2.12:dev'){transitive=false}
Expand All @@ -102,11 +109,8 @@ dependencies {
compileOnly("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false }
annotationProcessor("com.google.auto.value:auto-value:1.10.1")

// for GT NEI Ore Plugin
compileOnly('com.opencsv:opencsv:4.0')

// For testing iApiary
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.9.7:dev")
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.9.10:dev")

testImplementation(platform('org.junit:junit-bom:5.9.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
Expand All @@ -118,7 +122,7 @@ dependencies {
functionalTestImplementation('org.junit.platform:junit-platform-launcher')
functionalTestImplementation('org.junit.platform:junit-platform-reporting')

runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.2:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.3:dev")

// For testing
//runtimeOnlyNonPublishable('com.github.GTNewHorizons:TCNEIAdditions:1.4.1:dev')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
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 {

Expand All @@ -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;

}

/**
Expand All @@ -102,31 +79,7 @@ public GT_Worldgen_GT_Ore_Layer_Space(String pName, boolean pDefault, int pMinY,
* @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<>();
Expand All @@ -148,27 +101,13 @@ private static List<String> getOreMixIDsForDim(ModDimensionDef pDimensionDef) {
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);
}

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
*
Expand All @@ -182,8 +121,6 @@ public static GTOreGroup getRandomOreGroup(ModDimensionDef pDimensionDef, Random
short betweenMeta = 0;
short sporadicMeta = 0;

// int tRangeSplit = getMaxWeightForDim(pDimensionDef) / 2;

if (pIgnoreWeight) {
List<String> tEnabledVeins = getOreMixIDsForDim(pDimensionDef);
int tRnd = pRandom.nextInt(tEnabledVeins.size());
Expand Down Expand Up @@ -249,7 +186,7 @@ public boolean executeWorldgen(World pWorld, Random pRandom, String pBiome, int
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;
Expand Down
Loading

0 comments on commit 669672f

Please sign in to comment.