From 02c74c36a8819a10b06e80ca32efd69b47ba4c00 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Fri, 24 Nov 2017 00:47:32 -0600 Subject: Leave deep dark orevein max size at 32, only place GT stone if the requesting chunk can potentially accept it. --- .../java/gregtech/common/GT_Worldgen_Stone.java | 25 +++++++++++++-- .../java/gregtech/common/GT_Worldgenerator.java | 37 ++++++---------------- 2 files changed, 32 insertions(+), 30 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/common/GT_Worldgen_Stone.java b/src/main/java/gregtech/common/GT_Worldgen_Stone.java index d6f735fd17..2dc6cb8c10 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_Stone.java +++ b/src/main/java/gregtech/common/GT_Worldgen_Stone.java @@ -109,11 +109,12 @@ public class GT_Worldgen_Stone int tX = x + stoneRNG.nextInt(16); int tY = mMinY + stoneRNG.nextInt(mMaxY - mMinY); int tZ = z + stoneRNG.nextInt(16); + //Determine the XYZ sizes of the stoneseed double xSize = sizeConversion[stoneRNG.nextInt(sizeConversion.length)]; double ySize = sizeConversion[stoneRNG.nextInt(sizeConversion.length)/2]; // Skew the ySize towards the larger sizes, more long skinny pipes double zSize = sizeConversion[stoneRNG.nextInt(sizeConversion.length)]; - + //Equation for an ellipsoid centered around 0,0,0 // Sx, Sy, and Sz are size controls (size = 1/S_) // 1 = full size, 1.333 = 75%, 2 = 50%, 4 = 25% @@ -126,7 +127,27 @@ public class GT_Worldgen_Stone int tMaxY = tY+(int)(realSize/ySize+2.0); int tMinZ = tZ-(int)(realSize/zSize-1.0); int tMaxZ = tZ+(int)(realSize/zSize+2.0); - + + // If the (tY-ySize) of the stoneseed is air in the current chunk, mark the seed empty and move on. + if(aWorld.getBlock(aChunkX + 8, tMinY, aChunkZ + 8).isAir(aWorld, aChunkX + 8, tMinY, aChunkZ + 8)) { + if (debugStones) GT_Log.out.println( + mWorldGenName + + " tX=" + tX + + " tY=" + tY + + " tZ=" + tZ + + " realSize=" + realSize + + " xSize=" + realSize/xSize + + " ySize=" + realSize/ySize + + " zSize=" + realSize/zSize + + " tMinY=" + tMinY + + " tMaxY=" + tMaxY + + " - Skipped because first requesting chunk would not contain this stone" + ); + long hash = ((long)((aWorld.provider.dimensionId & 0xffL)<<56) |( ((long)x & 0x000000000fffffffL) << 28) | ( (long)z & 0x000000000fffffffL )); + validStoneSeeds.remove(hash); + validStoneSeeds.put( hash, new StoneSeeds(false) ); + } + //Chop the boundaries by the parts that intersect with the current chunk int wX = Math.max( tMinX, aChunkX + 8); int eX = Math.min( tMaxX, aChunkX + 8 + 16 ); diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 1516c7edda..ce308cecd9 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -74,32 +74,20 @@ implements IWorldGenerator { public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { synchronized (listLock) { -/* + this.mList.add(new WorldGenContainer(new XSTR(Math.abs(aRandom.nextInt()) +1), 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( - "aWorld.getSeed()="+aWorld.getSeed() + "ADD WorldSeed:"+aWorld.getSeed() + + " DimId" + aWorld.provider.dimensionId + + " chunk x:" + aX + + " z:" + aZ + + " SIZE: " + this.mList.size() ); - if (!this.ProcChunks.contains( ((aWorld.provider.dimensionId & 0xffL)<<56) |( ((long)aX & 0x000000000fffffffL) << 28) | ( (long)aZ & 0x000000000fffffffL )) ) { // Have to add ProcChunks due to Deep Dark bug that calls oregen twice - this.ProcChunks.add( ((aWorld.provider.dimensionId & 0xffL)<<56) |( ((long)aX & 0x000000000fffffffL) << 28) | ( (long)aZ & 0x000000000fffffffL )); -*/ - this.mList.add(new WorldGenContainer(new XSTR(Math.abs(aRandom.nextInt()) +1), 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 WorldSeed:"+aWorld.getSeed() + - " DimId" + aWorld.provider.dimensionId + - " 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; int mList_sS=this.mList.size(); + mList_sS = Math.min(mList_sS, 5); // Run a maximum of 5 chunks at a time through worldgen. Extra chunks get done later. for (int i = 0; i < mList_sS; i++) { WorldGenContainer toRun = (WorldGenContainer) this.mList.get(0); if (debugWorldGen) GT_Log.out.println( @@ -120,14 +108,6 @@ implements IWorldGenerator { } } - //public synchronized void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {//TODO CHECK??? - // int tempDimensionId = aWorld.provider.dimensionId; - // if (tempDimensionId != -1 && tempDimensionId != 1 && !aChunkGenerator.getClass().getName().contains("galacticraft")) { - // tempDimensionId = 0; - // } - // new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, tempDimensionId, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName).run(); - //} - public static class WorldGenContainer implements Runnable { public final Random mRandom; @@ -290,10 +270,11 @@ implements IWorldGenerator { // Determine bounding box on how far out to check for oreveins affecting this chunk // For now, manually reducing oreveinMaxSize when not in the Underdark for performance if(this.mWorld.provider.getDimensionName().equals("Underdark") ) { - oreveinMaxSize=64; + oreveinMaxSize=32; // Leave Deep Dark/Underdark max oregen at 32, instead of 64 } else { oreveinMaxSize=32; } + 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); -- cgit