Page last edited 1,767 days 0 hours ago
From COG Docs
Jump to: navigation, search

Import elements are a special feature of the CustomOreGen xml parser. They take the name of another XML file as an attribute and merge the contents of that file into their parent element.

There are two elements for importing, <Import> and <OptionalImport>, which behave the same except that the latter will not raise an error if the target file is not found.

<Import> and <OptionalImport>
Attribute Default Value Description
file [Required] The name of the file to import, relative to the parent directory of the main config file.

Wildcard characters may be used in the file name. "?" will match any single character in a file or folder name, and "*" will match zero or more continuous characters. If file name matches multiple files then they will all be loaded in a file-system-dependent order.

The target must be a well-formed XML file, meaning that it must have exactly one root element. If the intended content is a group of elements with no single root (for example a group of distributions), wrap them in a <ConfigSection> element to make a well-formed xml file.

An Import element can be used anywhere that the contents of the target file would be valid. In short, imports act exactly like copying & pasting. Imported files may contain imports themselves, but use caution to avoid infinite import loops.


<!-- In the main config file: -->
  <Import file="ExtraOres.xml"/>

<!-- In ExtraOres.xml: -->

  <!-- Add veins for two extra ores -->

  <Veins name='ExtraVeinsA' block='extraOreA'>
    <Setting name='MotherlodeHeight' avg='32' range='16'/>

  <Veins name='ExtraVeinsB' block='extraOreB'>
    <Setting name='MotherlodeHeight' avg='32' range='16'/>