Program: 166007
Project: 166007
Buggy source:
@Override public void constructDimension(List<Pair<DimletKey,List<DimletKey>>> dimlets,Random random,DimensionInformation dimensionInformation){
  TerrainType terrainType=dimensionInformation.getTerrainType();
  Set<FeatureType> featureTypes=dimensionInformation.getFeatureTypes();
  dimlets=DimensionInformation.extractType(DimletType.DIMLET_FEATURE,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomFeatureChance) {
      DimletKey key=DimletRandomizer.getRandomFeature(random,false);
      FeatureType featureType=DimletObjectMapping.idToFeatureType.get(key);
      if (!featureTypes.contains(featureType) && featureType.isTerrainSupported(terrainType)) {
        dimensionInformation.updateCostFactor(key);
        featureTypes.add(featureType);
        List<DimletKey> modifiers=Collections.emptyList();
        dimlets.add(Pair.of(key,modifiers));
      }
    }
  }
  Map<FeatureType,List<DimletKey>> modifiersForFeature=new HashMap<FeatureType,List<DimletKey>>();
  for (  Pair<DimletKey,List<DimletKey>> dimlet : dimlets) {
    DimletKey key=dimlet.getLeft();
    FeatureType featureType=DimletObjectMapping.idToFeatureType.get(key);
    featureTypes.add(featureType);
    modifiersForFeature.put(featureType,dimlet.getRight());
  }
  Block[] fluidsForLakes;
  if (featureTypes.contains(FeatureType.FEATURE_LAKES)) {
    List<BlockMeta> blocks=new ArrayList<BlockMeta>();
    List<Block> fluids=new ArrayList<Block>();
    DimensionInformation.getMaterialAndFluidModifiers(modifiersForFeature.get(FeatureType.FEATURE_LAKES),blocks,fluids);
    if (fluids.isEmpty()) {
      while (random.nextFloat() < DimletConfiguration.randomLakeFluidChance) {
        DimletKey key=DimletRandomizer.getRandomFluidBlock(random);
        dimensionInformation.updateCostFactor(key);
        fluids.add(DimletObjectMapping.idToFluid.get(key));
      }
    }
 else     if (fluids.size() == 1 && fluids.get(0) == null) {
      fluids.clear();
    }
    fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
  }
 else {
    fluidsForLakes=new Block[0];
  }
  dimensionInformation.setFluidsForLakes(fluidsForLakes);
  BlockMeta[] extraOregen;
  if (featureTypes.contains(FeatureType.FEATURE_OREGEN)) {
    List<BlockMeta> blocks=new ArrayList<BlockMeta>();
    List<Block> fluids=new ArrayList<Block>();
    DimensionInformation.getMaterialAndFluidModifiers(modifiersForFeature.get(FeatureType.FEATURE_OREGEN),blocks,fluids);
    if (blocks.isEmpty()) {
      float chance=1.1f;
      while (random.nextFloat() < chance) {
        DimletKey key=DimletRandomizer.getRandomMaterialBlock(random,true);
        blocks.add(DimletObjectMapping.idToBlock.get(key));
        chance=chance * 0.80f;
      }
    }
    extraOregen=blocks.toArray(new BlockMeta[blocks.size()]);
  }
 else {
    extraOregen=new BlockMeta[0];
  }
  dimensionInformation.setExtraOregen(extraOregen);
  dimensionInformation.setTendrilBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_TENDRILS));
  dimensionInformation.setSphereBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_ORBS));
  dimensionInformation.setLiquidSphereBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_LIQUIDORBS));
  dimensionInformation.setLiquidSphereFluid(dimensionInformation.getFeatureLiquid(random,modifiersForFeature,FeatureType.FEATURE_LIQUIDORBS));
  dimensionInformation.setCanyonBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_CANYONS));
}

