Program: 174533
Project: 174533
Buggy source:
@SuppressWarnings("String_Node_Str") public static InjectorResult create(World world,BlockPos pos,boolean drain){
  HashMap<Class<EntityGem>,Double> resultTable=new HashMap<Class<EntityGem>,Double>();
  HashMap<Class<EntityGem>,Double> defectivity=new HashMap<Class<EntityGem>,Double>();
  HashMap<Class<EntityGem>,Double> friction=new HashMap<Class<EntityGem>,Double>();
  boolean regionIsNotDrained=true;
  for (  String gem : ModEntities.GEMS.keySet()) {
    try {
      Class<EntityGem> gemClass=(Class<EntityGem>)ModEntities.GEMS.get(gem);
      HashMap<IBlockState,Double> yield=(HashMap<IBlockState,Double>)gemClass.getField((gem + "String_Node_Str").toUpperCase()).get(null);
      double defectivityRate=1.0;
      double frictionFactor=0.0;
      for (int x=-4; x <= 4; ++x) {
        for (int y=-4; y <= 4; ++y) {
          for (int z=-4; z <= 4; ++z) {
            BlockPos ore=pos.add(x,y,z);
            IBlockState state=world.getBlockState(ore);
            if (!resultTable.containsKey(gemClass)) {
              resultTable.put(gemClass,0.0);
            }
            if (yield.containsKey(state)) {
              resultTable.put(gemClass,resultTable.get(gemClass) + yield.get(state));
              frictionFactor+=0.0036;
              defectivityRate-=0.2;
            }
            if (state.getBlock() == ModBlocks.DRAINED_BLOCK) {
              regionIsNotDrained=false;
            }
            if (state.getMaterial() == Material.GRASS) {
              defectivityRate-=0.4;
            }
          }
        }
      }
      defectivity.put(gemClass,Math.max(0.0,Math.min(1.0,defectivityRate)));
      friction.put(gemClass,frictionFactor);
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + e.getMessage());
    }
  }
  boolean canSpawnGem=false;
  Class<? extends EntityGem> mostLikelyGem=null;
  double highestYield=0.0;
  for (  Class<EntityGem> gemClass : resultTable.keySet()) {
    if (!gemClass.getName().contains("String_Node_Str")) {
      boolean forget=world.rand.nextBoolean();
      if (resultTable.get(gemClass) > 0.1 && world.rand.nextInt((int)(resultTable.get(gemClass) * 10) + 1) == 0) {
        highestYield=resultTable.get(gemClass);
        mostLikelyGem=gemClass;
        canSpawnGem=true;
      }
 else {
        double result=resultTable.get(gemClass);
        if (result == highestYield && result > 0) {
          highestYield=forget ? resultTable.get(gemClass) : highestYield;
          mostLikelyGem=forget ? gemClass : mostLikelyGem;
          canSpawnGem=true;
        }
 else         if (result > highestYield && result > 0) {
          highestYield=resultTable.get(gemClass);
          mostLikelyGem=gemClass;
          canSpawnGem=true;
        }
      }
    }
  }
  if (highestYield <= 0.0 && regionIsNotDrained) {
    ChunkPos c=world.getChunkFromBlockCoords(pos).getPos();
    int chunkPos=(c.x + c.z) % ModEntities.MINERALS.size();
    mostLikelyGem=ModEntities.MINERALS.get(Math.abs(chunkPos));
    canSpawnGem=true;
  }
  EntityGem gemSpawned=null;
  try {
    gemSpawned=(EntityGem)(mostLikelyGem.getConstructors()[0].newInstance(world));
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.out.println("String_Node_Str" + e.getMessage());
    canSpawnGem=false;
  }
  ExitHole exitHole=null;
  if (drain && gemSpawned != null) {
    exitHole=ExitHole.create(world,pos,Math.ceil(gemSpawned.height),friction.get(gemSpawned.getClass()) >= 1.0F);
    exitHole.emerge(world);
    gemSpawned.setPosition(pos.getX() + 0.5,pos.getY(),pos.getZ() + 0.5);
  }
  if (drain) {
    for (int x=-4; x <= 4; ++x) {
      for (int y=-4; y <= 4; ++y) {
        for (int z=-4; z <= 4; ++z) {
          if (world.rand.nextBoolean()) {
            BlockPos ore=pos.add(x,y,z);
            drainBlock(world,ore);
          }
        }
      }
    }
  }
  return new InjectorResult(gemSpawned,pos,gemSpawned == null ? 0.0 : defectivity.get(gemSpawned.getClass()),!canSpawnGem,friction.get(gemSpawned.getClass()) >= 1.0F,exitHole);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static InjectorResult create(World world,BlockPos pos,boolean drain){
  HashMap<Class<EntityGem>,Double> resultTable=new HashMap<Class<EntityGem>,Double>();
  HashMap<Class<EntityGem>,Double> defectivity=new HashMap<Class<EntityGem>,Double>();
  HashMap<Class<EntityGem>,Double> friction=new HashMap<Class<EntityGem>,Double>();
  float drainedCount=0F;
  for (  String gem : ModEntities.GEMS.keySet()) {
    try {
      Class<EntityGem> gemClass=(Class<EntityGem>)ModEntities.GEMS.get(gem);
      HashMap<IBlockState,Double> yield=(HashMap<IBlockState,Double>)gemClass.getField((gem + "String_Node_Str").toUpperCase()).get(null);
      double defectivityRate=1.0;
      double frictionFactor=0.0;
      drainedCount=0F;
      for (int x=-4; x <= 4; ++x) {
        for (int y=-4; y <= 4; ++y) {
          for (int z=-4; z <= 4; ++z) {
            BlockPos ore=pos.add(x,y,z);
            IBlockState state=world.getBlockState(ore);
            if (!resultTable.containsKey(gemClass)) {
              resultTable.put(gemClass,0.0);
            }
            if (yield.containsKey(state)) {
              resultTable.put(gemClass,resultTable.get(gemClass) + yield.get(state));
              frictionFactor+=0.0036;
              defectivityRate-=0.2;
            }
            if (state.getBlock() == ModBlocks.DRAINED_BLOCK) {
              KAGIC.instance.chatInfoMessage("String_Node_Str" + drainedCount);
              drainedCount+=1;
            }
            if (state.getMaterial() == Material.GRASS) {
              defectivityRate-=0.4;
            }
          }
        }
      }
      defectivity.put(gemClass,Math.max(0.0,Math.min(1.0,defectivityRate)));
      friction.put(gemClass,frictionFactor);
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + e.getMessage());
    }
  }
  boolean canSpawnGem=false;
  Class<? extends EntityGem> mostLikelyGem=null;
  double highestYield=0.0;
  for (  Class<EntityGem> gemClass : resultTable.keySet()) {
    if (!gemClass.getName().contains("String_Node_Str")) {
      boolean forget=world.rand.nextBoolean();
      if (resultTable.get(gemClass) > 0.1 && world.rand.nextInt((int)(resultTable.get(gemClass) * 10) + 1) == 0) {
        highestYield=resultTable.get(gemClass);
        mostLikelyGem=gemClass;
        canSpawnGem=true;
      }
 else {
        double result=resultTable.get(gemClass);
        if (result == highestYield && result > 0) {
          highestYield=forget ? resultTable.get(gemClass) : highestYield;
          mostLikelyGem=forget ? gemClass : mostLikelyGem;
          canSpawnGem=true;
        }
 else         if (result > highestYield && result > 0) {
          highestYield=resultTable.get(gemClass);
          mostLikelyGem=gemClass;
          canSpawnGem=true;
        }
      }
    }
  }
  if (highestYield <= 0.0 && drainedCount / (9F * 9F * 9F) < InjectorResult.drainedPercentage) {
    ChunkPos c=world.getChunkFromBlockCoords(pos).getPos();
    int chunkPos=(c.x + c.z) % ModEntities.MINERALS.size();
    mostLikelyGem=ModEntities.MINERALS.get(Math.abs(chunkPos));
    canSpawnGem=true;
  }
  EntityGem gemSpawned=null;
  if (canSpawnGem) {
    try {
      gemSpawned=(EntityGem)(mostLikelyGem.getConstructors()[0].newInstance(world));
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + e.getMessage());
      canSpawnGem=false;
    }
  }
  ExitHole exitHole=null;
  if (drain && gemSpawned != null) {
    exitHole=ExitHole.create(world,pos,Math.ceil(gemSpawned.height),friction.get(gemSpawned.getClass()) >= 1.0F);
    exitHole.emerge(world);
    gemSpawned.setPosition(pos.getX() + 0.5,pos.getY(),pos.getZ() + 0.5);
  }
  if (drain) {
    for (int x=-4; x <= 4; ++x) {
      for (int y=-4; y <= 4; ++y) {
        for (int z=-4; z <= 4; ++z) {
          if (world.rand.nextBoolean()) {
            BlockPos ore=pos.add(x,y,z);
            drainBlock(world,ore);
          }
        }
      }
    }
  }
  return new InjectorResult(gemSpawned,pos,gemSpawned == null ? 0.0 : defectivity.get(gemSpawned.getClass()),!canSpawnGem,canSpawnGem ? friction.get(gemSpawned.getClass()) >= 1.0F : false,exitHole);
}