Program: 166105
Project: 166105
Buggy source:
private void generateDungeon(World world,Random random,int midx,int starty,int midz){
  boolean do_small_antenna=random.nextInt(4) == 0;
  boolean do_extra_feature=random.nextInt(4) == 0;
  int color=random.nextInt(3);
  if (color == 0) {
    color=3;
  }
 else   if (color == 1) {
    color=9;
  }
 else {
    color=11;
  }
  for (int x=midx - 3; x <= midx + 3; x++) {
    for (int z=midz - 3; z <= midz + 3; z++) {
      boolean corner=(x == midx - 3 || x == midx + 3) && (z == midz - 3 || z == midz + 3);
      boolean xside=x == midx - 3 || x == midx + 3;
      boolean zside=z == midz - 3 || z == midz + 3;
      boolean antenna=(x == midx - 2 && z == midz - 2);
      boolean small_antenna=do_small_antenna && (x == midx + 2 && z == midz + 2);
      world.setBlock(x,starty,z,Blocks.double_stone_slab,0,2);
      if (corner) {
        world.setBlock(x,starty + 1,z,Blocks.quartz_block,0,2);
        world.setBlock(x,starty + 2,z,Blocks.quartz_block,0,2);
        world.setBlock(x,starty + 3,z,Blocks.quartz_block,0,2);
      }
 else       if (xside) {
        world.setBlock(x,starty + 1,z,Blocks.stained_hardened_clay,color,2);
        if (z >= midz - 1 && z <= midz + 1) {
          world.setBlock(x,starty + 2,z,Blocks.glass_pane,0,2);
        }
 else {
          world.setBlock(x,starty + 2,z,Blocks.stained_hardened_clay,color,2);
        }
        world.setBlock(x,starty + 3,z,Blocks.stained_hardened_clay,color,2);
      }
 else       if (zside) {
        world.setBlock(x,starty + 1,z,Blocks.stained_hardened_clay,color,2);
        world.setBlock(x,starty + 2,z,Blocks.stained_hardened_clay,color,2);
        world.setBlock(x,starty + 3,z,Blocks.stained_hardened_clay,color,2);
      }
 else {
        world.setBlockToAir(x,starty + 1,z);
        world.setBlockToAir(x,starty + 2,z);
        world.setBlockToAir(x,starty + 3,z);
      }
      if (antenna) {
        world.setBlock(x,starty + 4,z,Blocks.double_stone_slab,0,2);
        world.setBlock(x,starty + 5,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 6,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 7,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 8,z,Blocks.glowstone,0,2);
      }
 else       if (small_antenna) {
        world.setBlock(x,starty + 4,z,Blocks.double_stone_slab,0,2);
        world.setBlock(x,starty + 5,z,Blocks.iron_bars,0,2);
        world.setBlockToAir(x,starty + 6,z);
        world.setBlockToAir(x,starty + 7,z);
        world.setBlockToAir(x,starty + 8,z);
      }
 else {
        world.setBlock(x,starty + 4,z,Blocks.stone_slab,0,2);
        world.setBlockToAir(x,starty + 5,z);
        world.setBlockToAir(x,starty + 6,z);
        world.setBlockToAir(x,starty + 7,z);
        world.setBlockToAir(x,starty + 8,z);
      }
      WorldGenerationTools.fillEmptyWithStone(world,x,starty - 1,z);
    }
  }
  if (do_extra_feature) {
    if (!WorldGenerationTools.isSolid(world,midx + 4,starty,midz - 3)) {
      world.setBlock(midx + 4,starty,midz - 3,Blocks.iron_bars,0,2);
    }
    world.setBlock(midx + 4,starty + 1,midz - 3,Blocks.iron_bars,0,2);
    world.setBlock(midx + 4,starty + 2,midz - 3,Blocks.iron_bars,0,2);
    if (!WorldGenerationTools.isSolid(world,midx + 5,starty,midz - 3)) {
      world.setBlock(midx + 5,starty,midz - 3,Blocks.stained_hardened_clay,color,2);
    }
    world.setBlock(midx + 5,starty + 1,midz - 3,Blocks.stained_hardened_clay,color,2);
    world.setBlock(midx + 5,starty + 2,midz - 3,Blocks.stained_hardened_clay,color,2);
    WorldGenerationTools.fillEmptyWithStone(world,midx + 4,starty - 1,midz - 3);
    WorldGenerationTools.fillEmptyWithStone(world,midx + 5,starty - 1,midz - 3);
  }
  for (int x=midx - 3; x <= midx + 3; x++) {
    for (int y=starty + 1; y <= starty + 3; y++) {
      world.setBlockToAir(x,y,midz - 4);
    }
  }
  world.setBlock(midx - 1,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx + 1,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx,starty + 1,midz - 3,Blocks.iron_door,1,2);
  world.setBlock(midx,starty + 2,midz - 3,Blocks.iron_door,8,2);
  world.setBlock(midx - 1,starty + 2,midz - 4,Blocks.stone_button,4,2);
  world.setBlock(midx + 1,starty + 2,midz - 2,Blocks.stone_button,3,2);
  world.setBlock(midx,starty + 3,midz + 3,Blocks.redstone_lamp,0,2);
  world.setBlock(midx,starty + 3,midz + 2,Blocks.lever,4,2);
  world.setBlock(midx + 2,starty + 1,midz - 2,Blocks.chest,0,2);
  TileEntityChest chest=(TileEntityChest)world.getTileEntity(midx + 2,starty + 1,midz - 2);
  for (int i=0; i < random.nextInt(2) + 2; i++) {
    chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()),new ItemStack(ModItems.unknownDimlet,random.nextInt(6) + 3));
  }
  WeightedRandomSelector.Distribution<Integer> goodDistribution=KnownDimletConfiguration.randomDimlets.createDistribution(0.01f);
  for (int i=0; i < random.nextInt(2) + 1; i++) {
    chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()),new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(goodDistribution)));
  }
  WeightedRandomSelector.Distribution<Integer> bestDistribution=KnownDimletConfiguration.randomDimlets.createDistribution(0.15f);
  EntityItemFrame frame1=spawnItemFrame(world,midx - 1,starty + 2,midz + 2);
  frame1.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution)));
  EntityItemFrame frame2=spawnItemFrame(world,midx,starty + 2,midz + 2);
  frame2.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution)));
  EntityItemFrame frame3=spawnItemFrame(world,midx + 1,starty + 2,midz + 2);
  frame3.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution)));
}

