Search in sources :

Example 1 with ISimplexData2D

use of rtg.api.util.noise.ISimplexData2D in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeBase method lakePressure.

@Override
public float lakePressure(RTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) {
    if (!this.getConfig().ALLOW_SCENIC_LAKES.get()) {
        return 1f;
    }
    double pX = x;
    double pY = y;
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    rtgWorld.simplexInstance(1).multiEval2D(x / 240.0d, y / 240.0d, jitterData);
    pX += jitterData.getDeltaX() * largeBendSize;
    pY += jitterData.getDeltaY() * largeBendSize;
    rtgWorld.simplexInstance(0).multiEval2D(x / 80.0d, y / 80.0d, jitterData);
    pX += jitterData.getDeltaX() * mediumBendSize;
    pY += jitterData.getDeltaY() * mediumBendSize;
    rtgWorld.simplexInstance(4).multiEval2D(x / 30.0d, y / 30.0d, jitterData);
    pX += jitterData.getDeltaX() * smallBendSize;
    pY += jitterData.getDeltaY() * smallBendSize;
    VoronoiResult lakeResults = rtgWorld.cellularInstance(0).eval2D(pX / lakeInterval, pY / lakeInterval);
    return (float) (1.0d - lakeResults.interiorValue());
}
Also used : ISimplexData2D(rtg.api.util.noise.ISimplexData2D) VoronoiResult(rtg.api.util.noise.VoronoiResult)

Example 2 with ISimplexData2D

use of rtg.api.util.noise.ISimplexData2D in project Realistic-Terrain-Generation by Team-RTG.

the class ChunkGeneratorRTG method generateChunk.

@Override
public Chunk generateChunk(final int cx, final int cz) {
    final ChunkPos chunkPos = new ChunkPos(cx, cz);
    final BlockPos blockPos = new BlockPos(cx * 16, 0, cz * 16);
    final BiomeProvider biomeProvider = this.world.getBiomeProvider();
    this.rand.setSeed(cx * 341873128712L + cz * 132897987541L);
    final ChunkPrimer primer = new ChunkPrimer();
    final ChunkLandscape landscape = getLandscape(biomeProvider, chunkPos);
    generateTerrain(primer, landscape.noise);
    // get standard biome Data
    for (int i = 0; i < 256; i++) {
        this.baseBiomesList[i] = landscape.biome[i].baseBiome();
    }
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    IRealisticBiome[] jitteredBiomes = new IRealisticBiome[256];
    IRealisticBiome jitterbiome, actualbiome;
    for (int i = 0; i < 16; i++) {
        for (int j = 0; j < 16; j++) {
            int x = blockPos.getX() + i;
            int z = blockPos.getZ() + j;
            this.rtgWorld.simplexInstance(0).multiEval2D(x, z, jitterData);
            int pX = (int) Math.round(x + jitterData.getDeltaX() * RTGConfig.surfaceBlendRadius());
            int pZ = (int) Math.round(z + jitterData.getDeltaY() * RTGConfig.surfaceBlendRadius());
            actualbiome = landscape.biome[(x & 15) * 16 + (z & 15)];
            jitterbiome = landscape.biome[(pX & 15) * 16 + (pZ & 15)];
            jitteredBiomes[i * 16 + j] = (actualbiome.getConfig().SURFACE_BLEED_IN.get() && jitterbiome.getConfig().SURFACE_BLEED_OUT.get()) ? jitterbiome : actualbiome;
        }
    }
    replaceBiomeBlocks(cx, cz, primer, jitteredBiomes, this.baseBiomesList, landscape.noise);
    if (this.settings.useCaves) {
        this.caveGenerator.generate(this.world, cx, cz, primer);
    }
    if (this.settings.useRavines) {
        this.ravineGenerator.generate(this.world, cx, cz, primer);
    }
    if (this.mapFeaturesEnabled) {
        if (settings.useMineShafts) {
            this.mineshaftGenerator.generate(this.world, cx, cz, primer);
        }
        if (settings.useStrongholds) {
            this.strongholdGenerator.generate(this.world, cx, cz, primer);
        }
        if (settings.useVillages) {
            this.villageGenerator.generate(this.world, cx, cz, primer);
        }
        if (settings.useTemples) {
            this.scatteredFeatureGenerator.generate(this.world, cx, cz, primer);
        }
        if (settings.useMonuments) {
            this.oceanMonumentGenerator.generate(this.world, cx, cz, primer);
        }
        if (settings.useMansions) {
            this.woodlandMansionGenerator.generate(this.world, cx, cz, primer);
        }
    }
    // store in the in process pile
    Chunk chunk = new Chunk(this.world, primer, cx, cz);
    byte[] abyte1 = chunk.getBiomeArray();
    for (int i = 0; i < abyte1.length; ++i) {
        // Biomes are y-first and terrain x-first
        byte b = (byte) Biome.getIdForBiome(this.baseBiomesList[this.xyinverted[i]]);
        abyte1[i] = b;
    }
    chunk.setBiomeArray(abyte1);
    chunk.generateSkylightMap();
    return chunk;
}
Also used : BiomeProvider(net.minecraft.world.biome.BiomeProvider) ISimplexData2D(rtg.api.util.noise.ISimplexData2D) ChunkPos(net.minecraft.util.math.ChunkPos) MutableBlockPos(net.minecraft.util.math.BlockPos.MutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos) IRealisticBiome(rtg.api.world.biome.IRealisticBiome) Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 3 with ISimplexData2D

