Program: 178794
Project: 178794
Buggy source:
public static boolean placeRecursiveEmancipationGrill(Block initial){
  Region region=RegionManager.getRegion(initial.getLocation());
  int borderID=region.getInt(RegionSetting.GRILL_MATERIAL);
  if (initial.getTypeId() != borderID)   return false;
  Plane plane=Plane.XY;
  startRecurse(initial,borderID,BlockFace.UP,BlockFace.SOUTH,BlockFace.NORTH,BlockFace.DOWN);
  if (!complete) {
    startRecurse(initial,borderID,BlockFace.UP,BlockFace.WEST,BlockFace.EAST,BlockFace.DOWN);
    plane=Plane.YZ;
  }
  if (!complete) {
    startRecurse(initial,borderID,BlockFace.WEST,BlockFace.NORTH,BlockFace.SOUTH,BlockFace.EAST);
    plane=Plane.ZX;
  }
  if (!complete) {
    return false;
  }
  Util.info(border.size() + "String_Node_Str" + plane.toString());
  Vector max=initial.getLocation().toVector();
  Vector min=initial.getLocation().toVector();
  for (  Block block : border.toArray(new Block[0])) {
    if (block.getX() > max.getX())     max.setX(block.getX());
    if (block.getY() > max.getY())     max.setY(block.getY());
    if (block.getZ() > max.getZ())     max.setX(block.getZ());
    if (block.getX() < min.getX())     min.setX(block.getX());
    if (block.getY() < min.getY())     min.setY(block.getY());
    if (block.getZ() < min.getZ())     min.setX(block.getZ());
  }
  Util.info(max.toString() + "String_Node_Str" + min.toString());
  Vector range=new Vector(max.getX() - min.getX() + 1,max.getY() - min.getY() + 1,max.getZ() - min.getZ() + 1);
  double num1=0;
  double num2=0;
switch (plane) {
case XY:
    num1=range.getX();
  num2=range.getY();
break;
case YZ:
num1=range.getY();
num2=range.getZ();
break;
case ZX:
num1=range.getZ();
num2=range.getX();
break;
}
Util.info(num1 + "String_Node_Str" + num2);
Block[][] lines=new Block[(int)num1][(int)num2];
for (Block block : border.toArray(new Block[0])) {
switch (plane) {
case XY:
lines[(int)(block.getX() - min.getX())][(int)(block.getY() - min.getY())]=block;
break;
case YZ:
lines[(int)(block.getY() - min.getY())][(int)(block.getZ() - min.getZ())]=block;
break;
case ZX:
lines[(int)(block.getZ() - min.getZ())][(int)(block.getX() - min.getX())]=block;
break;
}
}
HashSet<Block> inside=new HashSet<Block>();
int i=0;
World world=initial.getWorld();
for (Block[] line : lines) {
boolean rep=false;
int j=0;
for (Block block : line) {
if (block == null) {
switch (plane) {
case XY:
block=world.getBlockAt((int)min.getX() + i,(int)min.getY() + j,(int)min.getZ());
break;
case YZ:
block=world.getBlockAt((int)min.getX(),(int)min.getY() + i,(int)min.getZ() + j);
break;
case ZX:
block=world.getBlockAt((int)min.getX() + j,(int)min.getY(),(int)min.getZ() + i);
break;
}
}
if (block.getTypeId() == borderID) rep=!rep;
 else if (rep) inside.add(block);
j++;
}
i++;
}
Util.info(inside.size() + "String_Node_Str");
Grill grill=new Grill(border,inside,initial);
grills.add(grill);
grill.create();
return true;
}

Fixed version (ground truth):
public static boolean placeRecursiveEmancipationGrill(Block initial){
  Region region=RegionManager.getRegion(initial.getLocation());
  int borderID=region.getInt(RegionSetting.GRILL_MATERIAL);
  if (initial.getTypeId() != borderID)   return false;
  startRecurse(initial,borderID,BlockFace.UP,BlockFace.SOUTH,BlockFace.NORTH,BlockFace.DOWN);
  BlockFace iOne=BlockFace.EAST;
  BlockFace iTwo=BlockFace.WEST;
  if (!complete) {
    startRecurse(initial,borderID,BlockFace.UP,BlockFace.WEST,BlockFace.EAST,BlockFace.DOWN);
    iOne=BlockFace.NORTH;
    iTwo=BlockFace.SOUTH;
  }
  if (!complete) {
    startRecurse(initial,borderID,BlockFace.WEST,BlockFace.NORTH,BlockFace.SOUTH,BlockFace.EAST);
    iOne=BlockFace.UP;
    iTwo=BlockFace.DOWN;
  }
  if (!complete) {
    return false;
  }
  Vector max=initial.getLocation().toVector();
  Vector min=initial.getLocation().toVector();
  for (  Block block : border.toArray(new Block[0])) {
    if (block.getX() > max.getX())     max.setX(block.getX());
    if (block.getY() > max.getY())     max.setY(block.getY());
    if (block.getZ() > max.getZ())     max.setX(block.getZ());
    if (block.getX() < min.getX())     min.setX(block.getX());
    if (block.getY() < min.getY())     min.setY(block.getY());
    if (block.getZ() < min.getZ())     min.setX(block.getZ());
  }
  HashSet<Block> inside=new HashSet<Block>();
  for (int y=(int)min.getY(); y <= (int)max.getY(); y++) {
    for (int x=(int)min.getX(); x <= (int)max.getX(); x++) {
      for (int z=(int)min.getZ(); z <= (int)max.getZ(); z++) {
        Block block=initial.getWorld().getBlockAt(x,y,z);
        if (border.contains(block) || inside.contains(block))         continue;
        boolean add=true;
        for (        BlockFace face : BlockFace.values()) {
          if (face == BlockFace.SELF || face == iOne || face == iTwo || face == BlockFace.NORTH_EAST || face == BlockFace.NORTH_WEST || face == BlockFace.SOUTH_EAST || face == BlockFace.SOUTH_WEST)           continue;
          Block temp=block.getFace(face);
          while (temp.getLocation().toVector().isInAABB(min,max)) {
            if (temp.getTypeId() == borderID)             break;
            temp=temp.getFace(face);
          }
          if (temp.getTypeId() != borderID) {
            add=false;
            break;
          }
        }
        if (add)         inside.add(block);
      }
    }
  }
  Grill grill=new Grill(border,inside,initial);
  grills.add(grill);
  grill.create();
  return true;
}