Skip to content

Instantly share code, notes, and snippets.

@ObKo
Last active September 2, 2015 17:33
Show Gist options
  • Save ObKo/659570848dd827557476 to your computer and use it in GitHub Desktop.
Save ObKo/659570848dd827557476 to your computer and use it in GitHub Desktop.
// WorldGenerator.java
// Ok, we have sList of veins and sWeight calculated for all dimensions
if (Worldgen_GT_Ore_Layer.sWeight > 0 && Worldgen_GT_Ore_Layer.sList.size() > 0) {
boolean temp = T;
for (int i = 0; i < 128 && temp; i++) {
int tRandomWeight = aRandom.nextInt(Worldgen_GT_Ore_Layer.sWeight);
for (Worldgen_GT_Ore_Layer tWorldGen : Worldgen_GT_Ore_Layer.sList) {
tRandomWeight -= tWorldGen.mWeight;
if (tRandomWeight <= 0) {
// Got some random ore, trying to place it
try {
// And here we got problem. If executeWorldgen() return true - all ok.
// But when executeWorldgen() returns false we will try to place next veins in list, regardless of it weight.
// executeWorldgen() return false only if dimension is unacceptable for that vein.
// In case of Arch's config we have 8 veins which are invalid for OW and have enormous total weight before Platinum.
// So, if generator hits one of them it will generate platinum.
// Simple solution - break regardless of executeWorldgen() result.
if (tWorldGen.executeWorldgen(mWorld, aRandom, mBiome, mDimensionType, mX, mZ, tChunkX, tChunkZ, mChunkGenerator, mChunkProvider)) {
temp = F;
break;
}
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
}
}
}
// But, there is another problem - weight is calculated regardless of dimension
// In case of Arch's config, all veins are dimension-specific.
// So, at worldgen most of veins will be invalid for dimension, and generator can fail to hit valid dimension in 128 attempts.
// Also, we have to balance total weight between dimensions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment