Program: 170327
Project: 170327
Buggy source:
/** 
 * Converts blocks in the world into a skin class.
 * @param world The world.
 * @param skinType The type of skin to save.
 * @param authorName Author name for this skin.
 * @param customName Custom display name for this skin.
 * @param tags Custom search tags for this skin.
 * @param xCoord Armourers x location.
 * @param yCoord Armourers y location.
 * @param zCoord Armourers z location.
 * @param direction Direction the armourer is facing.
 * @return
 * @throws InvalidCubeTypeException
 * @throws SkinSaveException 
 */
public static Skin saveSkinFromWorld(World world,EntityPlayerMP player,ISkinType skinType,String authorName,String customName,String tags,int[] paintData,int xCoord,int yCoord,int zCoord,ForgeDirection direction) throws InvalidCubeTypeException, SkinSaveException {
  ArrayList<SkinPart> parts=new ArrayList<SkinPart>();
  for (int i=0; i < skinType.getSkinParts().size(); i++) {
    ISkinPartType partType=skinType.getSkinParts().get(i);
    saveArmourPart(world,parts,partType,xCoord,yCoord,zCoord,direction);
  }
  Skin skin=new Skin(authorName,customName,tags,skinType,paintData,parts);
  if (skin.getParts().size() == 0 && !skin.hasPaintData()) {
    throw new SkinSaveException("String_Node_Str",SkinSaveExceptionType.NO_DATA);
  }
  for (int i=0; i < skinType.getSkinParts().size(); i++) {
    ISkinPartType partType=skinType.getSkinParts().get(i);
    if (partType.isPartRequired()) {
      boolean havePart=false;
      for (int j=0; j < skin.getPartCount(); j++) {
        if (partType == skin.getParts().get(j).getPartType()) {
          havePart=true;
          break;
        }
      }
      if (!havePart) {
        throw new SkinSaveException("String_Node_Str" + partType.getPartName(),SkinSaveExceptionType.MISSING_PARTS);
      }
    }
  }
  return skin;
}

Fixed version (ground truth):
/** 
 * Converts blocks in the world into a skin class.
 * @param world The world.
 * @param skinType The type of skin to save.
 * @param authorName Author name for this skin.
 * @param customName Custom display name for this skin.
 * @param tags Custom search tags for this skin.
 * @param xCoord Armourers x location.
 * @param yCoord Armourers y location.
 * @param zCoord Armourers z location.
 * @param direction Direction the armourer is facing.
 * @return
 * @throws InvalidCubeTypeException
 * @throws SkinSaveException 
 */
public static Skin saveSkinFromWorld(World world,EntityPlayerMP player,ISkinType skinType,String authorName,String customName,String tags,int[] paintData,int xCoord,int yCoord,int zCoord,ForgeDirection direction) throws InvalidCubeTypeException, SkinSaveException {
  ArrayList<SkinPart> parts=new ArrayList<SkinPart>();
  for (int i=0; i < skinType.getSkinParts().size(); i++) {
    ISkinPartType partType=skinType.getSkinParts().get(i);
    saveArmourPart(world,parts,partType,xCoord,yCoord,zCoord,direction);
  }
  if (paintData != null) {
    paintData=paintData.clone();
  }
  Skin skin=new Skin(authorName,customName,tags,skinType,paintData,parts);
  if (skin.getParts().size() == 0 && !skin.hasPaintData()) {
    throw new SkinSaveException("String_Node_Str",SkinSaveExceptionType.NO_DATA);
  }
  for (int i=0; i < skinType.getSkinParts().size(); i++) {
    ISkinPartType partType=skinType.getSkinParts().get(i);
    if (partType.isPartRequired()) {
      boolean havePart=false;
      for (int j=0; j < skin.getPartCount(); j++) {
        if (partType == skin.getParts().get(j).getPartType()) {
          havePart=true;
          break;
        }
      }
      if (!havePart) {
        throw new SkinSaveException("String_Node_Str" + partType.getPartName(),SkinSaveExceptionType.MISSING_PARTS);
      }
    }
  }
  return skin;
}