diff --git a/src/minecraft/biomesoplenty/world/BeachNoisePerlin.java b/src/minecraft/biomesoplenty/world/BeachNoisePerlin.java deleted file mode 100644 index 8497b90c0..000000000 --- a/src/minecraft/biomesoplenty/world/BeachNoisePerlin.java +++ /dev/null @@ -1,223 +0,0 @@ -package biomesoplenty.world; - -import java.util.Random; - -import net.minecraft.world.gen.NoiseGenerator; - -public class BeachNoisePerlin extends NoiseGenerator -{ - - public BeachNoisePerlin() - { - this(new Random()); - } - - public BeachNoisePerlin(Random random) - { - permutations = new int[512]; - xCoord = random.nextDouble() * 256D; - yCoord = random.nextDouble() * 256D; - zCoord = random.nextDouble() * 256D; - for (int i = 0; i < 256; i++) - { - permutations[i] = i; - } - - for (int j = 0; j < 256; j++) - { - int k = random.nextInt(256 - j) + j; - int l = permutations[j]; - permutations[j] = permutations[k]; - permutations[k] = l; - permutations[j + 256] = permutations[j]; - } - } - - public double generateNoise(double d, double d1, double d2) - { - double d3 = d + xCoord; - double d4 = d1 + yCoord; - double d5 = d2 + zCoord; - int i = (int)d3; - int j = (int)d4; - int k = (int)d5; - if (d3 < (double)i) - { - i--; - } - if (d4 < (double)j) - { - j--; - } - if (d5 < (double)k) - { - k--; - } - int l = i & 0xff; - int i1 = j & 0xff; - int j1 = k & 0xff; - d3 -= i; - d4 -= j; - d5 -= k; - double d6 = d3 * d3 * d3 * (d3 * (d3 * 6D - 15D) + 10D); - double d7 = d4 * d4 * d4 * (d4 * (d4 * 6D - 15D) + 10D); - double d8 = d5 * d5 * d5 * (d5 * (d5 * 6D - 15D) + 10D); - int k1 = permutations[l] + i1; - int l1 = permutations[k1] + j1; - int i2 = permutations[k1 + 1] + j1; - int j2 = permutations[l + 1] + i1; - int k2 = permutations[j2] + j1; - int l2 = permutations[j2 + 1] + j1; - return lerp(d8, lerp(d7, lerp(d6, grad(permutations[l1], d3, d4, d5), grad(permutations[k2], d3 - 1.0D, d4, d5)), lerp(d6, grad(permutations[i2], d3, d4 - 1.0D, d5), grad(permutations[l2], d3 - 1.0D, d4 - 1.0D, d5))), lerp(d7, lerp(d6, grad(permutations[l1 + 1], d3, d4, d5 - 1.0D), grad(permutations[k2 + 1], d3 - 1.0D, d4, d5 - 1.0D)), lerp(d6, grad(permutations[i2 + 1], d3, d4 - 1.0D, d5 - 1.0D), grad(permutations[l2 + 1], d3 - 1.0D, d4 - 1.0D, d5 - 1.0D)))); - } - - public final double lerp(double d, double d1, double d2) - { - return d1 + d * (d2 - d1); - } - - public final double func_4110_a(int i, double d, double d1) - { - int j = i & 0xf; - double d2 = (double)(1 - ((j & 8) >> 3)) * d; - double d3 = j >= 4 ? j != 12 && j != 14 ? d1 : d : 0.0D; - return ((j & 1) != 0 ? -d2 : d2) + ((j & 2) != 0 ? -d3 : d3); - } - - public final double grad(int i, double d, double d1, double d2) - { - int j = i & 0xf; - double d3 = j >= 8 ? d1 : d; - double d4 = j >= 4 ? j != 12 && j != 14 ? d2 : d : d1; - return ((j & 1) != 0 ? -d3 : d3) + ((j & 2) != 0 ? -d4 : d4); - } - - public double func_801_a(double d, double d1) - { - return generateNoise(d, d1, 0.0D); - } - - @SuppressWarnings("unused") - public void func_805_a(double ad[], double d, double d1, double d2, - int i, int j, int k, double d3, double d4, - double d5, double d6) - { - if(j == 1) - { - boolean flag = false; - boolean flag1 = false; - boolean flag2 = false; - boolean flag3 = false; - double d8 = 0.0D; - double d10 = 0.0D; - int j3 = 0; - double d12 = 1.0D / d6; - for(int i4 = 0; i4 < i; i4++) - { - double d14 = (d + (double)i4) * d3 + xCoord; - int j4 = (int)d14; - if(d14 < (double)j4) - { - j4--; - } - int k4 = j4 & 0xff; - d14 -= j4; - double d17 = d14 * d14 * d14 * (d14 * (d14 * 6D - 15D) + 10D); - for(int l4 = 0; l4 < k; l4++) - { - double d19 = (d2 + (double)l4) * d5 + zCoord; - int j5 = (int)d19; - if(d19 < (double)j5) - { - j5--; - } - int l5 = j5 & 0xff; - d19 -= j5; - double d21 = d19 * d19 * d19 * (d19 * (d19 * 6D - 15D) + 10D); - int l = permutations[k4] + 0; ///bwg4 made by ted80 - int j1 = permutations[l] + l5; - int k1 = permutations[k4 + 1] + 0; - int l1 = permutations[k1] + l5; - double d9 = lerp(d17, func_4110_a(permutations[j1], d14, d19), grad(permutations[l1], d14 - 1.0D, 0.0D, d19)); - double d11 = lerp(d17, grad(permutations[j1 + 1], d14, 0.0D, d19 - 1.0D), grad(permutations[l1 + 1], d14 - 1.0D, 0.0D, d19 - 1.0D)); - double d23 = lerp(d21, d9, d11); - ad[j3++] += d23 * d12; - } - - } - - return; - } - int i1 = 0; - double d7 = 1.0D / d6; - int i2 = -1; - boolean flag4 = false; - boolean flag5 = false; - boolean flag6 = false; - boolean flag7 = false; - boolean flag8 = false; - boolean flag9 = false; - double d13 = 0.0D; - double d15 = 0.0D; - double d16 = 0.0D; - double d18 = 0.0D; - for(int i5 = 0; i5 < i; i5++) - { - double d20 = (d + (double)i5) * d3 + xCoord; - int k5 = (int)d20; - if(d20 < (double)k5) - { - k5--; - } - int i6 = k5 & 0xff; - d20 -= k5; - double d22 = d20 * d20 * d20 * (d20 * (d20 * 6D - 15D) + 10D); - for(int j6 = 0; j6 < k; j6++) - { - double d24 = (d2 + (double)j6) * d5 + zCoord; - int k6 = (int)d24; - if(d24 < (double)k6) - { - k6--; - } - int l6 = k6 & 0xff; - d24 -= k6; - double d25 = d24 * d24 * d24 * (d24 * (d24 * 6D - 15D) + 10D); - for(int i7 = 0; i7 < j; i7++) - { - double d26 = (d1 + (double)i7) * d4 + yCoord; - int j7 = (int)d26; - if(d26 < (double)j7) - { - j7--; - } - int k7 = j7 & 0xff; - d26 -= j7; - double d27 = d26 * d26 * d26 * (d26 * (d26 * 6D - 15D) + 10D); - if(i7 == 0 || k7 != i2) - { - i2 = k7; - int j2 = permutations[i6] + k7; - int k2 = permutations[j2] + l6; - int l2 = permutations[j2 + 1] + l6; - int i3 = permutations[i6 + 1] + k7; - int k3 = permutations[i3] + l6; - int l3 = permutations[i3 + 1] + l6; - d13 = lerp(d22, grad(permutations[k2], d20, d26, d24), grad(permutations[k3], d20 - 1.0D, d26, d24)); - d15 = lerp(d22, grad(permutations[l2], d20, d26 - 1.0D, d24), grad(permutations[l3], d20 - 1.0D, d26 - 1.0D, d24)); - d16 = lerp(d22, grad(permutations[k2 + 1], d20, d26, d24 - 1.0D), grad(permutations[k3 + 1], d20 - 1.0D, d26, d24 - 1.0D)); - d18 = lerp(d22, grad(permutations[l2 + 1], d20, d26 - 1.0D, d24 - 1.0D), grad(permutations[l3 + 1], d20 - 1.0D, d26 - 1.0D, d24 - 1.0D)); - } - double d28 = lerp(d27, d13, d15); - double d29 = lerp(d27, d16, d18); - double d30 = lerp(d25, d28, d29); - ad[i1++] += d30 * d7; - } - } - } - } - private int permutations[]; - public double xCoord; - public double yCoord; - public double zCoord; -} diff --git a/src/minecraft/biomesoplenty/world/ChunkProviderPromised.java b/src/minecraft/biomesoplenty/world/ChunkProviderPromised.java index 3efbacfe2..c3c67c84f 100644 --- a/src/minecraft/biomesoplenty/world/ChunkProviderPromised.java +++ b/src/minecraft/biomesoplenty/world/ChunkProviderPromised.java @@ -25,45 +25,45 @@ import net.minecraftforge.event.terraingen.TerrainGen; public class ChunkProviderPromised implements IChunkProvider { - @SuppressWarnings("unused") - private Random rand; private Random endRNG; - private NoiseGeneratorOctaves noiseGen1; - private NoiseGeneratorOctaves noiseGen2; - private NoiseGeneratorOctaves noiseGen3; - public NoiseGeneratorOctaves noiseGen4; - public NoiseGeneratorOctaves noiseGen5; + private BOPNoiseOctaves field_912_k; + private BOPNoiseOctaves field_911_l; + private BOPNoiseOctaves field_910_m; + private BOPNoiseOctaves field_909_n; + private BOPNoiseOctaves field_908_o; + public BOPNoiseOctaves field_922_a; + public BOPNoiseOctaves field_921_b; private World endWorld; private double[] densities; - /** The biomes that are used to generate the chunk */ private BiomeGenBase[] biomesForGeneration; - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; - @SuppressWarnings("unused") - private double[] stoneNoise = new double[256]; + double field_4185_d[]; + double field_4184_e[]; + double field_4183_f[]; + double field_4182_g[]; + double field_4181_h[]; + int[][] field_73203_h = new int[32][32]; public ChunkProviderPromised(World par1World, long par2) { this.endWorld = par1World; this.endRNG = new Random(par2); - this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16); - this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16); - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); + field_912_k = new BOPNoiseOctaves(endRNG, 16); + field_911_l = new BOPNoiseOctaves(endRNG, 16); + field_910_m = new BOPNoiseOctaves(endRNG, 8); + field_909_n = new BOPNoiseOctaves(endRNG, 4); + field_908_o = new BOPNoiseOctaves(endRNG, 4); + field_922_a = new BOPNoiseOctaves(endRNG, 10); + field_921_b = new BOPNoiseOctaves(endRNG, 16); - NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; - noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.endRNG, noiseGens); - this.noiseGen1 = noiseGens[0]; - this.noiseGen2 = noiseGens[1]; - this.noiseGen3 = noiseGens[2]; - this.noiseGen4 = noiseGens[3]; - this.noiseGen5 = noiseGens[4]; + //NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; + //noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.endRNG, noiseGens); + //this.noiseGen1 = noiseGens[0]; + //this.noiseGen2 = noiseGens[1]; + //this.noiseGen3 = noiseGens[2]; + //this.noiseGen4 = noiseGens[3]; + //this.noiseGen5 = noiseGens[4]; } public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) @@ -238,6 +238,109 @@ public class ChunkProviderPromised implements IChunkProvider * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the * size. */ + + private double[] initializeNoiseField(double ad[], int i, int j, int k, int l, int i1, int j1) + { + if(ad == null) + { + ad = new double[l * i1 * j1]; + } + double d = 684.41200000000003D; + double d1 = 684.41200000000003D; + field_4182_g = field_922_a.generateNoiseOctaves(field_4182_g, i, k, l, j1, 1.121D, 1.121D, 0.5D); + field_4181_h = field_921_b.generateNoiseOctaves(field_4181_h, i, k, l, j1, 200D, 200D, 0.5D); + d *= 2D; + field_4185_d = field_910_m.generateNoiseOctaves(field_4185_d, i, j, k, l, i1, j1, d / 80D, d1 / 160D, d / 80D); + field_4184_e = field_912_k.generateNoiseOctaves(field_4184_e, i, j, k, l, i1, j1, d, d1, d); + field_4183_f = field_911_l.generateNoiseOctaves(field_4183_f, i, j, k, l, i1, j1, d, d1, d); + int k1 = 0; + int l1 = 0; + int i2 = 16 / l; + for(int j2 = 0; j2 < l; j2++) + { + int k2 = j2 * i2 + i2 / 2; + for(int l2 = 0; l2 < j1; l2++) + { + int i3 = l2 * i2 + i2 / 2; + double d3; + d3 = 0.5D; + double d4 = 1.0D - d3; + d4 *= d4; + d4 *= d4; + d4 = 1.0D - d4; + double d5 = (field_4182_g[l1] + 256D) / 512D; + d5 *= d4; + if(d5 > 1.0D) + { + d5 = 1.0D; + } + double d6 = field_4181_h[l1] / 8000D; + if(d6 < 0.0D) + { + d6 = -d6 * 0.29999999999999999D; + } + d6 = d6 * 3D - 2D; + if(d6 > 1.0D) + { + d6 = 1.0D; + } + d6 /= 8D; + d6 = 0.0D; + if(d5 < 0.0D) + { + d5 = 0.0D; + } + d5 += 0.5D; + d6 = (d6 * (double)i1) / 16D; + l1++; + double d7 = (double)i1 / 2D; + for(int j3 = 0; j3 < i1; j3++) + { + double d8 = 0.0D; + double d9 = (((double)j3 - d7) * 8D) / d5; + if(d9 < 0.0D) + { + d9 *= -1D; + } + double d10 = field_4184_e[k1] / 512D; + double d11 = field_4183_f[k1] / 512D; + double d12 = (field_4185_d[k1] / 10D + 1.0D) / 2D; + if(d12 < 0.0D) + { + d8 = d10; + } else + if(d12 > 1.0D) + { + d8 = d11; + } else + { + d8 = d10 + (d11 - d10) * d12; + } + d8 -= 8D; + int k3 = 32; + if(j3 > i1 - k3) + { + double d13 = (float)(j3 - (i1 - k3)) / ((float)k3 - 1.0F); + d8 = d8 * (1.0D - d13) + -30D * d13; + } + k3 = 8; + if(j3 < k3) + { + double d14 = (float)(k3 - j3) / ((float)k3 - 1.0F); + d8 = d8 * (1.0D - d14) + -30D * d14; + } + ad[k1] = d8; + k1++; + } + + } + + } + + return ad; + } + + /* private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); @@ -376,6 +479,7 @@ public class ChunkProviderPromised implements IChunkProvider return par1ArrayOfDouble; } + */ /** * Checks to see if a chunk exists at x, y