///<summary> /// generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the /// size. ///</summary> private double[] InitializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } if (Field_35388_l == null) { Field_35388_l = new float[25]; for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { float f = 10F / MathHelper2.Sqrt_float((float)(i * i + j * j) + 0.2F); Field_35388_l[i + 2 + (j + 2) * 5] = f; } } } double d = 684.41200000000003D; double d1 = 684.41200000000003D; Noise5 = NoiseGen5.GenerateNoiseOctaves(Noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); Noise6 = NoiseGen6.GenerateNoiseOctaves(Noise6, par2, par4, par5, par7, 200D, 200D, 0.5D); Noise3 = noiseGen3.GenerateNoiseOctaves(Noise3, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D); Noise1 = noiseGen1.GenerateNoiseOctaves(Noise1, par2, par3, par4, par5, par6, par7, d, d1, d); Noise2 = noiseGen2.GenerateNoiseOctaves(Noise2, par2, par3, par4, par5, par6, par7, d, d1, d); par2 = par4 = 0; int k = 0; int l = 0; for (int i1 = 0; i1 < par5; i1++) { for (int j1 = 0; j1 < par7; j1++) { float f1 = 0.0F; float f2 = 0.0F; float f3 = 0.0F; byte byte0 = 2; BiomeGenBase biomegenbase = biomesForGeneration[i1 + 2 + (j1 + 2) * (par5 + 5)]; for (int k1 = -byte0; k1 <= byte0; k1++) { for (int l1 = -byte0; l1 <= byte0; l1++) { BiomeGenBase biomegenbase1 = biomesForGeneration[i1 + k1 + 2 + (j1 + l1 + 2) * (par5 + 5)]; float f4 = Field_35388_l[k1 + 2 + (l1 + 2) * 5] / (biomegenbase1.MinHeight + 2.0F); if (biomegenbase1.MinHeight > biomegenbase.MinHeight) { f4 /= 2.0F; } f1 += biomegenbase1.MaxHeight * f4; f2 += biomegenbase1.MinHeight * f4; f3 += f4; } } f1 /= f3; f2 /= f3; f1 = f1 * 0.9F + 0.1F; f2 = (f2 * 4F - 1.0F) / 8F; double d2 = Noise6[l] / 8000D; if (d2 < 0.0F) { d2 = -d2 * 0.29999999999999999D; } d2 = d2 * 3D - 2D; if (d2 < 0.0F) { d2 /= 2D; if (d2 < -1D) { d2 = -1D; } d2 /= 1.3999999999999999D; d2 /= 2D; } else { if (d2 > 1.0D) { d2 = 1.0D; } d2 /= 8D; } l++; for (int i2 = 0; i2 < par6; i2++) { double d3 = f2; double d4 = f1; d3 += d2 * 0.20000000000000001D; d3 = (d3 * (double)par6) / 16D; double d5 = (double)par6 / 2D + d3 * 4D; double d6 = 0.0F; double d7 = (((double)i2 - d5) * 12D * 128D) / 128D / d4; if (d7 < 0.0F) { d7 *= 4D; } double d8 = Noise1[k] / 512D; double d9 = Noise2[k] / 512D; double d10 = (Noise3[k] / 10D + 1.0D) / 2D; if (d10 < 0.0F) { d6 = d8; } else if (d10 > 1.0D) { d6 = d9; } else { d6 = d8 + (d9 - d8) * d10; } d6 -= d7; if (i2 > par6 - 4) { double d11 = (float)(i2 - (par6 - 4)) / 3F; d6 = d6 * (1.0D - d11) + -10D * d11; } par1ArrayOfDouble[k] = d6; k++; } } } return(par1ArrayOfDouble); }
///<summary> /// Replaces the stone that was placed in with blocks that match the biome ///</summary> public void ReplaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) { byte byte0 = 63; double d = 0.03125D; stoneNoise = noiseGen4.GenerateNoiseOctaves(stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d * 2D, d * 2D, d * 2D); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[j + i * 16]; float f = biomegenbase.GetFloatTemperature(); int k = (int)(stoneNoise[i + j * 16] / 3D + 3D + rand.NextDouble() * 0.25D); int l = -1; byte byte1 = biomegenbase.TopBlock; byte byte2 = biomegenbase.FillerBlock; for (int i1 = 127; i1 >= 0; i1--) { int j1 = (j * 16 + i) * 128 + i1; if (i1 <= 0 + rand.Next(5)) { par3ArrayOfByte[j1] = (byte)Block.Bedrock.BlockID; continue; } byte byte3 = par3ArrayOfByte[j1]; if (byte3 == 0) { l = -1; continue; } if (byte3 != Block.Stone.BlockID) { continue; } if (l == -1) { if (k <= 0) { byte1 = 0; byte2 = (byte)Block.Stone.BlockID; } else if (i1 >= byte0 - 4 && i1 <= byte0 + 1) { byte1 = biomegenbase.TopBlock; byte2 = biomegenbase.FillerBlock; } if (i1 < byte0 && byte1 == 0) { if (f < 0.15F) { byte1 = (byte)Block.Ice.BlockID; } else { byte1 = (byte)Block.WaterStill.BlockID; } } l = k; if (i1 >= byte0 - 1) { par3ArrayOfByte[j1] = byte1; } else { par3ArrayOfByte[j1] = byte2; } continue; } if (l <= 0) { continue; } l--; par3ArrayOfByte[j1] = byte2; if (l == 0 && byte2 == Block.Sand.BlockID) { l = rand.Next(4); byte2 = (byte)Block.SandStone.BlockID; } } } } }
public void Func_4058_b(int par1, int par2, byte[] par3ArrayOfByte) { byte byte0 = 64; double d = 0.03125D; slowsandNoise = slowsandGravelNoiseGen.GenerateNoiseOctaves(slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d, d, 1.0D); gravelNoise = slowsandGravelNoiseGen.GenerateNoiseOctaves(gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, d, 1.0D, d); netherrackExclusivityNoise = netherrackExculsivityNoiseGen.GenerateNoiseOctaves(netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d * 2D, d * 2D, d * 2D); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { bool flag = slowsandNoise[i + j * 16] + hellRNG.NextDouble() * 0.20000000000000001D > 0.0F; bool flag1 = gravelNoise[i + j * 16] + hellRNG.NextDouble() * 0.20000000000000001D > 0.0F; int k = (int)(netherrackExclusivityNoise[i + j * 16] / 3D + 3D + hellRNG.NextDouble() * 0.25D); int l = -1; byte byte1 = (byte)Block.Netherrack.BlockID; byte byte2 = (byte)Block.Netherrack.BlockID; for (int i1 = 127; i1 >= 0; i1--) { int j1 = (j * 16 + i) * 128 + i1; if (i1 >= 127 - hellRNG.Next(5)) { par3ArrayOfByte[j1] = (byte)Block.Bedrock.BlockID; continue; } if (i1 <= 0 + hellRNG.Next(5)) { par3ArrayOfByte[j1] = (byte)Block.Bedrock.BlockID; continue; } byte byte3 = par3ArrayOfByte[j1]; if (byte3 == 0) { l = -1; continue; } if (byte3 != Block.Netherrack.BlockID) { continue; } if (l == -1) { if (k <= 0) { byte1 = 0; byte2 = (byte)Block.Netherrack.BlockID; } else if (i1 >= byte0 - 4 && i1 <= byte0 + 1) { byte1 = (byte)Block.Netherrack.BlockID; byte2 = (byte)Block.Netherrack.BlockID; if (flag1) { byte1 = (byte)Block.Gravel.BlockID; } if (flag1) { byte2 = (byte)Block.Netherrack.BlockID; } if (flag) { byte1 = (byte)Block.SlowSand.BlockID; } if (flag) { byte2 = (byte)Block.SlowSand.BlockID; } } if (i1 < byte0 && byte1 == 0) { byte1 = (byte)Block.LavaStill.BlockID; } l = k; if (i1 >= byte0 - 1) { par3ArrayOfByte[j1] = byte1; } else { par3ArrayOfByte[j1] = byte2; } continue; } if (l > 0) { l--; par3ArrayOfByte[j1] = byte2; } } } } }
private double[] Func_4057_a(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } double d = 684.41200000000003D; double d1 = 2053.2359999999999D; NoiseData4 = NetherNoiseGen6.GenerateNoiseOctaves(NoiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0F, 1.0D); NoiseData5 = NetherNoiseGen7.GenerateNoiseOctaves(NoiseData5, par2, par3, par4, par5, 1, par7, 100D, 0.0F, 100D); NoiseData1 = netherNoiseGen3.GenerateNoiseOctaves(NoiseData1, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 60D, d / 80D); NoiseData2 = netherNoiseGen1.GenerateNoiseOctaves(NoiseData2, par2, par3, par4, par5, par6, par7, d, d1, d); NoiseData3 = netherNoiseGen2.GenerateNoiseOctaves(NoiseData3, par2, par3, par4, par5, par6, par7, d, d1, d); int i = 0; int j = 0; double[] ad = new double[par6]; for (int k = 0; k < par6; k++) { ad[k] = Math.Cos(((double)k * Math.PI * 6D) / (double)par6) * 2D; double d2 = k; if (k > par6 / 2) { d2 = par6 - 1 - k; } if (d2 < 4D) { d2 = 4D - d2; ad[k] -= d2 * d2 * d2 * 10D; } } for (int l = 0; l < par5; l++) { for (int i1 = 0; i1 < par7; i1++) { double d3 = (NoiseData4[j] + 256D) / 512D; if (d3 > 1.0D) { d3 = 1.0D; } double d4 = 0.0F; double d5 = NoiseData5[j] / 8000D; if (d5 < 0.0F) { d5 = -d5; } d5 = d5 * 3D - 3D; if (d5 < 0.0F) { d5 /= 2D; if (d5 < -1D) { d5 = -1D; } d5 /= 1.3999999999999999D; d5 /= 2D; d3 = 0.0F; } else { if (d5 > 1.0D) { d5 = 1.0D; } d5 /= 6D; } d3 += 0.5D; d5 = (d5 * (double)par6) / 16D; j++; for (int j1 = 0; j1 < par6; j1++) { double d6 = 0.0F; double d7 = ad[j1]; double d8 = NoiseData2[i] / 512D; double d9 = NoiseData3[i] / 512D; double d10 = (NoiseData1[i] / 10D + 1.0D) / 2D; if (d10 < 0.0F) { d6 = d8; } else if (d10 > 1.0D) { d6 = d9; } else { d6 = d8 + (d9 - d8) * d10; } d6 -= d7; if (j1 > par6 - 4) { double d11 = (float)(j1 - (par6 - 4)) / 3F; d6 = d6 * (1.0D - d11) + -10D * d11; } if ((double)j1 < d4) { double d12 = (d4 - (double)j1) / 4D; if (d12 < 0.0F) { d12 = 0.0F; } if (d12 > 1.0D) { d12 = 1.0D; } d6 = d6 * (1.0D - d12) + -10D * d12; } par1ArrayOfDouble[i] = d6; i++; } } } return(par1ArrayOfDouble); }
private double[] Func_40379_a(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; NoiseData4 = NoiseGen4.GenerateNoiseOctaves(NoiseData4, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); NoiseData5 = NoiseGen5.GenerateNoiseOctaves(NoiseData5, par2, par4, par5, par7, 200D, 200D, 0.5D); d *= 2D; NoiseData1 = noiseGen3.GenerateNoiseOctaves(NoiseData1, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D); NoiseData2 = noiseGen1.GenerateNoiseOctaves(NoiseData2, par2, par3, par4, par5, par6, par7, d, d1, d); NoiseData3 = noiseGen2.GenerateNoiseOctaves(NoiseData3, par2, par3, par4, par5, par6, par7, d, d1, d); int i = 0; int j = 0; for (int k = 0; k < par5; k++) { for (int l = 0; l < par7; l++) { double d2 = (NoiseData4[j] + 256D) / 512D; if (d2 > 1.0D) { d2 = 1.0D; } double d3 = NoiseData5[j] / 8000D; if (d3 < 0.0F) { d3 = -d3 * 0.29999999999999999D; } d3 = d3 * 3D - 2D; float f = (float)((k + par2) - 0) / 1.0F; float f1 = (float)((l + par4) - 0) / 1.0F; float f2 = 100F - MathHelper2.Sqrt_float(f * f + f1 * f1) * 8F; if (f2 > 80F) { f2 = 80F; } if (f2 < -100F) { f2 = -100F; } if (d3 > 1.0D) { d3 = 1.0D; } d3 /= 8D; d3 = 0.0F; if (d2 < 0.0F) { d2 = 0.0F; } d2 += 0.5D; d3 = (d3 * (double)par6) / 16D; j++; double d4 = (double)par6 / 2D; for (int i1 = 0; i1 < par6; i1++) { double d5 = 0.0F; double d6 = (((double)i1 - d4) * 8D) / d2; if (d6 < 0.0F) { d6 *= -1D; } double d7 = NoiseData2[i] / 512D; double d8 = NoiseData3[i] / 512D; double d9 = (NoiseData1[i] / 10D + 1.0D) / 2D; if (d9 < 0.0F) { d5 = d7; } else if (d9 > 1.0D) { d5 = d8; } else { d5 = d7 + (d8 - d7) * d9; } d5 -= 8D; d5 += f2; int j1 = 2; if (i1 > par6 / 2 - j1) { double d10 = (float)(i1 - (par6 / 2 - j1)) / 64F; if (d10 < 0.0F) { d10 = 0.0F; } if (d10 > 1.0D) { d10 = 1.0D; } d5 = d5 * (1.0D - d10) + -3000D * d10; } j1 = 8; if (i1 < j1) { double d11 = (float)(j1 - i1) / ((float)j1 - 1.0F); d5 = d5 * (1.0D - d11) + -30D * d11; } par1ArrayOfDouble[i] = d5; i++; } } } return(par1ArrayOfDouble); }