@Override public boolean generate( World world, Random rand, LevelSettings settings, Cardinal[] entrances, Coord origin) { int x = origin.getX(); int y = origin.getY(); int z = origin.getZ(); MetaBlock breadboard = new MetaBlock(Blocks.planks); Coord cursor; Coord start; Coord end; Cardinal dir = entrances[0]; start = new Coord(x, y, z); end = new Coord(start); start.add(Cardinal.reverse(dir), 9); end.add(dir, 9); Cardinal[] orth = Cardinal.getOrthogonal(dir); start.add(orth[0], 4); end.add(orth[1], 4); start.add(Cardinal.DOWN); end.add(Cardinal.UP, 3); WorldGenPrimitive.fillRectHollow( world, rand, start, end, new MetaBlock(Blocks.cobblestone), false, true); start = new Coord(x, y, z); start.add(orth[0], 2); end = new Coord(start); start.add(Cardinal.reverse(dir), 3); end.add(dir, 7); end.add(Cardinal.UP); WorldGenPrimitive.fillRectSolid(world, rand, start, end, breadboard, true, true); start.add(orth[1], 2); end.add(orth[1], 2); WorldGenPrimitive.fillRectSolid(world, rand, start, end, breadboard, true, true); start.add(orth[1], 2); end.add(orth[1], 2); WorldGenPrimitive.fillRectSolid(world, rand, start, end, breadboard, true, true); cursor = new Coord(x, y, z); cursor.add(orth[0], 2); launcher(world, rand, dir, cursor); cursor.add(orth[1], 2); launcher(world, rand, dir, cursor); cursor.add(orth[1], 2); launcher(world, rand, dir, cursor); cursor.add(dir, 6); launcher(world, rand, dir, cursor); cursor.add(orth[0], 2); launcher(world, rand, dir, cursor); cursor.add(orth[0], 2); launcher(world, rand, dir, cursor); start = new Coord(x, y, z); start.add(dir, 4); end = new Coord(start); start.add(orth[0], 2); end.add(orth[1], 2); end.add(dir, 2); WorldGenPrimitive.fillRectSolid(world, rand, start, end, new MetaBlock(Blocks.air), true, true); cursor = new Coord(x, y, z); cursor.add(dir, 2); Repeater.generate(world, rand, dir, 0, cursor); cursor.add(orth[0], 2); Repeater.generate(world, rand, dir, 0, cursor); cursor.add(orth[1], 4); Repeater.generate(world, rand, dir, 0, cursor); cursor = new Coord(x, y, z); cursor.add(Cardinal.reverse(dir), 3); cursor.add(orth[0]); Repeater.generate(world, rand, orth[0], 0, cursor); cursor.add(orth[1], 2); Repeater.generate(world, rand, orth[1], 0, cursor); MetaBlock wire = new MetaBlock(Blocks.redstone_wire); start = new Coord(x, y, z); start.add(Cardinal.DOWN, 2); start.add(orth[1]); start.add(Cardinal.reverse(dir), 2); end = new Coord(start); end.add(orth[0], 5); end.add(Cardinal.reverse(dir), 5); end.add(Cardinal.DOWN, 2); WorldGenPrimitive.fillRectSolid( world, rand, start, end, new MetaBlock(Blocks.cobblestone), true, true); cursor = new Coord(x, y, z); cursor.add(Cardinal.reverse(dir), 3); cursor.add(Cardinal.DOWN); Torch.generate(world, Torch.REDSTONE, Cardinal.UP, cursor); cursor.add(Cardinal.DOWN); breadboard.setBlock(world, cursor); cursor.add(orth[0]); Torch.generate(world, Torch.REDSTONE, orth[0], cursor); cursor.add(orth[0]); wire.setBlock(world, cursor); cursor.add(Cardinal.reverse(dir)); wire.setBlock(world, cursor); cursor.add(Cardinal.reverse(dir)); wire.setBlock(world, cursor); cursor.add(orth[1]); wire.setBlock(world, cursor); cursor.add(orth[1]); wire.setBlock(world, cursor); cursor.add(dir); Repeater.generate(world, rand, Cardinal.reverse(dir), 4, cursor); cursor.add(Cardinal.UP); cursor.add(Cardinal.reverse(dir)); breadboard.setBlock(world, cursor); cursor.add(Cardinal.UP); Lever.generate(world, Cardinal.UP, cursor, true); return false; }
private void launcher(World world, Random rand, Cardinal dir, Coord pos) { Coord cursor = new Coord(pos); WorldGenPrimitive.setBlock(world, cursor, Blocks.redstone_wire); cursor.add(Cardinal.reverse(dir)); WorldGenPrimitive.setBlock(world, cursor, Blocks.redstone_wire); cursor.add(Cardinal.reverse(dir)); Repeater.generate(world, rand, dir, 0, cursor); cursor.add(Cardinal.reverse(dir)); cursor.add(Cardinal.UP); Dropper dropper = new Dropper(); dropper.generate(world, Cardinal.UP, cursor); for (int i = 0; i < 8; ++i) { dropper.add(world, cursor, i, new ItemStack(Items.dye, 1, i)); } dropper.add(world, cursor, 8, new ItemStack(Items.wooden_hoe)); cursor.add(Cardinal.UP); WorldGenPrimitive.setBlock(world, cursor, Blocks.hopper); cursor.add(dir); Comparator.generate(world, rand, dir, false, cursor); cursor.add(dir); WorldGenPrimitive.setBlock(world, cursor, Blocks.redstone_wire); cursor.add(dir); WorldGenPrimitive.setBlock(world, cursor, Blocks.redstone_wire); cursor.add(dir); Coord top = new Coord(pos.getX(), 80, pos.getZ()); while (top.getY() > pos.getY()) { top.add(Cardinal.DOWN); if (WorldGenPrimitive.getBlock(world, top).getBlock().getMaterial().isSolid()) break; } if (top.getY() >= 100) return; Coord start = new Coord(cursor); start.add(Cardinal.UP); start.add(dir); Coord end = new Coord(start); MetaBlock breadboard = new MetaBlock(Blocks.planks); boolean torch = false; while (end.getY() < top.getY()) { if (torch) { Torch.generate(world, Torch.REDSTONE, Cardinal.UP, cursor); } else { breadboard.setBlock(world, cursor); } torch = !torch; cursor.add(Cardinal.UP); end.add(Cardinal.UP); } if (torch) { cursor.add(Cardinal.DOWN); } Dispenser.generate(world, Cardinal.UP, cursor); for (int i = 0; i < 9; i++) { Dispenser.add(world, cursor, i, Firework.get(rand, 16 + rand.nextInt(16))); } cursor.add(Cardinal.UP); MetaBlock cob = new MetaBlock(Blocks.cobblestone); WorldGenPrimitive.fillRectSolid(world, rand, start, end, cob, true, true); start.add(Cardinal.reverse(dir), 2); end.add(Cardinal.reverse(dir), 2); WorldGenPrimitive.fillRectSolid(world, rand, start, end, cob, true, true); Cardinal[] orth = Cardinal.getOrthogonal(dir); start.add(dir); end.add(dir); Coord above = new Coord(end); above.add(Cardinal.UP, 10); List<Coord> tubeEnd = WorldGenPrimitive.getRectSolid(cursor, above); MetaBlock air = new MetaBlock(Blocks.air); for (Coord c : tubeEnd) { if (WorldGenPrimitive.getBlock(world, c).getBlock().getMaterial().isSolid()) { air.setBlock(world, c); } } start.add(orth[0]); end.add(orth[0]); WorldGenPrimitive.fillRectSolid(world, rand, start, end, cob, true, true); start.add(orth[1], 2); end.add(orth[1], 2); WorldGenPrimitive.fillRectSolid(world, rand, start, end, cob, true, true); }