public Maze(long paramLong, int paramInt1, int paramInt2) { java.util.Random localRandom = new java.util.Random(paramLong); this.iteration = 0; this.diagonal = false; this.n_directions = 4; this.cde = new Key.Key_comparator(); this.u = new TreeSet(this.cde); this.size_x = paramInt1; this.size_y = paramInt2; this.cells = new Node[paramInt1, paramInt2]; for (int ii = 0; ii < paramInt1; ii++) { for (int jj = 0; jj < paramInt2; jj++) { this.cells[ii, jj] = new Node(ii, jj); } } int i = (int)(localRandom.nextDouble() * 2147483647.0D) % paramInt1; int j = (int)(localRandom.nextDouble() * 2147483647.0D) % paramInt2; this.original_start = (this.robot_cell = this.start = this.cells[i, j]); do { i = (int)(localRandom.nextDouble() * 2147483647.0D) % paramInt1; j = (int)(localRandom.nextDouble() * 2147483647.0D) % paramInt2; this.goal = this.cells[i, j]; } while ((this.start.X == this.goal.X) && (this.start.Y == this.goal.Y)); for (i = 0; i < paramInt1; i++) { for (j = 0; j < paramInt2; j++) { this.cells[i, j].h = (Math.Abs(i - this.goal.X) + Math.Abs(j - this.goal.Y)); this.cells[i, j].iteration = this.iteration; if ((this.cells[i, j] == this.start) || (this.cells[i, j] == this.goal) || (localRandom.nextDouble() > 0.25D)) { continue; } this.cells[i, j].real_type = 1; } } }
public NoiseGenerator2(Random random) { field_4316_e = new int[512]; field_4313_a = random.nextDouble()*256D; field_4312_b = random.nextDouble()*256D; field_4318_c = random.nextDouble()*256D; for (int i = 0; i < 256; i++) { field_4316_e[i] = i; } for (int j = 0; j < 256; j++) { int k = random.nextInt(256 - j) + j; int l = field_4316_e[j]; field_4316_e[j] = field_4316_e[k]; field_4316_e[k] = l; field_4316_e[j + 256] = field_4316_e[j]; } }
public NoiseGeneratorPerlin(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 override bool generate(World world, Random random, int i, int j, int k) { if (world.getBlockMaterial(i, j, k) != Material.water) { return false; } float f = random.nextFloat()*3.141593F; double d = (i + 8) + (MathHelper.sin(f)*numberOfBlocks)/8F; double d1 = (i + 8) - (MathHelper.sin(f)*numberOfBlocks)/8F; double d2 = (k + 8) + (MathHelper.cos(f)*numberOfBlocks)/8F; double d3 = (k + 8) - (MathHelper.cos(f)*numberOfBlocks)/8F; double d4 = j + random.nextInt(3) + 2; double d5 = j + random.nextInt(3) + 2; for (int l = 0; l <= numberOfBlocks; l++) { double d6 = d + ((d1 - d)*l)/numberOfBlocks; double d7 = d4 + ((d5 - d4)*l)/numberOfBlocks; double d8 = d2 + ((d3 - d2)*l)/numberOfBlocks; double d9 = (random.nextDouble()*numberOfBlocks)/16D; double d10 = (MathHelper.sin((l*3.141593F)/numberOfBlocks) + 1.0F)*d9 + 1.0D; double d11 = (MathHelper.sin((l*3.141593F)/numberOfBlocks) + 1.0F)*d9 + 1.0D; for (var i1 = (int) (d6 - d10/2D); i1 <= (int) (d6 + d10/2D); i1++) { for (var j1 = (int) (d7 - d11/2D); j1 <= (int) (d7 + d11/2D); j1++) { for (var k1 = (int) (d8 - d10/2D); k1 <= (int) (d8 + d10/2D); k1++) { double d12 = ((i1 + 0.5D) - d6)/(d10/2D); double d13 = ((j1 + 0.5D) - d7)/(d11/2D); double d14 = ((k1 + 0.5D) - d8)/(d10/2D); if (d12*d12 + d13*d13 + d14*d14 >= 1.0D) { continue; } int l1 = world.getBlockId(i1, j1, k1); if (l1 == Block.sand.blockID) { world.setBlock(i1, j1, k1, clayBlockId); } } } } } return true; }
public override bool generate(World world, Random random, int i, int j, int k) { i -= 8; for (k -= 8; j > 0 && world.isAirBlock(i, j, k); j--) { } j -= 4; var aflag = new bool[2048]; int l = random.nextInt(4) + 4; for (int i1 = 0; i1 < l; i1++) { double d = random.nextDouble()*6D + 3D; double d1 = random.nextDouble()*4D + 2D; double d2 = random.nextDouble()*6D + 3D; double d3 = random.nextDouble()*(16D - d - 2D) + 1.0D + d/2D; double d4 = random.nextDouble()*(8D - d1 - 4D) + 2D + d1/2D; double d5 = random.nextDouble()*(16D - d2 - 2D) + 1.0D + d2/2D; for (int j4 = 1; j4 < 15; j4++) { for (int k4 = 1; k4 < 15; k4++) { for (int l4 = 1; l4 < 7; l4++) { double d6 = (j4 - d3)/(d/2D); double d7 = (l4 - d4)/(d1/2D); double d8 = (k4 - d5)/(d2/2D); double d9 = d6*d6 + d7*d7 + d8*d8; if (d9 < 1.0D) { aflag[(j4*16 + k4)*8 + l4] = true; } } } } } for (int j1 = 0; j1 < 16; j1++) { for (int j2 = 0; j2 < 16; j2++) { for (int j3 = 0; j3 < 8; j3++) { bool flag = !aflag[(j1*16 + j2)*8 + j3] && (j1 < 15 && aflag[((j1 + 1)*16 + j2)*8 + j3] || j1 > 0 && aflag[((j1 - 1)*16 + j2)*8 + j3] || j2 < 15 && aflag[(j1*16 + (j2 + 1))*8 + j3] || j2 > 0 && aflag[(j1*16 + (j2 - 1))*8 + j3] || j3 < 7 && aflag[(j1*16 + j2)*8 + (j3 + 1)] || j3 > 0 && aflag[(j1*16 + j2)*8 + (j3 - 1)]); if (!flag) { continue; } Material material = world.getBlockMaterial(i + j1, j + j3, k + j2); if (j3 >= 4 && material.getIsLiquid()) { return false; } if (j3 < 4 && !material.isSolid() && world.getBlockId(i + j1, j + j3, k + j2) != field_15005_a) { return false; } } } } for (int k1 = 0; k1 < 16; k1++) { for (int k2 = 0; k2 < 16; k2++) { for (int k3 = 0; k3 < 8; k3++) { if (aflag[(k1*16 + k2)*8 + k3]) { world.setBlock(i + k1, j + k3, k + k2, k3 < 4 ? field_15005_a : 0); } } } } for (int l1 = 0; l1 < 16; l1++) { for (int l2 = 0; l2 < 16; l2++) { for (int l3 = 4; l3 < 8; l3++) { if (aflag[(l1*16 + l2)*8 + l3] && world.getBlockId(i + l1, (j + l3) - 1, k + l2) == Block.dirt.blockID && world.getSavedLightValue(EnumSkyBlock.Sky, i + l1, j + l3, k + l2) > 0) { world.setBlock(i + l1, (j + l3) - 1, k + l2, Block.grass.blockID); } } } } if (Block.blocksList[field_15005_a].blockMaterial == Material.lava) { for (int i2 = 0; i2 < 16; i2++) { for (int i3 = 0; i3 < 16; i3++) { for (int i4 = 0; i4 < 8; i4++) { bool flag1 = !aflag[(i2*16 + i3)*8 + i4] && (i2 < 15 && aflag[((i2 + 1)*16 + i3)*8 + i4] || i2 > 0 && aflag[((i2 - 1)*16 + i3)*8 + i4] || i3 < 15 && aflag[(i2*16 + (i3 + 1))*8 + i4] || i3 > 0 && aflag[(i2*16 + (i3 - 1))*8 + i4] || i4 < 7 && aflag[(i2*16 + i3)*8 + (i4 + 1)] || i4 > 0 && aflag[(i2*16 + i3)*8 + (i4 - 1)]); if (flag1 && (i4 < 4 || random.nextInt(2) != 0) && world.getBlockMaterial(i + i2, j + i4, k + i3).isSolid()) { world.setBlock(i + i2, j + i4, k + i3, Block.stone.blockID); } } } } } return true; }
public override void updateTick(World world, int i, int j, int k, Random random) { bool flag = func_22016_g(world, i, j, k); for (; torchUpdates.size() > 0 && world.getWorldTime() - ((RedstoneUpdateInfo) torchUpdates.get(0)).updateTime > 100L; torchUpdates.remove(0)) { } if (torchActive) { if (flag) { world.setBlockAndMetadataWithNotify(i, j, k, torchRedstoneIdle.blockID, world.getBlockMetadata(i, j, k)); if (checkForBurnout(world, i, j, k, true)) { world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat())*0.8F); for (int l = 0; l < 5; l++) { double d = i + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D; double d1 = j + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D; double d2 = k + random.nextDouble()*0.59999999999999998D + 0.20000000000000001D; world.spawnParticle("smoke", d, d1, d2, 0.0D, 0.0D, 0.0D); } } } } else if (!flag && !checkForBurnout(world, i, j, k, false)) { world.setBlockAndMetadataWithNotify(i, j, k, torchRedstoneActive.blockID, world.getBlockMetadata(i, j, k)); } }