diff options
Diffstat (limited to 'src/main')
5 files changed, 55 insertions, 15 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 90b7e74fb5..39bd959262 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -189,6 +189,8 @@ public class GT_Mod implements IGT_Mod { GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false); GT_Values.D2 = tMainConfig.get(aTextGeneral, "Debug2", false).getBoolean(false); GT_Values.debugCleanroom = tMainConfig.get(aTextGeneral, "debugCleanroom", false).getBoolean(false); + GT_Values.debugWorldGen = tMainConfig.get(aTextGeneral, "debugWorldGen", false).getBoolean(false); + GT_Values.oreveinPercentage = tMainConfig.get(aTextGeneral, "oreveinPercentage_100",100).getInt(100); GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get(aTextGeneral, "TicksForLagAveragingWithScanner", 25).getInt(25); GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get(aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100); diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index 27341027f7..8f98e2ceef 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -118,15 +118,23 @@ public class GT_Values { */ public static IGT_NetworkHandler NW; /** - * Debug parameter for cleanroom testing. - */ - public static boolean debugCleanroom = false; - /** * Not really Constants, but they set using the Config and therefore should be constant (those are for the Debug Mode) */ public static boolean D1 = false, D2 = false; + /** + * Debug parameter for cleanroom testing. + */ + public static boolean debugCleanroom = false; + /** + * Debug parameter for world generation. Tracks chunks added/removed from run queue. + */ + public static boolean debugWorldGen = false; /** * If you have to give something a World Parameter but there is no World... (Dummy World) */ public static World DW; -} + /** + * Control percentage of filled 3x3 chunks. Lower number means less oreveins spawn + */ + public static int oreveinPercentage; +}
\ No newline at end of file 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 0cf8a65898..5fcfffad8b 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 @@ -140,6 +140,10 @@ public class GT_Worldgen_GT_Ore_Layer " Sporadic="+execCount[3]+","+placeCount[3]+" "+new ItemStack(GregTech_API.sBlockOres1,1,mSporadicMeta).getDisplayName()
);
}
- return true;
+ // Didn't place anything, return false
+ if( (placeCount[0] + placeCount[1] + placeCount[2] + placeCount[3]) == 0 )
+ return false;
+ else
+ return true;
}
}
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 6a8cd49b6f..e0a729104e 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 @@ -12,6 +12,7 @@ import net.minecraft.world.chunk.IChunkProvider; import java.util.Random; import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.D2; public class GT_Worldgen_GT_Ore_SmallPieces extends GT_Worldgen { @@ -53,7 +54,7 @@ public class GT_Worldgen_GT_Ore_SmallPieces count++; } } - if(D1){ + if(D2){ GT_Log.out.println( "Small Ore:" + this.mWorldGenName + " @ dim="+aDimensionType+ diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 9d68b13f40..d69cf5c9c7 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -15,6 +15,9 @@ import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderHell;
+import static gregtech.api.enums.GT_Values.D1;
+import static gregtech.api.enums.GT_Values.oreveinPercentage;
+import static gregtech.api.enums.GT_Values.debugWorldGen;
import java.util.ArrayList;
import java.util.List;
@@ -49,7 +52,7 @@ public class GT_Worldgenerator //gcMaxSize = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidMaxSize", 400);
//mGCAsteroidProbability = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidProbability", 300);
GameRegistry.registerWorldGenerator(this, 1073741823);
- if (D1) {
+ if (debugWorldGen) {
GT_Log.out.println(
"GT_Worldgenerator created"
);
@@ -60,14 +63,14 @@ public class GT_Worldgenerator synchronized (listLock)
{
this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName));
- if (D1) {GT_Log.out.println("ADD WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size());}
+ if (debugWorldGen) {GT_Log.out.println("ADD WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size());}
}
if (!this.mIsGenerating) {
this.mIsGenerating = true;
int mList_sS=this.mList.size();
for (int i = 0; i < mList_sS; i++) {
WorldGenContainer toRun = (WorldGenContainer) this.mList.get(0);
- if (D1) {GT_Log.out.println("RUN WorldGen chunk x:" + toRun.mX/16 + " z:" + toRun.mZ/16 + " SIZE: " + this.mList.size());}
+ if (debugWorldGen) {GT_Log.out.println("RUN WorldGen chunk x:" + toRun.mX/16 + " z:" + toRun.mZ/16 + " SIZE: " + this.mList.size());}
synchronized (listLock)
{
this.mList.remove(0);
@@ -110,10 +113,12 @@ public class GT_Worldgenerator public void run() {
if ((Math.abs(this.mX / 16) % 3 == 1) && (Math.abs(this.mZ / 16) % 3 == 1)) {
- if ((GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
+ int oreveinRNG = this.mRandom.nextInt(100);
+ if (( oreveinRNG < oreveinPercentage) && (GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
boolean temp = true;
int tRandomWeight;
- for (int i = 0; (i < 256) && (temp); i++) {
+ int i;
+ for (i = 0; (i < 256) && (temp); i++) {
tRandomWeight = this.mRandom.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight);
for (GT_Worldgen tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) {
tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer) tWorldGen).mWeight;
@@ -131,13 +136,33 @@ public class GT_Worldgenerator }
if (D1 & temp) {
GT_Log.out.println(
- "No Orevein Selected!" +
+ "No orevein selected!" +
" @ dim="+ this.mDimensionType+
" chunkX="+ this.mX +
" chunkZ="+ this.mZ
);
- }
+ } else if (D1)
+ {
+ GT_Log.out.println(
+ "Orevein took " + i + " attempts to find"
+ );
+ }
+
+ }else
+ {
+ if((oreveinRNG >= oreveinPercentage) && (D1))
+ {
+ GT_Log.out.println(
+ "Skipped orevein in this 3x3 chunk!" +
+ " @ dim="+ this.mDimensionType+
+ " chunkX="+ this.mX +
+ " chunkZ="+ this.mZ +
+ " RNG=" + oreveinRNG +
+ " %=" + oreveinPercentage
+ );
+ }
}
+
int i = 0;
for (int tX = this.mX - 16; i < 3; tX += 16) {
int j = 0;
@@ -162,7 +187,7 @@ public class GT_Worldgenerator {
if (D1) {
GT_Log.out.println(
- "Chunk Skipped, not 3x3 center" +
+ "Skipped chunk, not 3x3 center" +
" @ dim="+this.mDimensionType+
" chunkX="+this.mX+
" chunkZ="+this.mZ
|