use of net.minecraft.world.gen.ChunkGeneratorSettings in project RFToolsDimensions by McJty.
the class NormalTerrainGenerator method generateHeightmap.
protected void generateHeightmap(int chunkX4, int chunkY4, int chunkZ4) {
ChunkGeneratorSettings settings = provider.getSettings();
this.depthRegion = this.depthNoise.generateNoiseOctaves(this.depthRegion, chunkX4, chunkZ4, 5, 5, settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.depthNoiseScaleExponent);
float f = settings.coordinateScale;
float f1 = settings.heightScale;
this.mainNoiseRegion = this.mainPerlinNoise.generateNoiseOctaves(this.mainNoiseRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f / settings.mainNoiseScaleX, f1 / settings.mainNoiseScaleY, f / settings.mainNoiseScaleZ);
this.minLimitRegion = this.minLimitPerlinNoise.generateNoiseOctaves(this.minLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
this.maxLimitRegion = this.maxLimitPerlinNoise.generateNoiseOctaves(this.maxLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
int i = 0;
int j = 0;
boolean domaze = false;
boolean elevated = false;
boolean donearlands = provider.dimensionInformation.getTerrainType() == TerrainType.TERRAIN_NEARLANDS;
if (donearlands) {
elevated = true;
}
if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
domaze = true;
long s2 = (((chunkX4 >> 2) + provider.seed + 13) * 314) + (chunkZ4 >> 2) * 17L;
Random rand = new Random(s2);
// Skip one.
rand.nextFloat();
elevated = ((chunkX4 >> 2) & 1) == 0;
if (rand.nextFloat() < .2f) {
elevated = !elevated;
}
}
if (donearlands) {
int cx = chunkX4 >> 2;
int cz = chunkZ4 >> 2;
if (Math.abs(cx) < 5 && Math.abs(cz) < 5) {
elevated = false;
}
}
if (provider.biomesForGeneration == null) {
Logging.log("Dimension " + world.provider.getDimension() + " has a problem! Ignoring for now.");
return;
}
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 5; ++l) {
float f2 = 0.0F;
float f3 = 0.0F;
float f4 = 0.0F;
Biome Biome = provider.biomesForGeneration[k + 2 + (l + 2) * 10];
for (int j1 = -2; j1 <= 2; ++j1) {
for (int k1 = -2; k1 <= 2; ++k1) {
Biome Biome1 = provider.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10];
float f5 = provider.getSettings().biomeDepthOffSet + Biome1.getBaseHeight() * provider.getSettings().biomeDepthWeight;
float f6 = provider.getSettings().biomeScaleOffset + Biome1.getHeightVariation() * provider.getSettings().biomeScaleWeight;
if (domaze || donearlands) {
if (f5 > 0.0F && elevated) {
if (provider.worldType == WorldType.AMPLIFIED) {
f5 = 2.0F + f5 * 1.5f;
f6 = 1.0F + f6 * 3.0f;
} else {
f5 = 2.0F + f5;
f6 = 0.5F + f6 * 1.5f;
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0f) {
f5 = 0.5F + f5 * 1.5F;
f6 = 0.5F + f6 * 2.0F;
} else {
f6 = f6 * 0.5F;
}
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0F) {
f5 = 1.0F + f5 * 2.0F;
f6 = 1.0F + f6 * 4.0F;
}
}
float f7 = biomeWeights[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F);
if (Biome1.getBaseHeight() > Biome.getBaseHeight()) {
f7 /= 2.0F;
}
f2 += f6 * f7;
f3 += f5 * f7;
f4 += f7;
}
}
f2 /= f4;
f3 /= f4;
f2 = f2 * 0.9F + 0.1F;
f3 = (f3 * 4.0F - 1.0F) / 8.0F;
double d12 = this.depthRegion[j] / 8000.0D;
if (d12 < 0.0D) {
d12 = -d12 * 0.3D;
}
d12 = d12 * 3.0D - 2.0D;
if (d12 < 0.0D) {
d12 /= 2.0D;
if (d12 < -1.0D) {
d12 = -1.0D;
}
d12 /= 1.4D;
d12 /= 2.0D;
} else {
if (d12 > 1.0D) {
d12 = 1.0D;
}
d12 /= 8.0D;
}
++j;
double d13 = f3;
double d14 = f2;
d13 += d12 * 0.2D;
d13 = d13 * 8.5D / 8.0D;
double d5 = 8.5D + d13 * 4.0D;
for (int j2 = 0; j2 < 33; ++j2) {
double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
if (d6 < 0.0D) {
d6 *= 4.0D;
}
double d7 = this.minLimitRegion[i] / 512.0D;
double d8 = this.maxLimitRegion[i] / 512.0D;
double d9 = (this.mainNoiseRegion[i] / 10.0D + 1.0D) / 2.0D;
double d10 = (d9 < 0.0D ? d7 : (d9 > 1.0D ? d8 : d7 + (d8 - d7) * d9)) - d6;
if (j2 > 29) {
double d11 = ((j2 - 29) / 3.0F);
d10 = d10 * (1.0D - d11) + -10.0D * d11;
}
this.heightMap[i] = d10;
++i;
}
}
}
}
use of net.minecraft.world.gen.ChunkGeneratorSettings in project RFToolsDimensions by McJty.
the class UpsideDownTerrainGenerator method generateHeightmap.
private void generateHeightmap(int chunkX4, int chunkY4, int chunkZ4) {
ChunkGeneratorSettings settings = provider.getSettings();
this.depthRegion = this.depthNoise.generateNoiseOctaves(this.depthRegion, chunkX4, chunkZ4, 5, 5, settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.depthNoiseScaleExponent);
float f = settings.coordinateScale;
float f1 = settings.heightScale;
this.mainNoiseRegion = this.mainPerlinNoise.generateNoiseOctaves(this.mainNoiseRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f / settings.mainNoiseScaleX, f1 / settings.mainNoiseScaleY, f / settings.mainNoiseScaleZ);
this.minLimitRegion = this.minLimitPerlinNoise.generateNoiseOctaves(this.minLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
this.maxLimitRegion = this.maxLimitPerlinNoise.generateNoiseOctaves(this.maxLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
int i = 0;
int j = 0;
boolean domaze = false;
boolean elevated = false;
boolean donearlands = provider.dimensionInformation.getTerrainType() == TerrainType.TERRAIN_NEARLANDS;
if (donearlands) {
elevated = true;
}
if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
domaze = true;
long s2 = (((chunkX4 >> 2) + provider.seed + 13) * 314) + (chunkZ4 >> 2) * 17L;
Random rand = new Random(s2);
// Skip one.
rand.nextFloat();
elevated = ((chunkX4 >> 2) & 1) == 0;
if (rand.nextFloat() < .2f) {
elevated = !elevated;
}
}
if (donearlands) {
int cx = chunkX4 >> 2;
int cz = chunkZ4 >> 2;
if (Math.abs(cx) < 5 && Math.abs(cz) < 5) {
elevated = false;
}
}
if (provider.biomesForGeneration == null) {
Logging.log("Dimension " + world.provider.getDimension() + " has a problem! Ignoring for now.");
return;
}
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 5; ++l) {
float f2 = 0.0F;
float f3 = 0.0F;
float f4 = 0.0F;
Biome Biome = provider.biomesForGeneration[k + 2 + (l + 2) * 10];
for (int j1 = -2; j1 <= 2; ++j1) {
for (int k1 = -2; k1 <= 2; ++k1) {
Biome Biome1 = provider.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10];
float f5 = provider.getSettings().biomeDepthOffSet + Biome1.getBaseHeight() * provider.getSettings().biomeDepthWeight;
float f6 = provider.getSettings().biomeScaleOffset + Biome1.getHeightVariation() * provider.getSettings().biomeScaleWeight;
if (domaze || donearlands) {
if (f5 > 0.0F && elevated) {
if (provider.worldType == WorldType.AMPLIFIED) {
f5 = 2.0F + f5 * 1.5f;
f6 = 1.0F + f6 * 3.0f;
} else {
f5 = 2.0F + f5;
f6 = 0.5F + f6 * 1.5f;
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0f) {
f5 = 0.5F + f5 * 1.5F;
f6 = 0.5F + f6 * 2.0F;
} else {
f6 = f6 * 0.5F;
}
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0F) {
f5 = 1.0F + f5 * 2.0F;
f6 = 1.0F + f6 * 4.0F;
}
}
float f7 = biomeWeights[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F);
if (Biome1.getBaseHeight() > Biome.getBaseHeight()) {
f7 /= 2.0F;
}
f2 += f6 * f7;
f3 += f5 * f7;
f4 += f7;
}
}
f2 /= f4;
f3 /= f4;
f2 = f2 * 0.9F + 0.1F;
f3 = (f3 * 4.0F - 1.0F) / 8.0F;
double d12 = this.depthRegion[j] / 8000.0D;
if (d12 < 0.0D) {
d12 = -d12 * 0.3D;
}
d12 = d12 * 3.0D - 2.0D;
if (d12 < 0.0D) {
d12 /= 2.0D;
if (d12 < -1.0D) {
d12 = -1.0D;
}
d12 /= 1.4D;
d12 /= 2.0D;
} else {
if (d12 > 1.0D) {
d12 = 1.0D;
}
d12 /= 8.0D;
}
++j;
double d13 = f3;
double d14 = f2;
d13 += d12 * 0.2D;
d13 = d13 * 8.5D / 8.0D;
double d5 = 8.5D + d13 * 4.0D;
for (int j2 = 0; j2 < 33; ++j2) {
double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
if (d6 < 0.0D) {
d6 *= 4.0D;
}
double d7 = this.minLimitRegion[i] / 512.0D;
double d8 = this.maxLimitRegion[i] / 512.0D;
double d9 = (this.mainNoiseRegion[i] / 10.0D + 1.0D) / 2.0D;
double d10 = (d9 < 0.0D ? d7 : (d9 > 1.0D ? d8 : d7 + (d8 - d7) * d9)) - d6;
if (j2 > 29) {
double d11 = ((j2 - 29) / 3.0F);
d10 = d10 * (1.0D - d11) + -10.0D * d11;
}
this.heightMap[i] = d10;
++i;
}
}
}
}
Aggregations