use of rtg.api.util.noise.ISimplexData2D in project Realistic-Terrain-Generation by Team-RTG.

the class TerrainBase method getRiverStrength.

public static float getRiverStrength(final BlockPos blockPos, final RTGWorld rtgWorld) {
    final int worldX = blockPos.getX();
    final int worldZ = blockPos.getZ();
    double pX = worldX;
    double pZ = worldZ;
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    // New river curve function. No longer creates worldwide curve correlations along cardinal axes.
    rtgWorld.simplexInstance(1).multiEval2D((float) worldX / 240.0, (float) worldZ / 240.0, jitterData);
    pX += jitterData.getDeltaX() * rtgWorld.getRiverLargeBendSize();
    pZ += jitterData.getDeltaY() * rtgWorld.getRiverLargeBendSize();
    rtgWorld.simplexInstance(2).multiEval2D((float) worldX / 80.0, (float) worldZ / 80.0, jitterData);
    pX += jitterData.getDeltaX() * rtgWorld.getRiverSmallBendSize();
    pZ += jitterData.getDeltaY() * rtgWorld.getRiverSmallBendSize();
    pX /= rtgWorld.getRiverSeparation();
    pZ /= rtgWorld.getRiverSeparation();
    // New cellular noise.
    double riverFactor = rtgWorld.cellularInstance(0).eval2D(pX, pZ).interiorValue();
    // the output is a curved function of relative distance from the center, so adjust to make it flatter
    riverFactor = bayesianAdjustment((float) riverFactor, 0.5f);
    if (riverFactor > rtgWorld.getRiverValleyLevel()) {
        return 0;
    }
    // no river effect
    return (float) (riverFactor / rtgWorld.getRiverValleyLevel() - 1d);
}
Also used : ISimplexData2D(rtg.api.util.noise.ISimplexData2D)

Example 4 with ISimplexData2D

use of rtg.api.util.noise.ISimplexData2D in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeBOPShield method lakePressure.

@Override
public float lakePressure(RTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) {
    double pX = x;
    double pY = y;
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    // rather than lakes, we have a bayou network
    rtgWorld.simplexInstance(1).multiEval2D(x / 40.0d, y / 40.0d, jitterData);
    pX += jitterData.getDeltaX() * 35d;
    pY += jitterData.getDeltaY() * 35d;
    return TerrainBase.bayesianAdjustment((float) rtgWorld.cellularInstance(0).eval2D(pX / 150.0, pY / 150.0).interiorValue(), 0.25f);
}
Also used : ISimplexData2D(rtg.api.util.noise.ISimplexData2D)

Example 5 with ISimplexData2D

use of rtg.api.util.noise.ISimplexData2D in project Realistic-Terrain-Generation by Team-RTG.

the class RealisticBiomeBOPBayou method lakePressure.

@Override
public float lakePressure(RTGWorld rtgWorld, int x, int y, float border, float lakeInterval, float largeBendSize, float mediumBendSize, float smallBendSize) {
    double pX = x;
    double pY = y;
    ISimplexData2D jitterData = SimplexData2D.newDisk();
    // rather than lakes, we have a bayou network
    rtgWorld.simplexInstance(1).multiEval2D(x / 40.0d, y / 40.0d, jitterData);
    pX += jitterData.getDeltaX() * 35d;
    pY += jitterData.getDeltaY() * 35d;
    return TerrainBase.bayesianAdjustment((float) rtgWorld.cellularInstance(0).eval2D(pX / 150.0, pY / 150.0).interiorValue(), 0.25f);
}
Also used : ISimplexData2D(rtg.api.util.noise.ISimplexData2D)

Aggregations

ISimplexData2D (rtg.api.util.noise.ISimplexData2D)6 BlockPos (net.minecraft.util.math.BlockPos)1 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)1 ChunkPos (net.minecraft.util.math.ChunkPos)1 BiomeProvider (net.minecraft.world.biome.BiomeProvider)1 Chunk (net.minecraft.world.chunk.Chunk)1 ChunkPrimer (net.minecraft.world.chunk.ChunkPrimer)1 VoronoiResult (rtg.api.util.noise.VoronoiResult)1 IRealisticBiome (rtg.api.world.biome.IRealisticBiome)1