Fixed version (ground truth):
private void generateDungeon(World world,Random random,int midx,int starty,int midz){
  boolean do_small_antenna=random.nextInt(4) == 0;
  boolean do_extra_feature=random.nextInt(4) == 0;
  int color=random.nextInt(3);
  if (color == 0) {
    color=3;
  }
 else   if (color == 1) {
    color=9;
  }
 else {
    color=11;
  }
  for (int x=midx - 3; x <= midx + 3; x++) {
    for (int z=midz - 3; z <= midz + 3; z++) {
      boolean corner=(x == midx - 3 || x == midx + 3) && (z == midz - 3 || z == midz + 3);
      boolean xside=x == midx - 3 || x == midx + 3;
      boolean zside=z == midz - 3 || z == midz + 3;
      boolean antenna=(x == midx - 2 && z == midz - 2);
      boolean small_antenna=do_small_antenna && (x == midx + 2 && z == midz + 2);
      world.setBlock(x,starty,z,Blocks.double_stone_slab,0,2);
      if (corner) {
        world.setBlock(x,starty + 1,z,Blocks.quartz_block,0,2);
        world.setBlock(x,starty + 2,z,Blocks.quartz_block,0,2);
        world.setBlock(x,starty + 3,z,Blocks.quartz_block,0,2);
      }
 else       if (xside) {
        world.setBlock(x,starty + 1,z,Blocks.stained_hardened_clay,color,2);
        if (z >= midz - 1 && z <= midz + 1) {
          world.setBlock(x,starty + 2,z,Blocks.glass_pane,0,2);
        }
 else {
          world.setBlock(x,starty + 2,z,Blocks.stained_hardened_clay,color,2);
        }
        world.setBlock(x,starty + 3,z,Blocks.stained_hardened_clay,color,2);
      }
 else       if (zside) {
        world.setBlock(x,starty + 1,z,Blocks.stained_hardened_clay,color,2);
        world.setBlock(x,starty + 2,z,Blocks.stained_hardened_clay,color,2);
        world.setBlock(x,starty + 3,z,Blocks.stained_hardened_clay,color,2);
      }
 else {
        world.setBlockToAir(x,starty + 1,z);
        world.setBlockToAir(x,starty + 2,z);
        world.setBlockToAir(x,starty + 3,z);
      }
      if (antenna) {
        world.setBlock(x,starty + 4,z,Blocks.double_stone_slab,0,2);
        world.setBlock(x,starty + 5,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 6,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 7,z,Blocks.iron_bars,0,2);
        world.setBlock(x,starty + 8,z,Blocks.glowstone,0,2);
      }
 else       if (small_antenna) {
        world.setBlock(x,starty + 4,z,Blocks.double_stone_slab,0,2);
        world.setBlock(x,starty + 5,z,Blocks.iron_bars,0,2);
        world.setBlockToAir(x,starty + 6,z);
        world.setBlockToAir(x,starty + 7,z);
        world.setBlockToAir(x,starty + 8,z);
      }
 else {
        world.setBlock(x,starty + 4,z,Blocks.stone_slab,0,2);
        world.setBlockToAir(x,starty + 5,z);
        world.setBlockToAir(x,starty + 6,z);
        world.setBlockToAir(x,starty + 7,z);
        world.setBlockToAir(x,starty + 8,z);
      }
      WorldGenerationTools.fillEmptyWithStone(world,x,starty - 1,z);
    }
  }
  if (do_extra_feature) {
    if (!WorldGenerationTools.isSolid(world,midx + 4,starty,midz - 3)) {
      world.setBlock(midx + 4,starty,midz - 3,Blocks.iron_bars,0,2);
    }
    world.setBlock(midx + 4,starty + 1,midz - 3,Blocks.iron_bars,0,2);
    world.setBlock(midx + 4,starty + 2,midz - 3,Blocks.iron_bars,0,2);
    if (!WorldGenerationTools.isSolid(world,midx + 5,starty,midz - 3)) {
      world.setBlock(midx + 5,starty,midz - 3,Blocks.stained_hardened_clay,color,2);
    }
    world.setBlock(midx + 5,starty + 1,midz - 3,Blocks.stained_hardened_clay,color,2);
    world.setBlock(midx + 5,starty + 2,midz - 3,Blocks.stained_hardened_clay,color,2);
    WorldGenerationTools.fillEmptyWithStone(world,midx + 4,starty - 1,midz - 3);
    WorldGenerationTools.fillEmptyWithStone(world,midx + 5,starty - 1,midz - 3);
  }
  for (int x=midx - 3; x <= midx + 3; x++) {
    for (int y=starty + 1; y <= starty + 3; y++) {
      world.setBlockToAir(x,y,midz - 4);
    }
  }
  world.setBlock(midx - 1,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx + 1,starty,midz - 4,Blocks.double_stone_slab,0,2);
  world.setBlock(midx,starty + 1,midz - 3,Blocks.iron_door,1,2);
  world.setBlock(midx,starty + 2,midz - 3,Blocks.iron_door,8,2);
  world.setBlock(midx - 1,starty + 2,midz - 4,Blocks.stone_button,4,2);
  world.setBlock(midx + 1,starty + 2,midz - 2,Blocks.stone_button,3,2);
  world.setBlock(midx,starty + 3,midz + 3,Blocks.redstone_lamp,0,2);
  world.setBlock(midx,starty + 3,midz + 2,Blocks.lever,4,2);
  world.setBlock(midx + 2,starty + 1,midz - 2,Blocks.chest,0,2);
  TileEntityChest chest=(TileEntityChest)world.getTileEntity(midx + 2,starty + 1,midz - 2);
  for (int i=0; i < random.nextInt(2) + 2; i++) {
    chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()),new ItemStack(ModItems.unknownDimlet,random.nextInt(6) + 3));
  }
  WeightedRandomSelector.Distribution<Integer> goodDistribution=KnownDimletConfiguration.randomDimlets.createDistribution(0.01f);
  for (int i=0; i < random.nextInt(2) + 1; i++) {
    chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()),new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(goodDistribution,random)));
  }
  WeightedRandomSelector.Distribution<Integer> bestDistribution=KnownDimletConfiguration.randomDimlets.createDistribution(0.15f);
  EntityItemFrame frame1=spawnItemFrame(world,midx - 1,starty + 2,midz + 2);
  frame1.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution,random)));
  EntityItemFrame frame2=spawnItemFrame(world,midx,starty + 2,midz + 2);
  frame2.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution,random)));
  EntityItemFrame frame3=spawnItemFrame(world,midx + 1,starty + 2,midz + 2);
  frame3.setDisplayedItem(new ItemStack(ModItems.knownDimlet,1,KnownDimletConfiguration.getRandomDimlet(bestDistribution,random)));
}