From 4502ed5f48549b14de1db98f37ddbc177326dcd5 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Sun, 21 Jan 2018 13:20:32 -0600 Subject: I like this fix better, upstream in the ore layer instead of downstream in the block placer. --- .../gregtech/common/GT_Worldgen_GT_Ore_Layer.java | 28 ++++++++++++---------- .../common/GT_Worldgen_GT_Ore_SmallPieces.java | 7 ++++-- .../gregtech/common/blocks/GT_TileEntity_Ores.java | 1 + 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'src/main') 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 4e55a91e24..36f6b5b8da 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 @@ -116,6 +116,10 @@ public class GT_Worldgen_GT_Ore_Layer if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { return WRONG_BIOME; } + // For optimal performance, this should be done upstream. Meh + String tDimensionName = aWorld.provider.getDimensionName(); + boolean isUnderdark = tDimensionName.equals("Underdark"); + int[] placeCount=new int[4]; int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5); @@ -161,7 +165,6 @@ public class GT_Worldgen_GT_Ore_Layer } if (debugOrevein) { - String tDimensionName = aWorld.provider.getDimensionName(); GT_Log.out.print( "Trying Orevein:" + this.mWorldGenName + " Dimension=" + tDimensionName + @@ -183,12 +186,12 @@ public class GT_Worldgen_GT_Ore_Layer 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, isUnderdark)) { 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)) + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, isUnderdark)) placeCount[3]++; } } @@ -205,12 +208,12 @@ public class GT_Worldgen_GT_Ore_Layer 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, isUnderdark)) { 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)) + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, isUnderdark)) placeCount[3]++; } } @@ -223,12 +226,12 @@ public class GT_Worldgen_GT_Ore_Layer 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, isUnderdark)) { 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)) + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, isUnderdark)) placeCount[3]++; } } @@ -240,17 +243,17 @@ public class GT_Worldgen_GT_Ore_Layer 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, isUnderdark)) { 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, isUnderdark)) { 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)) + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, isUnderdark)) placeCount[3]++; } } @@ -263,19 +266,18 @@ public class GT_Worldgen_GT_Ore_Layer 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)) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, isUnderdark)) { 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)) + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, isUnderdark)) placeCount[3]++; } } } } if (debugOrevein) { - String tDimensionName = aWorld.provider.getDimensionName(); GT_Log.out.println( " wXVein" + wXVein + " eXVein" + eXVein + 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 60138d955e..a4273e0f21 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 @@ -45,11 +45,14 @@ public class GT_Worldgen_GT_Ore_SmallPieces return false; } int count=0; - + // For optimal performance, this should be done upstream. Meh + String tDimensionName = aWorld.provider.getDimensionName(); + boolean isUnderdark = tDimensionName.equals("Underdark"); + if (this.mMeta > 0) { 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); + 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, isUnderdark); count++; } } 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 f8b52c8f08..0115d554c0 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -10,6 +10,7 @@ import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_Log; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; -- cgit