Fixed version (ground truth):
@Override public void constructDimension(List<Pair<DimletKey,List<DimletKey>>> dimlets,Random random,DimensionInformation dimensionInformation){
  TerrainType terrainType=dimensionInformation.getTerrainType();
  Set<FeatureType> featureTypes=dimensionInformation.getFeatureTypes();
  dimlets=DimensionInformation.extractType(DimletType.DIMLET_FEATURE,dimlets);
  if (dimlets.isEmpty()) {
    while (random.nextFloat() < DimletConfiguration.randomFeatureChance) {
      DimletKey key=DimletRandomizer.getRandomFeature(random,false);
      FeatureType featureType=DimletObjectMapping.idToFeatureType.get(key);
      if (!featureTypes.contains(featureType) && featureType.isTerrainSupported(terrainType)) {
        dimensionInformation.updateCostFactor(key);
        featureTypes.add(featureType);
        List<DimletKey> modifiers=Collections.emptyList();
        dimlets.add(Pair.of(key,modifiers));
      }
    }
  }
  Map<FeatureType,List<DimletKey>> modifiersForFeature=new HashMap<FeatureType,List<DimletKey>>();
  for (  Pair<DimletKey,List<DimletKey>> dimlet : dimlets) {
    DimletKey key=dimlet.getLeft();
    FeatureType featureType=DimletObjectMapping.idToFeatureType.get(key);
    featureTypes.add(featureType);
    modifiersForFeature.put(featureType,dimlet.getRight());
  }
  Block[] fluidsForLakes;
  if (featureTypes.contains(FeatureType.FEATURE_LAKES)) {
    List<BlockMeta> blocks=new ArrayList<BlockMeta>();
    List<Block> fluids=new ArrayList<Block>();
    DimensionInformation.getMaterialAndFluidModifiers(modifiersForFeature.get(FeatureType.FEATURE_LAKES),blocks,fluids);
    if (fluids.isEmpty()) {
      while (random.nextFloat() < DimletConfiguration.randomLakeFluidChance) {
        DimletKey key=DimletRandomizer.getRandomFluidBlock(random);
        dimensionInformation.updateCostFactor(key);
        fluids.add(DimletObjectMapping.idToFluid.get(key));
      }
    }
 else     if (fluids.size() == 1 && fluids.get(0) == null) {
      fluids.clear();
    }
    fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
  }
 else {
    fluidsForLakes=new Block[0];
  }
  dimensionInformation.setFluidsForLakes(fluidsForLakes);
  BlockMeta[] extraOregen;
  if (featureTypes.contains(FeatureType.FEATURE_OREGEN)) {
    List<BlockMeta> blocks=new ArrayList<BlockMeta>();
    List<Block> fluids=new ArrayList<Block>();
    DimensionInformation.getMaterialAndFluidModifiers(modifiersForFeature.get(FeatureType.FEATURE_OREGEN),blocks,fluids);
    if (blocks.isEmpty()) {
      float chance=1.1f;
      while (random.nextFloat() < chance) {
        DimletKey key=DimletRandomizer.getRandomMaterialBlock(random,true);
        BlockMeta bm=DimletObjectMapping.idToBlock.get(key);
        if (bm != null) {
          blocks.add(bm);
          chance=chance * 0.80f;
        }
      }
    }
    extraOregen=blocks.toArray(new BlockMeta[blocks.size()]);
  }
 else {
    extraOregen=new BlockMeta[0];
  }
  dimensionInformation.setExtraOregen(extraOregen);
  dimensionInformation.setTendrilBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_TENDRILS));
  dimensionInformation.setSphereBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_ORBS));
  dimensionInformation.setLiquidSphereBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_LIQUIDORBS));
  dimensionInformation.setLiquidSphereFluid(dimensionInformation.getFeatureLiquid(random,modifiersForFeature,FeatureType.FEATURE_LIQUIDORBS));
  dimensionInformation.setCanyonBlock(dimensionInformation.getFeatureBlock(random,modifiersForFeature,FeatureType.FEATURE_CANYONS));
}