diff options
author | Martin Robertz <dream-master@gmx.net> | 2018-01-20 09:21:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-20 09:21:45 +0100 |
commit | 28f07a982916c38ff073acc3386dbb0c6293bf35 (patch) | |
tree | 22a9c2a72795734a21d85bf4691192ff380c34df /src/main/java/gregtech/common/GT_Worldgenerator.java | |
parent | 27558596506ae2dda89d9e64f6ed4d353ed84c30 (diff) | |
parent | 210c228979f7428c0aa8c8756ac1d28c41b1c2b7 (diff) | |
download | GT5-Unofficial-28f07a982916c38ff073acc3386dbb0c6293bf35.tar.gz GT5-Unofficial-28f07a982916c38ff073acc3386dbb0c6293bf35.tar.bz2 GT5-Unofficial-28f07a982916c38ff073acc3386dbb0c6293bf35.zip |
Merge pull request #93 from GTNewHorizons/debug/OreRatios
Debug/ore ratios
Diffstat (limited to 'src/main/java/gregtech/common/GT_Worldgenerator.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_Worldgenerator.java | 76 |
1 files changed, 71 insertions, 5 deletions
diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index ddc78b031a..10076f7bd7 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -108,7 +108,13 @@ implements IWorldGenerator { public final IChunkProvider mChunkGenerator;
public final IChunkProvider mChunkProvider;
public final String mBiome;
+ // Used for outputting orevein weights and bins
+ // static int test=0;
+
+
// Local class to track which orevein seeds must be checked when doing chunkified worldgen
+
+
class NearbySeeds {
public int mX;
public int mZ;
@@ -131,6 +137,30 @@ implements IWorldGenerator { this.mBiome = aBiome;
}
+ // How to evaluate oregen distribution
+ // - Enable debugOreveins
+ // - Fly around for a while, or teleport jumping ~320 blocks at a time, with
+ // a 15-30s pause for worldgen to catch up
+ // - Do this across a large area, at least 2000x2000 blocks for good numbers
+ // - Open logs\gregtech.log
+ // - Using notepad++, do a Search | Find - enter "Added" for the search term
+ // - Select Find All In Current Document
+ // - In the Search window, right-click and Select All
+ // - Copy and paste to a new file
+ // - Delete extraneous stuff at top, and blank line at bottom. Line count is
+ // # of total oreveins
+ // - For simple spot checks, use Find All in Current Document for specific
+ // oremixes, ie ore.mix.diamond, to check how many appear in the list.
+ // - For more complex work, import file into Excel, and sort based on oremix
+ // column. Drag select the oremix names, in the bottom right will be how many
+ // entries to add in a seperate tab to calculate %ages.
+ //
+ // When using the ore weights, discount or remove the high altitude veins since
+ // their high weight are offset by their rareness. I usually just use zero for them.
+ // Actual spawn rates will vary based upon the average height of the stone layers
+ // in the dimension. For example veins that range above and below the average height
+ // will be less, and veins that are completely above the average height will be much less.
+
public void worldGenFindVein( int oreseedX, int oreseedZ) {
// Explanation of oreveinseed implementation.
// (long)this.mWorld.getSeed()<<16) Deep Dark does two oregen passes, one with getSeed set to +1 the original world seed. This pushes that +1 off the low bits of oreseedZ, so that the hashes are far apart for the two passes.
@@ -159,6 +189,22 @@ implements IWorldGenerator { int placementAttempts = 0;
boolean oreveinFound = false;
int i;
+
+ // Used for outputting orevein weights and bins
+ /*
+ if( test==0 )
+ {
+ test = 1;
+ GT_Log.out.println(
+ "sWeight = " + GT_Worldgen_GT_Ore_Layer.sWeight
+ );
+ for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) {
+ GT_Log.out.println(
+ ( tWorldGen).mWorldGenName + " mWeight = " + ( tWorldGen).mWeight + " mSize = " + (tWorldGen).mSize
+ );
+ }
+ }
+ */
for( i = 0; (i < oreveinAttempts) && (!oreveinFound) && (placementAttempts<oreveinMaxPlacementAttempts); i++ ) {
int tRandomWeight = oreveinRNG.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight);
for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) {
@@ -171,7 +217,8 @@ implements IWorldGenerator { switch(placementResult) {
case GT_Worldgen_GT_Ore_Layer.ORE_PLACED:
if (debugOrevein) GT_Log.out.println(
- " Added oreveinSeed=" + oreveinSeed +
+ " Added near oreveinSeed=" + oreveinSeed + " " +
+ ( tWorldGen).mWorldGenName +
" tries at oremix=" + i +
" placementAttempts=" + placementAttempts +
" dimensionName=" + tDimensionName
@@ -184,7 +231,26 @@ implements IWorldGenerator { // SHould do retry in this case until out of chances
break;
case GT_Worldgen_GT_Ore_Layer.NO_OVERLAP:
- // Orevein didn't reach this chunk, can't add it yet to the hash
+ if (debugOrevein) GT_Log.out.println(
+ " Added far oreveinSeed=" + oreveinSeed + " " +
+ ( tWorldGen).mWorldGenName +
+ " tries at oremix=" + i +
+ " placementAttempts=" + placementAttempts +
+ " dimensionName=" + tDimensionName
+ );
+ validOreveins.put(oreveinSeed, tWorldGen);
+ oreveinFound = true;
+ break;
+ case GT_Worldgen_GT_Ore_Layer.NO_OVERLAP_AIR_BLOCK:
+ if (debugOrevein) GT_Log.out.println(
+ " No overlap and air block in test spot=" + oreveinSeed + " " +
+ ( tWorldGen).mWorldGenName +
+ " tries at oremix=" + i +
+ " placementAttempts=" + placementAttempts +
+ " dimensionName=" + tDimensionName
+ );
+ // SHould do retry in this case until out of chances
+ placementAttempts++;
break;
}
break; // Try the next orevein
@@ -195,14 +261,14 @@ implements IWorldGenerator { " mX="+ this.mX +
" mZ="+ this.mZ +
" oreseedX="+ oreseedX +
- " oreseedZ="+ oreseedZ
- );
+ " oreseedZ="+ oreseedZ
+ );
e.printStackTrace(GT_Log.err);
}
}
}
}
- // Only add an empty orevein if are unable to place a vein at the oreseed chunk.
+ // Only add an empty orevein if unable to place a vein at the oreseed chunk.
if ((!oreveinFound) && (this.mX == oreseedX) && (this.mZ == oreseedZ)){
if (debugOrevein) GT_Log.out.println(
" Empty oreveinSeed="+ oreveinSeed +
|