diff options
Diffstat (limited to 'src/main')
5 files changed, 385 insertions, 385 deletions
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index a9af1bb266..b2408affe5 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -117,47 +117,47 @@ public class GT_Values { * For Internal Usage (Network) */ public static IGT_NetworkHandler NW; - /** - * Control percentage of filled 3x3 chunks. Lower number means less oreveins spawn - */ - public static int oreveinPercentage; - /** - * Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is cheap - */ - public static int oreveinAttempts; - /** - * Control number of attempts to place a valid orevein. If a vein wasn't placed due to height restrictions, completely in the water, etc, another attempt is tried. - */ - public static int oreveinMaxPlacementAttempts; - /** - * How wide to look for oreveins that affect a requested chunk. Trying to use oreveins larger than this will not work correctly. Increasing the size will cause additional worldgenerator lag. - */ - public static int oreveinMaxSize; - /** + /** + * Control percentage of filled 3x3 chunks. Lower number means less oreveins spawn + */ + public static int oreveinPercentage; + /** + * Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is cheap + */ + public static int oreveinAttempts; + /** + * Control number of attempts to place a valid orevein. If a vein wasn't placed due to height restrictions, completely in the water, etc, another attempt is tried. + */ + public static int oreveinMaxPlacementAttempts; + /** + * How wide to look for oreveins that affect a requested chunk. Trying to use oreveins larger than this will not work correctly. Increasing the size will cause additional worldgenerator lag. + */ + public static int oreveinMaxSize; + /** * 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; - /** - * Debug parameter for orevein generation. - */ - public static boolean debugOrevein = false; - /** - * Debug parameter for small ore generation. - */ - public static boolean debugSmallOres = false; - /** - * Debug parameter for stones generation. - */ - public static boolean debugStones = 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; + /** + * Debug parameter for orevein generation. + */ + public static boolean debugOrevein = false; + /** + * Debug parameter for small ore generation. + */ + public static boolean debugSmallOres = false; + /** + * Debug parameter for stones generation. + */ + public static boolean debugStones = false; + /** * If you have to give something a World Parameter but there is no World... (Dummy World) */ public static World DW; 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 86d140d6b5..564292451d 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 @@ -36,13 +36,13 @@ public class GT_Worldgen_GT_Ore_Layer public final boolean mNether;
public final boolean mEnd;
public final boolean mEndAsteroid;
- public static final int WRONG_BIOME=0;
- public static final int WRONG_DIMENSION=1;
- public static final int NO_ORE_IN_BOTTOM_LAYER=2;
- public static final int NO_OVERLAP=3;
- public static final int ORE_PLACED=4;
+ public static final int WRONG_BIOME=0;
+ public static final int WRONG_DIMENSION=1;
+ public static final int NO_ORE_IN_BOTTOM_LAYER=2;
+ public static final int NO_OVERLAP=3;
+ public static final int ORE_PLACED=4;
-
+
//public final boolean mMoon;
//public final boolean mMars;
//public final boolean mAsteroid;
@@ -59,14 +59,14 @@ public class GT_Worldgen_GT_Ore_Layer //this.mAsteroid = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid);
this.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY));
short mMaxY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY));
- if (mMaxY < (this.mMinY + 7)) {
- GT_Log.out.println(
- "Oremix " + this.mWorldGenName +
- " has invalid Min/Max heights!"
- );
- mMaxY = (short) (this.mMinY + 7);
- }
- this.mMaxY = mMaxY;
+ if (mMaxY < (this.mMinY + 7)) {
+ GT_Log.out.println(
+ "Oremix " + this.mWorldGenName +
+ " has invalid Min/Max heights!"
+ );
+ mMaxY = (short) (this.mMinY + 7);
+ }
+ this.mMaxY = mMaxY;
this.mWeight = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight));
this.mDensity = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity));
this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize)));
@@ -88,173 +88,173 @@ public class GT_Worldgen_GT_Ore_Layer GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
sWeight += this.mWeight;
if(GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes){
- blusunrize.immersiveengineering.api.tool.ExcavatorHandler.addMineral(aName.substring(8, 9).toUpperCase()+aName.substring(9), aWeight, 0.2f, new String[]{"ore"+aPrimary.mName,"ore"+aSecondary.mName,"ore"+aBetween.mName,"ore"+aSporadic.mName}, new float[]{.4f,.4f,.15f,.05f});
+ blusunrize.immersiveengineering.api.tool.ExcavatorHandler.addMineral(aName.substring(8, 9).toUpperCase()+aName.substring(9), aWeight, 0.2f, new String[]{"ore"+aPrimary.mName,"ore"+aSecondary.mName,"ore"+aBetween.mName,"ore"+aSporadic.mName}, new float[]{.4f,.4f,.15f,.05f});
}
}
}
public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
- if( mWorldGenName.equals("NoOresInVein") ) {
- if (debugOrevein) GT_Log.out.println(
+ if( mWorldGenName.equals("NoOresInVein") ) {
+ if (debugOrevein) GT_Log.out.println(
" NoOresInVein"
);
- // This is a special empty orevein
- return ORE_PLACED;
- }
-
- //if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) || ((aWorld.provider.getDimensionName().equals("Moon")) && (this.mMoon)) || ((aWorld.provider.getDimensionName().equals("Mars")) && (this.mMars)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) {
+ // This is a special empty orevein
+ return ORE_PLACED;
+ }
+
+ //if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) || ((aWorld.provider.getDimensionName().equals("Moon")) && (this.mMoon)) || ((aWorld.provider.getDimensionName().equals("Mars")) && (this.mMars)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) {
if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) {
return WRONG_DIMENSION;
}
if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) {
return WRONG_BIOME; //Not the correct biome for ore mix
}
- int[] placeCount=new int[4];
+ int[] placeCount=new int[4];
- // Need to "reseed" RNG with values based on the orevein constants so that two oreveins at this same chunk don't end up trying the same sizes and offsets.
- aRandom.nextInt( this.mPrimaryMeta + this.mSecondaryMeta + this.mSporadicMeta + this.mBetweenMeta + Math.abs(aChunkX + aChunkZ));
-
- int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
- // Determine West/East ends of orevein
- int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
- int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
- // Limit Orevein to only blocks present in current chunk
- int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int eX = Math.min( eXVein, aChunkX + 2 + 16);
- if (wX >= eX) { //No overlap between orevein and this chunk exists in X
- if (debugOrevein) {
- GT_Log.out.println(
- "No X overlap"
- );
- }
- return NO_OVERLAP;
- }
- // Determine North/Sound ends of orevein
- int nZVein = aSeedZ - aRandom.nextInt(mSize);
- int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
-
- int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
- if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z
- if (debugOrevein) {
- GT_Log.out.println(
- "No Z overlap"
- );
- }
- return NO_OVERLAP;
- }
- // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt().
- int localDensity = Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2))) );
+ // Need to "reseed" RNG with values based on the orevein constants so that two oreveins at this same chunk don't end up trying the same sizes and offsets.
+ aRandom.nextInt( this.mPrimaryMeta + this.mSecondaryMeta + this.mSporadicMeta + this.mBetweenMeta + Math.abs(aChunkX + aChunkZ));
+
+ int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
+ // Determine West/East ends of orevein
+ int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
+ int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
+ // Limit Orevein to only blocks present in current chunk
+ int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int eX = Math.min( eXVein, aChunkX + 2 + 16);
+ if (wX >= eX) { //No overlap between orevein and this chunk exists in X
+ if (debugOrevein) {
+ GT_Log.out.println(
+ "No X overlap"
+ );
+ }
+ return NO_OVERLAP;
+ }
+ // Determine North/Sound ends of orevein
+ int nZVein = aSeedZ - aRandom.nextInt(mSize);
+ int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
+
+ int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
+ if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z
+ if (debugOrevein) {
+ GT_Log.out.println(
+ "No Z overlap"
+ );
+ }
+ return NO_OVERLAP;
+ }
+ // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt().
+ int localDensity = Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2))) );
- // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop
- // Now we do bottom-level-first oregen, and work our way upwards.
- int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure.
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) {
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- if ((placeCount[1]+placeCount[3])==0) {
- if (debugOrevein) GT_Log.out.println(
- " No ore in bottom layer"
+ // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop
+ // Now we do bottom-level-first oregen, and work our way upwards.
+ int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure.
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) {
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ if ((placeCount[1]+placeCount[3])==0) {
+ if (debugOrevein) GT_Log.out.println(
+ " No ore in bottom layer"
);
- return NO_ORE_IN_BOTTOM_LAYER; // Exit early, didn't place anything in the bottom layer
- }
- for (level = tMinY; level < (tMinY-1+3); level++) {
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) {
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
- // Low Middle layer is between + sporadic
- // level should be = tMinY-1+3 from end of for loop
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // High Middle layer is between + primary + sporadic
- level++; // Increment level to next layer
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) {
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // Top two layers are primary + sporadic
- level++; // Increment level to next layer
- for( ; level < (tMinY + 6); level++){ // should do two layers
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) {
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
+ return NO_ORE_IN_BOTTOM_LAYER; // Exit early, didn't place anything in the bottom layer
+ }
+ for (level = tMinY; level < (tMinY-1+3); level++) {
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) {
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ }
+ // Low Middle layer is between + sporadic
+ // level should be = tMinY-1+3 from end of for loop
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ // High Middle layer is between + primary + sporadic
+ level++; // Increment level to next layer
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ }
+ else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) {
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ // Top two layers are primary + sporadic
+ level++; // Increment level to next layer
+ for( ; level < (tMinY + 6); level++){ // should do two layers
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
+ if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) {
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ }
+ else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
+ if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
+ placeCount[3]++;
+ }
+ }
+ }
+ }
if (debugOrevein) {
- String tDimensionName = aWorld.provider.getDimensionName();
+ String tDimensionName = aWorld.provider.getDimensionName();
GT_Log.out.println(
"Generated Orevein:" + this.mWorldGenName +
" Dimension=" + tDimensionName +
- " mX="+aChunkX/16+
+ " mX="+aChunkX/16+
" mZ="+aChunkZ/16+
" oreseedX="+ aSeedX/16 +
- " oreseedZ="+ aSeedZ/16 +
+ " oreseedZ="+ aSeedZ/16 +
" cY="+tMinY+
" locDen=" + localDensity +
" Den=" + this.mDensity +
@@ -263,8 +263,8 @@ public class GT_Worldgen_GT_Ore_Layer " Bet="+placeCount[2]+
" Pri="+placeCount[0]
);
- }
- // Something (at least the bottom layer must have 1 block) must have been placed, return true
- return ORE_PLACED;
+ }
+ // Something (at least the bottom layer must have 1 block) must have been placed, return true
+ return ORE_PLACED;
}
}
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 35d619dad5..1bb583908f 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 @@ -47,9 +47,9 @@ public class GT_Worldgen_GT_Ore_SmallPieces return false; } int count=0; - + if (this.mMeta > 0) { - int j = Math.max(1, this.mAmount / 2 + aRandom.nextInt(this.mAmount) / 2); + int j = Math.max(1, this.mAmount / 2 + aRandom.nextInt(this.mAmount) / 2); for ( int i = 0; i < j; i++) { GT_TileEntity_Ores.setOreBlock(aWorld, aChunkX + 8 + aRandom.nextInt(16), this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), aChunkZ + 8 + aRandom.nextInt(16), this.mMeta, true); count++; @@ -59,8 +59,8 @@ public class GT_Worldgen_GT_Ore_SmallPieces GT_Log.out.println( "Small Ore:" + this.mWorldGenName + " @ dim="+aDimensionType+ - " mX="+aChunkX/16+ - " mZ="+aChunkZ/16+ + " mX="+aChunkX/16+ + " mZ="+aChunkZ/16+ " ore="+count ); } diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index c8f0be68d2..85fbcae141 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -45,12 +45,12 @@ implements IWorldGenerator { //private static int gcMaxSize = 400;
private static boolean endAsteroids = true;
public static List<Runnable> mList = new ArrayList();
- public static HashSet<Long> ProcChunks = new HashSet<Long>();
- // This is probably not going to work. Trying to create a fake orevein to put into hashtable when there will be no ores in a vein.
- public static GT_Worldgen_GT_Ore_Layer noOresInVein = new GT_Worldgen_GT_Ore_Layer( "NoOresInVein", false, 0, 255, 0, 255, 16, false, false, false, false, false, false, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium);
- public static Hashtable<Long, GT_Worldgen> validOreveins = new Hashtable(1024);
+ public static HashSet<Long> ProcChunks = new HashSet<Long>();
+ // This is probably not going to work. Trying to create a fake orevein to put into hashtable when there will be no ores in a vein.
+ public static GT_Worldgen_GT_Ore_Layer noOresInVein = new GT_Worldgen_GT_Ore_Layer( "NoOresInVein", false, 0, 255, 0, 255, 16, false, false, false, false, false, false, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium);
+ public static Hashtable<Long, GT_Worldgen> validOreveins = new Hashtable(1024);
public boolean mIsGenerating = false;
- public static final Object listLock = new Object();
+ public static final Object listLock = new Object();
//private static boolean gcAsteroids = true;
@@ -64,23 +64,23 @@ implements IWorldGenerator { //gcMaxSize = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidMaxSize", 400);
//mGCAsteroidProbability = GregTech_API.sWorldgenFile.get("gcasteroids", "GCAsteroidProbability", 300);
GameRegistry.registerWorldGenerator(this, 1073741823);
- if (debugWorldGen) {
- GT_Log.out.println(
- "GT_Worldgenerator created"
- );
- }
+ if (debugWorldGen) {
+ GT_Log.out.println(
+ "GT_Worldgenerator created"
+ );
+ }
}
public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
synchronized (listLock)
- {
- if (!this.ProcChunks.contains( ((long)aX << 32) | ((long)(aZ) & 0x00000000ffffffffL)) ) {
- this.ProcChunks.add( ((long)aX << 32) | ((long)(aZ) & 0x00000000ffffffffL));
- this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX, aZ, ((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 (debugWorldGen) {GT_Log.out.println("ADD WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size());}
- } else {
- if (debugWorldGen) {GT_Log.out.println("DUP WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size() + " ProcChunks.size(): " + ProcChunks.size() ); }
- }
+ {
+ if (!this.ProcChunks.contains( ((long)aX << 32) | ((long)(aZ) & 0x00000000ffffffffL)) ) {
+ this.ProcChunks.add( ((long)aX << 32) | ((long)(aZ) & 0x00000000ffffffffL));
+ this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX, aZ, ((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 (debugWorldGen) {GT_Log.out.println("ADD WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size());}
+ } else {
+ if (debugWorldGen) {GT_Log.out.println("DUP WorldGen chunk x:" + aX + " z:" + aZ + " SIZE: " + this.mList.size() + " ProcChunks.size(): " + ProcChunks.size() ); }
+ }
}
if (!this.mIsGenerating) {
this.mIsGenerating = true;
@@ -88,7 +88,7 @@ implements IWorldGenerator { for (int i = 0; i < mList_sS; i++) {
WorldGenContainer toRun = (WorldGenContainer) this.mList.get(0);
if (debugWorldGen) {GT_Log.out.println("RUN WorldGen chunk x:" + toRun.mX + " z:" + toRun.mZ + " SIZE: " + this.mList.size() + " i: " + i );}
- this.ProcChunks.remove( ((long)(toRun.mX) << 32) | ((long)(toRun.mZ) & 0x00000000ffffffffL));
+ this.ProcChunks.remove( ((long)(toRun.mX) << 32) | ((long)(toRun.mZ) & 0x00000000ffffffffL));
synchronized (listLock)
{
this.mList.remove(0);
@@ -117,18 +117,18 @@ implements IWorldGenerator { public final IChunkProvider mChunkGenerator;
public final IChunkProvider mChunkProvider;
public final String mBiome;
- // Local class to track which orevein seeds must be checked when doing chunkified worldgen
- class NearbySeeds {
- public int mX;
- public int mZ;
- NearbySeeds( int x, int z) {
- this.mX = x;
- this.mZ = z;
- }
- };
- public static ArrayList<NearbySeeds> seedList = new ArrayList();
+ // Local class to track which orevein seeds must be checked when doing chunkified worldgen
+ class NearbySeeds {
+ public int mX;
+ public int mZ;
+ NearbySeeds( int x, int z) {
+ this.mX = x;
+ this.mZ = z;
+ }
+ };
+ public static ArrayList<NearbySeeds> seedList = new ArrayList();
- // aX and aZ are now the by-chunk X and Z for the chunk of interest
+ // aX and aZ are now the by-chunk X and Z for the chunk of interest
public WorldGenContainer(Random aRandom, int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider, String aBiome) {
this.mRandom = aRandom;
this.mX = aX;
@@ -140,152 +140,152 @@ implements IWorldGenerator { this.mBiome = aBiome;
}
- public void worldGenFindVein( int oreseedX, int oreseedZ) {
- long oreveinSeed = (long)this.mWorld.getSeed() ^ (( (long)oreseedX << 32) | ( (long)oreseedZ & 0x00000000ffffffffL )); // Use an RNG that is identical every time it is called for this oreseed
- XSTR oreveinRNG = new XSTR( oreveinSeed );
- int oreveinPercentageRoll = oreveinRNG.nextInt(100); // Roll the dice, see if we get an orevein here at all
- int noOrePlacedCount=0;
- String tDimensionName = "";
- if (debugOrevein) { tDimensionName = this.mWorld.provider.getDimensionName(); }
- /*
- if (debugOrevein) GT_Log.out.println(
- " Finding oreveins for oreveinSeed="+ oreveinSeed +
- " mX="+ this.mX +
- " mZ="+ this.mZ +
- " oreseedX="+ oreseedX +
- " oreseedZ="+ oreseedZ
- );
- */
+ public void worldGenFindVein( int oreseedX, int oreseedZ) {
+ long oreveinSeed = (long)this.mWorld.getSeed() ^ (( (long)oreseedX << 32) | ( (long)oreseedZ & 0x00000000ffffffffL )); // Use an RNG that is identical every time it is called for this oreseed
+ XSTR oreveinRNG = new XSTR( oreveinSeed );
+ int oreveinPercentageRoll = oreveinRNG.nextInt(100); // Roll the dice, see if we get an orevein here at all
+ int noOrePlacedCount=0;
+ String tDimensionName = "";
+ if (debugOrevein) { tDimensionName = this.mWorld.provider.getDimensionName(); }
+ /*
+ if (debugOrevein) GT_Log.out.println(
+ " Finding oreveins for oreveinSeed="+ oreveinSeed +
+ " mX="+ this.mX +
+ " mZ="+ this.mZ +
+ " oreseedX="+ oreseedX +
+ " oreseedZ="+ oreseedZ
+ );
+ */
- // Search for a valid orevein for this dimension
- if( !validOreveins.containsKey(oreveinSeed) ) {
- if ( (oreveinPercentageRoll<oreveinPercentage) && (GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
- int placementAttempts = 0;
- boolean oreveinFound = false;
- int i;
-
- for( i = 0; (i < oreveinAttempts) && (!oreveinFound) && (placementAttempts<oreveinMaxPlacementAttempts); i++ ) {
- int tRandomWeight = oreveinRNG.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;
- if (tRandomWeight <= 0) {
- try {
- int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld, new XSTR( oreveinSeed ), this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider);
- switch(placementResult) {
- case GT_Worldgen_GT_Ore_Layer.ORE_PLACED:
- if (debugOrevein) GT_Log.out.println(
- " Added oreveinSeed=" + oreveinSeed +
- " mX="+ this.mX +
- " mZ="+ this.mZ +
- " oreseedX="+ oreseedX +
- " oreseedZ="+ oreseedZ +
- " tries at oremix=" + i +
- " placementAttempts=" + placementAttempts +
- " dimensionName=" + tDimensionName
- );
- validOreveins.put(oreveinSeed, tWorldGen);
- oreveinFound = true;
- break;
- case GT_Worldgen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
- placementAttempts++;
- // 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
- break;
- }
- break; // Try the next orevein
- } catch (Throwable e) {
- if (debugOrevein) GT_Log.out.println(
- "Exception occurred on oreVein" + tWorldGen +
- " oreveinSeed="+ oreveinSeed +
- " mX="+ this.mX +
- " mZ="+ this.mZ +
- " oreseedX="+ oreseedX +
- " oreseedZ="+ oreseedZ
- );
- e.printStackTrace(GT_Log.err);
- }
- }
- }
- }
- // Only add an empty orevein if are 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 +
- " mX="+ this.mX +
- " mZ="+ this.mZ +
- " oreseedX="+ oreseedX +
- " oreseedZ="+ oreseedZ +
- " tries at oremix=" + i +
- " placementAttempts=" + placementAttempts +
- " dimensionName=" + tDimensionName
- );
- validOreveins.put(oreveinSeed, noOresInVein );
- }
- } else if(oreveinPercentageRoll >= oreveinPercentage) {
- if (debugOrevein) GT_Log.out.println(
- " Skipped oreveinSeed="+ oreveinSeed +
- " mX="+ this.mX +
- " mZ="+ this.mZ +
- " oreseedX=" + oreseedX +
- " oreseedZ="+ oreseedZ +
- " RNG=" + oreveinPercentageRoll +
- " %=" + oreveinPercentage+
- " dimensionName=" + tDimensionName
- );
- validOreveins.put(oreveinSeed, noOresInVein);
- }
- }else {
- // oreseed is located in the previously processed table
- if (debugOrevein) GT_Log.out.print(
- " Valid oreveinSeed="+ oreveinSeed +
- " validOreveins.size()=" + validOreveins.size() + " "
- );
- GT_Worldgen tWorldGen = validOreveins.get(oreveinSeed);
- oreveinRNG.setSeed(oreveinSeed); // reset seed for RNG to only be based on oreseed X/Z
- tWorldGen.executeWorldgenChunkified(this.mWorld, oreveinRNG, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider);
- }
- }
-
+ // Search for a valid orevein for this dimension
+ if( !validOreveins.containsKey(oreveinSeed) ) {
+ if ( (oreveinPercentageRoll<oreveinPercentage) && (GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
+ int placementAttempts = 0;
+ boolean oreveinFound = false;
+ int i;
+
+ for( i = 0; (i < oreveinAttempts) && (!oreveinFound) && (placementAttempts<oreveinMaxPlacementAttempts); i++ ) {
+ int tRandomWeight = oreveinRNG.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;
+ if (tRandomWeight <= 0) {
+ try {
+ int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld, new XSTR( oreveinSeed ), this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider);
+ switch(placementResult) {
+ case GT_Worldgen_GT_Ore_Layer.ORE_PLACED:
+ if (debugOrevein) GT_Log.out.println(
+ " Added oreveinSeed=" + oreveinSeed +
+ " mX="+ this.mX +
+ " mZ="+ this.mZ +
+ " oreseedX="+ oreseedX +
+ " oreseedZ="+ oreseedZ +
+ " tries at oremix=" + i +
+ " placementAttempts=" + placementAttempts +
+ " dimensionName=" + tDimensionName
+ );
+ validOreveins.put(oreveinSeed, tWorldGen);
+ oreveinFound = true;
+ break;
+ case GT_Worldgen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
+ placementAttempts++;
+ // 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
+ break;
+ }
+ break; // Try the next orevein
+ } catch (Throwable e) {
+ if (debugOrevein) GT_Log.out.println(
+ "Exception occurred on oreVein" + tWorldGen +
+ " oreveinSeed="+ oreveinSeed +
+ " mX="+ this.mX +
+ " mZ="+ this.mZ +
+ " oreseedX="+ oreseedX +
+ " oreseedZ="+ oreseedZ
+ );
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+ }
+ }
+ // Only add an empty orevein if are 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 +
+ " mX="+ this.mX +
+ " mZ="+ this.mZ +
+ " oreseedX="+ oreseedX +
+ " oreseedZ="+ oreseedZ +
+ " tries at oremix=" + i +
+ " placementAttempts=" + placementAttempts +
+ " dimensionName=" + tDimensionName
+ );
+ validOreveins.put(oreveinSeed, noOresInVein );
+ }
+ } else if(oreveinPercentageRoll >= oreveinPercentage) {
+ if (debugOrevein) GT_Log.out.println(
+ " Skipped oreveinSeed="+ oreveinSeed +
+ " mX="+ this.mX +
+ " mZ="+ this.mZ +
+ " oreseedX=" + oreseedX +
+ " oreseedZ="+ oreseedZ +
+ " RNG=" + oreveinPercentageRoll +
+ " %=" + oreveinPercentage+
+ " dimensionName=" + tDimensionName
+ );
+ validOreveins.put(oreveinSeed, noOresInVein);
+ }
+ }else {
+ // oreseed is located in the previously processed table
+ if (debugOrevein) GT_Log.out.print(
+ " Valid oreveinSeed="+ oreveinSeed +
+ " validOreveins.size()=" + validOreveins.size() + " "
+ );
+ GT_Worldgen tWorldGen = validOreveins.get(oreveinSeed);
+ oreveinRNG.setSeed(oreveinSeed); // reset seed for RNG to only be based on oreseed X/Z
+ tWorldGen.executeWorldgenChunkified(this.mWorld, oreveinRNG, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider);
+ }
+ }
+
public void run() {
- long startTime = System.nanoTime();
+ long startTime = System.nanoTime();
- // Determine bounding box on how far out to check for oreveins affecting this chunk
- int wXbox = this.mX - (oreveinMaxSize/16
);
- int eXbox = this.mX + (oreveinMaxSize/16
+ 1); // Need to add 1 since it is compared using a <
- int nZbox = this.mZ - (oreveinMaxSize/16
);
- int sZbox = this.mZ + (oreveinMaxSize/16
+ 1);
+ // Determine bounding box on how far out to check for oreveins affecting this chunk
+ int wXbox = this.mX - (oreveinMaxSize/16
);
+ int eXbox = this.mX + (oreveinMaxSize/16
+ 1); // Need to add 1 since it is compared using a <
+ int nZbox = this.mZ - (oreveinMaxSize/16
);
+ int sZbox = this.mZ + (oreveinMaxSize/16
+ 1);
- // Search for orevein seeds and add to the list;
- for( int x = wXbox; x < eXbox; x++ ) {
- for( int z = nZbox; z < sZbox; z++ ) {
- // Determine if this X/Z is an orevein seed
- if ( ( (Math.abs(x)%3) == 1) && ( (Math.abs(z)%3) == 1 ) ) {
- seedList.add( new NearbySeeds(x,z) );
- }
- }
- }
+ // Search for orevein seeds and add to the list;
+ for( int x = wXbox; x < eXbox; x++ ) {
+ for( int z = nZbox; z < sZbox; z++ ) {
+ // Determine if this X/Z is an orevein seed
+ if ( ( (Math.abs(x)%3) == 1) && ( (Math.abs(z)%3) == 1 ) ) {
+ seedList.add( new NearbySeeds(x,z) );
+ }
+ }
+ }
- // Now process each oreseed vs this requested chunk
- for( ; seedList.size() != 0; seedList.remove(0) ) {
- worldGenFindVein( seedList.get(0).mX, seedList.get(0).mZ );
- }
+ // Now process each oreseed vs this requested chunk
+ for( ; seedList.size() != 0; seedList.remove(0) ) {
+ worldGenFindVein( seedList.get(0).mX, seedList.get(0).mZ );
+ }
- // Do leftover worldgen for this chunk (GT_Stones and GT_small_ores)
- try {
- for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) {
- /*
- if (debugWorldGen) GT_Log.out.println(
- "tWorldGen.mWorldGenName="+tWorldGen.mWorldGenName
- );
- */
- tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, this.mChunkGenerator, this.mChunkProvider);
- }
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
-
+ // Do leftover worldgen for this chunk (GT_Stones and GT_small_ores)
+ try {
+ for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) {
+ /*
+ if (debugWorldGen) GT_Log.out.println(
+ "tWorldGen.mWorldGenName="+tWorldGen.mWorldGenName
+ );
+ */
+ tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, this.mChunkGenerator, this.mChunkProvider);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+
//Asteroid Worldgen
int tDimensionType = this.mWorld.provider.dimensionId;
//String tDimensionName = this.mWorld.provider.getDimensionName();
@@ -397,14 +397,14 @@ implements IWorldGenerator { if (tChunk != null) {
tChunk.isModified = true;
}
- long endTime = System.nanoTime();
- long duration = (endTime - startTime);
- if (debugWorldGen) {
- GT_Log.out.println(
- " Oregen took " + duration +
- " nanoseconds"
- );
- }
+ long endTime = System.nanoTime();
+ long duration = (endTime - startTime);
+ if (debugWorldGen) {
+ GT_Log.out.println(
+ " Oregen took " + duration +
+ " nanoseconds"
+ );
+ }
}
}
}
diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index d4717535cb..f8b52c8f08 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -51,9 +51,9 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit String BlockName = tBlock.getUnlocalizedName(); aMetaData += isSmallOre ? 16000 : 0; if ((aMetaData > 0) && ((tBlock != Blocks.air) || air)) { - if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { - //Do nothing, stone background is default background. - //Do this comparison first since stone is most common + if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { + //Do nothing, stone background is default background. + //Do this comparison first since stone is most common } else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) { aMetaData += 1000; } else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) { @@ -78,7 +78,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } else { aMetaData += 5000; } - } else if (BlockName.equals("tile.igneousStone")) { + } else if (BlockName.equals("tile.igneousStone")) { if (GregTech_API.sBlockOresUb1 != null) { tOreBlock = GregTech_API.sBlockOresUb1; aMetaData += (BlockMeta * 1000); |