Config File

The CustomOreGen config file is named CustomOreGen_Config.xml. It is written in XML and contains every detail of COG's ore generation. XML has a bit of a learning curve, so the basics are given here. To make the file easier to read and understand, use a text editor with syntax highlighting like Notepad++.

For quick navigation, the main features of the config file are Options, Conditions, and Distributions (Veins, Cloud, StandardGen, and Substitute). All of these make use of Expressions.

XML Basics
The config file is written in XML, a markup language with similar syntax to the HTML used in webpages. A full tutorial on XML is way outside the scope of this page, but the basics are simple enough. An XML document is broken up into elements, each of which can contain text or other elements. This creates a tree-like structure. Each element starts and ends with the element name in angle brackets: If an element doesn't have anything inside it (which is pretty common), the start and end tags can be combined: An element with another element inside it might look like this: White space doesn't matter, so these elements can be rearranged as needed: XML comments begin with "&lt;!--" and end with "--&gt;":

In addition to their contents, elements can have attributes, listed as name/value pairs in the opening tag: CustomOreGen uses attributes very extensively.

Everything in XML is CASE SENSITIVE. Be very careful with capitalization.

Special XML features in COG
CustomOreGen has a specially written parser that includes some powerful features not found in standard xml.

Annotations
 and  elements can be placed anywhere in the config file. "Description" may also be used as an attribute for any element. Collectively these can be used to attach text annotations to anything in the config file. Some Descriptions are kept and used internally, but most annotations are simply discarded after being read. Even so, the contents of these annotations still need to be simple text or valid XML.

Child Elements as Attributes
Attributes are interchangeable with child elements of the same name. For example, these two elements would be considered identical by the COG parser: The second  element doesn't technically have a "bar" attribute, but the COG parser considers the contents of the  element to be equivalent. This is possible because the COG config file has been carefully designed to avoid overlap between attribute names and "real" element names.

Expressions
Attributes may be set with expressions. The expression is evaluated and the result is used as the attribute value. For example, the "bar" attribute here is assigned the result of 6 times 7, i.e. 42:

Conditions
Any part of the COG config file may be wrapped in a conditional element. Depending on the result of the condition, the contents of the conditional element will either be parsed as normal or discarded. For example, this Veins distribution will only be generated if the Redpower mod is installed:

Sections
The  element can be used to group together related elements. These sections are purely aesthetic; all child elements and attributes of the section are considered to be children of its parent element. For example, these two elements would be considered identical by the COG parser: The "bar" attribute and "Bat" child element in the second line are read by the COG parser as being the children of the  element.

Imports
Configuration data from other XML files can be included using a import element. This allows a configuration fragment such as distributions for a single mod to be packaged and distributed as its own file and then imported into the main config.

The COG Config File
The CustomOreGen config file is named CustomOreGen_Config.xml. A copy of the "standard" config is created in the /config folder when the mod is first installed. This is the global config file. A saved world can be given its own config by placing the file in the world save folder (i.e. saves/New World). A single dimension in a saved world can be given its own config by placing the file in the dimension subfolder (i.e. saves/New World/DIM-1 for the New World Nether).

In-game, COG loads the most specific configuration it can find for each dimension.

The root element of the config file must be a  element. Everything else in the file (except xml comments) must be contained inside this element.

Within the root element distributions, options, and mystcraft symbols may be defined. These top-level elements are processed in the order in which they appear, so Options must be defined before any conditional elements or distributions that depend on them. Other than that there is no limit to the number or order of definitions in the config file.

Example
Here is an example config file containing one option and two distributions: