Description:
This mod allows the player to decide what ores are generated in their worlds and how they are distributed. In addition to the vanilla "cluster" distribution it offers custom-written "vein" and "cloud" distributions.

Customization is the main goal of this mod. Every aspect of the ore generation can be changed through the flexible config file and the more succinct in-game menu. The config is set up to provide out-of-the-box support for several popular mods. Configuration data for other mods can be easily added, and I am currently expanding the out-of-the-box support. See the Configuration for a list, and fill out the mod support survey to request a standard config for a mod.

A note: there are many ore- and world-generation mods out there. I wasn't happy with any of them, so I wrote my own. Naturally I like my implementation the best, but other authors have done amazing work. Shop around!

Distribution Algorithms (and pics):

StandardGen (or "Clusters")
StandardGen spawns roughly elliptical "clusters" in each chunk. The horizontal position of each cluster is random, but the vertical position and size are configurable. It can be limited to replacing certain blocks, or to spawning only in certain biomes.

The StandardGen algorithm is an extended version of the ore generation algorithm used by vanilla minecraft. It has been modified to to support the special features offered by COG but is still fairly limited compared to the Cloud and Veins algorithms. Most players are comfortable with StandardGen, though, and it allows for faithful reproduction of the vanilla distributions when necessary. Because the clusters are relatively small and scattered randomly, StandardGen tends to encourage strip or branch mining.

Veins
The Veins algorithm creates a round central "motherlode" with branches radiating in all directions. Branches may twist and turn, and also may fork to create a more tree-like structure. Motherlode size, frequency, and height is configurable, as is branch count, length, diameter, and a host of other details. It can be limited to replacing certain blocks, or to spawning only in certain biomes. Veins is perhaps the most flexible algorithm; it can create spidery groups of branchs, large isolated tunnels, vertical pipes, and other unique shapes.

Veins require a different style of mining than the vanilla clusters. The player has to follow the vein as it twists and turns, so branch and strip mining (and the automated mining machines added by tech mods) are not very effective. Veins are also rather rare and the total amount of ore per chunk is much lower than in vanilla minecraft. However, the yield when mining is much greater than with clusters because the player does not need to keep digging through mountains of stone to find the next piece of ore. Ideally it should be challenging to find ore in the early game but much easier to accumulate large quantities later on once veins have been discovered through exploration in caves & ravines.

Clouds
The Cloud algorithm creates an irregular ball (technically an ellipsoid) of ore. It can be flattened or stretched independently in the vertical and horizontal directions. The interior can be carved up and the surface given irregular bumps and using a noise function (3D simplex noise, to be exact). Together these provide for a huge variety in cloud shape. It can be limited to replacing certain blocks, or to spawning only in certain biomes.

Clouds are intended for large, sparse distributions that require the player to set up proper mineshafts and infrastructure. They are extremely rare, cover multiple chunks, and contain a lot of stone inbetween the ore blocks. This means that when the player does find a cloud it will probably be some distance from their base, and will probably take many trips back and forth to set up a branch mine and mine the entire distribution out. This offers an interesting dynamic for long-term single-player games or cooperative survival servers.

Substitute
The Substitute algorithm replaces all blocks of one type with another. It can be limited to replacing certain blocks, or to spawning only in certain biomes. As the image shows, it can also replace many types of blocks (in this case all solid blocks).

Substitute is a "helper" algorithm - not intended for actually placing ores but rather for removing the ores placed by Minecraft by changing them back to stone. This provides a "clean slate" for COG to work with when creating new distributions. This approach also works well for mod-added ores.

This mod requires either ModLoader, ForgeModLoader, or Minecraft Forge. You must download and install one of these before installing the mod.

Risugami's Modloader is a classic but aging modding tool. COG will still run with ModLoader, but some features will be disabled (in-game options menu, debugging wireframes, and support for dimensions other than the overworld and the nether).

ForgeModLoader is a newer mod utility that is supposed to be (but frequently is not) compatible with all ModLoader mods. All major features of COG will work with FML. Some debugging features (i.e. wireframes) will not.

Minecraft Forge is an extensive API used by a large community of mods. It has many features, changes many core minecraft files, and updates frequently. All COG features work with Forge.

Once you have installed one of these three prerequisites, download the CustomOreGen [1.4.6]v2 archive and place it in your .minecraft/mods folder. The mod should be in working order right out of the box, but if you want to configure it see the COG wiki for more information.

Because terrain generation is handled entirely by the server in multiplayer, only the server needs to have CustomOreGen installed. Players generally do not need to modify their client to play on a server with CustomOreGen. However, wireframe models and custom mystcraft symbols require client-side rendering. Players will need to install COG on their client to see the wireframe models and custom mystcraft symbols.

Only the Mojang server is supported at this time; there is not yet a port for Bukkit.

If you are a server operator, you need to download and install eitherMinecraft ForgeorForgeModLoader. Forge is an extensive API used by a large community of mods; FML is a relatively light-weight rewrite of the Modloader API that supports servers. Choose whichever best suits your needs. All server-side features of COG work with both Forge and plain FML.

Once you have installed one of these two prerequisites, download the CustomOreGen [1.4.6]v2 archive and place the archive in the /mods folder of your server. The mod should be in working order right out of the box, but if you want to configure it see the COG wiki for more information.

A basic options menu is available during world creation for single-player and LAN worlds:
Hovering your mouse over an option name or value will display a short tooltip explaining its purpose. There are a few general settings, but the most important options are those named "Coal Type", "Iron Type", etc. These control how each ore will generate in the newly created world. "Veins" and "Clouds" are custom-written distributions, but "Clusters" is designed to reproduce the vanilla distribution for each ore as closely as possible. You can mix and match the different types to suit your tastes. You can also completely remove an ore from the world by setting its type to "None".

The complete configuration, including the contents of the options menu, can be modified, extended, or overhauled. The core config file is CustomOreGen_Config.xml, found in the config/ directory. The rest of the standard config can be found in the config/CustomOreGen Standard Modules directory. These files are written in XML. They can be opened with any text editor but are much easier to read in editors with syntax highlighting like Notepad++. For details see the config and option pages on the COG wiki.

For anyone who plans to experiment with the settings, I would recommend turning on Debugging Mode. This feature allows you to view distributions and change settings in-game.

Known Issues:

Enabling wireframes on a remote client currently chews up a lot of bandwidth. I may change this in the future; it depends on how serious a problem it turns out to be.

Let me know if you encounter any other bugs. I would also appreciate feedback on the default ore distributions that come in the config file. If you come up with some settings that you really like, please share them here!

Change Log:

[1.4.6]v2:

Compatible with Minecraft 1.4.7

Standard config module for RedPower 2

Fixed compatibility with Mystcraft 0.9.5.00

Height limits for Subsitute. New "minHeight" and "maxHeight" attributes for <Subsitute>.

New expression string functions. New expression functions "match" and "replace" for string manipulation.

Option Display Groups. Option display groups can be defined with <OptionDisplayGroup>. They share a namespace with other options, but do not have a value and cannot be used in expressions. Each group appears as a tab in the COG options menu. Numeric and Choice options have a new 'displayGroup' attribute, and will only appear when the corresponding group tab is selected.

Reorganized standard config modules. The standard modules have been renamed and moved into the "CustomOreGen Standard Modules" folder. The Minecraft ores module is now optional. Any of the modules can be deleted to disable them. They will only be regenerated when CustomOreGen_Config.xml is deleted.

Bug fixes. Changes to wireframe packets to avoid clogging the client/server connection. Fixed Modloader compatibility (thanks to AnUberWookie). /cogOption now recognizes regular expressions in the option name. Removed Gold affinity for ExtrabiomesXL "Pine Forest", since it is not a hardwood forest. Added Forestry Apatite affinity for temperate pine and fir forests from ExtrabiomesXL.

[1.4.6]v1:

Updated for Minecraft 1.4.6

<Import> accepts wildcards. Imported filenames may contain wildcards (? or *). All matching files will be loaded in a file-system-dependent order.

"Supplemental Caves" removed. The additional caves distribution has been removed from the standard config file.

New /cogEnableDebugging command. This command enables/disables debugging mode, and is visible even when debugging mode is off.

[1.4.5]v3:

Significant changes to standard config. Diamond and emerald "veins" are now actual veins rather than scattered deposits (to differentiate them from "Clusters"). Cloud frequencies increased across the board. Misc. small tweaks.

Standard modules for IC2 and Forestry. Industrialcraft and Forestry now supported out-of the-box.

Console commands can be run from dedicated server. All console commands except /cogWireframeMode are available in the dedicated server console. The target config must be specified by dimension id.

New argument for /cogInfo and /cogOptionInfo. These commands now take an optional true/false "detail" value. If true, the output includes descriptions and a complete list of biome/block descriptor matches where appropriate.

New arguments for /cogPopulate. This command now takes optional coordinate arguments to specify the center of the populating region.

Mystcraft features dont throw errors if Mystcraft is not installed. Also, a new expression variable "age" is available. It is true if the dimension is a Mystcraft age and false othewise.

New expression functions. Three new functions: "world.nextRandom" to get a pseudorandom number based on the world seed, "blockExists" to check if a block is registered, and "biomeExists" to check if a biome is registered.

Minor performance improvements. Memory and processor consumption is improved when many distributions are loaded. Cloud wireframes have many fewer vertices.

Presets discarded after loading config. Preset distributions no longer appear in the list of distributions in-game.

Fixed the following bugs:

Veins, Cloud, and StandardGen not placing blocks in the bottom layer of the map.

Completed structure statistics not counting structures which extend above/below the world height limits.

Overhaul of Client/Server communication. This version of the client-side mod cannot "talk" to older versions of the server-side mod and vice-versa.

Bug Fixes. Mystcraft symbols now appear properly will appear in the GUI for remote clients. The client will no longer spam wireframe request packets if the server is not responding.

[1.4.5]v2:

Mystcraft Symbols. Added the <MystcraftSymbol> element to define custom mystcraft symbols. They can be used in expressions to control which distributions generate and what their properties are.

Overhaul of StandardGen. StandardGen has been rewritten. It now supports all advanced features and can be used with Substitute.

Bug Fixes. /cogPopulate now works correctly for unloaded chunks (force them to load before populating). COG metadata is properly shown in FML mod list. Client wireframe rendering mode now persists when changing dimension.

Changes to Standard config. The standard config file has been split into two files for manageability. The StandardGen distributions have been updated, and new Mystcraft symbols and distributions have been added.

[1.4.5]v1:

Updated for Minecraft 1.4.5.

Menu Tooltips. <Descriptions> for Options and choice options values are displayed as tooltips in the client menu.

Tweaked ExtraBiomesXL biomes. Fixed inconsistencies in how ores are specialized in ExtraBiomesXL biomes.

Misc Changes. Description annotations can now appear as attributes. Choice Option values are no longer case sensitive when set in the options file or using /cogOption.

[1.4.4]v1:

Updated for Minecraft 1.4.4.

<Import> and <OptionalImport>. New config sytax for merging the contents of external XML files into the main config file.

<ConfigSection>. New structural element for grouping content in the config file. Equivalent to <IfCondition condition='true'>.

Seed attribute. All distributions now take a Seed attribute, which controls the random number generation for that distribution. Distributions with the same seed and setting values will share the same geometry.

/cogPopulate command. New debugging command that populates (or repopulates) chunks near the player with ore.

Bug fixes. Dimension IDs outside the range [-128,127] are now supported (thanks to Keybounce for pointing this out). Fixed a bug in the /cogSetting command that caused NPE crash when the type argument was not specified.

Default setting values on the wiki. The list of default setting values for the four distribution algorithms has been removed from the standard config file and moved to the wiki.

[1.4.2]v1:

Updated for Minecraft 1.4.2.

Each dimension has it's own configuration. The config+options file is read once per dimension. Dimensions other than the overworld can have their own config/options files by placing them in the dimension save folder. Debugging commands apply to the configuration for the world in which the command user is standing.

World and dimension properties in expressions. A set of world- and dimension-specific properties can now be referenced by name in expression, e.g. "world.isHardcore" and "dimension.groundLevel".

Relaxed biome handling. Veins and Cloud distributions no longer exclude the Nether and End biomes by default. StandardGen distributions are no longer restricted to overworld biomes. The new dimension properties should be used with conditional elements to keep overworld distributions out of these dimensions.

COG no longer disables vanilla ore generation. An new magic option is available to disable it, but it is left enabled by default and a <Substitute> distribution is used to remove the vanilla ore clusters as necessary. This works better with mods and avoids the need to add back in the dirt and gravel deposits.

New debugging commands. Use /cogLoadConfig to reload the configuration for the current dimension, and /cogOption to temporarily change an option value.

New expression functions. Expressions in the config file now support the IsModInstalled() function and the ternary If() function.

Wireframes only visible when cheats enabled. You must be OPed or the server must have cheats enabled to see wireframes.

Height Settings do not automatically scale with world height. Veins.MotherlodeHeight, Veins.BranchHeightLimit, Cloud.CloudHeight, StandardGen.height are no longer automatically adjusted when the world height is not 256. Use the new "world.height" in an expression to do this scaling yourself in the config file when necessary.

Expressions now use 'hard' typing. Strings wont be automatically converted to numbers or boolean values, and vise-versa. Use the conversion operators $, #, and ? to do this explicitly.

Distributions with no Biomes or Replaceable blocks don't cause errors. They won't generate any ores, but sometimes that is the intended behavior.

Bug Fixes. Fixed the bugs responsible for (*) the log spam during chunk generation, (*) unnecessary errors due to negative biome/block weights, (*) rounding errors in numeric option values, (*) config errors when options names include a reserved function name like "abs" or "round", (*) config options being written in random order to options file, (*) results from /cogInfo and /cogOptionInfo appearing in random order.

Changes to the default configurations. Replaced the "groundLevel" option with the "dimension.groundLevel" world property. Added a new "oreSize" option that controls distribution size. Gold is now more common in Forest biomes. Cloud distributions in config are now targeted to specific biomes, similar to veins. Redpower distributions have been temporarily removed.

[1.3.2]v1:

Updated for Minecraft 1.3.2. At long last. Major code changes under the hood to adapt to the new client/server model.

Support for the End and mod-added dimensions. Provided FML is installed and any mod-added dimensions save their chunks in a standard location.

New Emerald distributions. Emerald ore distributions have been added to the config file.

FML is now "required". COG is still useable with ModLoader for single-player or LAN worlds, but the in-game options menu will not appear and dimensions other than the overworld and nether will not be supported.

Debugging Mode is now server-side. Debugging commands are now integrated into the vanilla server command system. There are no additional requirements to use them (Single Player Commands is no longer necessary). The client does not need COG installed to use them. Debugging wireframes are now generated by the server and transmitted to the client (the client must have COG and Forge installed to see them).

Config error dialog for the stand-alone server. Errors in the server config while produce an Abort/Retry/Ignore dialog just like the client unless the server gui is disabled with --nogui.

[1.2.5]v6b:

Fixed crash for players without SPC+Forge. This is what happens when I don't test thoroughly.

[1.2.5]v6:

Massive overhaul of the config file parser. New features include per-world config files, conditional branches, numerical/boolean/string expressions, and support for attributes written as child elements.

Config Options. "Variables" that can be used with expressions and conditional branches to control how the config file is read. Option values are stored separately for each world. An in-game menu has been added to configure them for single player worlds. A new debugging command "/cogOptionInfo" provides information on them in-game.

Debugging Mode enabled through config file. A "magic" option in the config file now enables/disables debugging mode. It is no longer controlled through the *.cfg file generated by modloader.

Deferred chunk population. COG now waits to populate a chunk until all chunks within a fixed radius have been populated. This solves the problems with stripping mod-added ores from the world.

OreDensity setting for <Veins>. Controls the probability that a given block inside the vein is actually converted to ore.

<Substitute> distribution. Used to completely replace one block with another.

<Cloud> distribution. Irregular clouds of ore.

<Replaceable> weights. Replaceable blocks can bow be given a weight which determines the probability that they will be replaced.

<Biome> weights. Biomes can bow be given a weight which determines the probability that the distribution will generate in them.

Multiple weighted ore blocks. Multiple ore blocks can now be specified with the <OreBlock> element. Each can be given a weight determining the probability that it will be chosen.

Nether support. Distributions that target the 'Hell' biome will now generate in the nether.

Population counters. Distributions now track blocks placed and other statistics for debugging purposes.

FML info file. COG now provides metadata to FML for those that use it.

Updated config file. Added a set of Cloud distributions and a number of global options. Small tweaks to existing distributions. Reorganized comments and sections for clearer structure.

[1.2.5]v5:

Bugfixes. Lingering issues with ExtraBiomes and 1024 blockIDs mod should be fixed.

Tweaked Default configurations. Made redstone slightly more common and fixed some embarrassing spelling errors (doubt I got them all, though).

Veins distributions can now be nested. You can put a <Veins> element inside another <Veins> elements in the config file. The "inner"/"child" distribution will only spawn near its parent. A new vein setting, MotherlodeRangeLimit, has been added to control the effective range.

[1.2.5]v4:

Many bugfixes. Bezier veins are now faster and have fewer glitches like leaving blocks behind. Veins distributions with identical settings no longer always spawn next to each other. Mod-added biomes without names will no longer cause a crash. Overall performance should be slightly better.

Renamed the <PDist> element. <PDist> is now <Setting>, and the "distribution" attribute is now "type".

Renamed the <VeinDefaults> element. <VeinDefaults> is now <VeinsPreset>. A new element, <StandardGenPreset>, has been added as well.

Changed how defaults work in the config. Default settings can now be "inherited" from another distribution using the "inherits" attribute.

Changed how blocks are specified in the config. The "block" attribute replaces the old "blockID" and "metaData" attributes. The "block" attribute supports regular expression patterns.

Added new presets to the config file. Several "preset" distributions have been added, based on feedback from dyrewolf.

StandardGen now uses settings. The size, frequency, and height of StandardGen distributions is now set with <Setting> elements rather than directly with attributes.

Reverted Lapis Lazuli distribution back to v2. The changes to the lapis distribution introduced from [1.2.5]v3 have been undone (didn't like how they turned out).

Debugging Mode! A special mode for single-player worlds that allows in-game changes to mod settings and more.

[1.2.5]v3:

Fixed Redpower compatibility. The problems with redpower ore ids not being recognized has been resolved. Redpower (and other mods as well, probably) waits until the last possible moment to register it's ores. The fix means that the CustomOreGen config file is not fully processed until new chunks are actually generated.

Smooth Vein branches. Branch segments can now either be straight lines (the old way) or smoothly interconnected curves. This choice has some effect on how the SegmentRadius setting is interpreted, but the other settings are still used in the same way.

New attribute for <Vein>: branchType. Used to select the old vs new branch types. See the config file for details.

New attribute for <Vein> and <StandardGen>: name. Used to identify the distribution in output messages and make the config file easier to understand.

New child element for <Vein>: <Description>. Used to add descriptive text to a vein distribution - neater and more readable than using XML comments.

Tweaked default distributions. Changes due to the new branch type, and an entirely new Lapis Lazuli distribution. Also a lot of reformatting to make the config file easier to read and edit.

Air (block 0) is no longer rejected as a blockID. Distributions can now place air, i.e. for creating custom cave systems.

[1.2.5]v2:

Fixed Forge compatibility. CustomOreGen no longer requires ModLoaderMP. The client version can now run with just ModLoader, and the server version needs either Forge or ForgeModLoader.

[1.2.5]:

Updated for Minecraft 1.2.5

New vein option: Biome. Use <Biome> tags to list biomes in which a vein may spawn.

Tweaks to default ore distributions. Additional biome-specific distributions for coal, iron, and redstone. The original distributions (which spawn everywhere) are not affected.

[1.2.4]v2:

Fixed client/server connection issues. Connecting to a server should no longer cause a crash.

Support for SMP! A version of the mod for minecraft servers is now available.

No more base class edits. The mod no longer makes any changes to the core minecraft classes. It should now be compatible with nearly any other mod.

Simplified Installation. The mod is now installed in the /mods folder rather than dumped directly into the .jar archives.

Height values given meters. Height averages, ranges, and limits in the config file are now expected in meters rather than as a fraction of the total map height.

Config file name changed. The config file is now named CustomOreGen_Config.xml. The old config file, OreVeinsConfig.xml, will be *ignored*. Make sure to transfer any customizations from 1.2.3 to the new config file.

New vein parameter: BranchHeightLimit. Veins can now be prevented from extending too far upward or downward.

Bugfix: long branches. Vein branch length is no longer silently limited to 140m.

Major tweaks to default ore distributions. The default ore distributions have been redone (improved, hopefully).

Acknowledgements:
Cadde, for permission to include an algorithm closely based on his OreVeins mod.
Risugami, SDK, and the MCP team for all their hard work to make modding easier.
Mojang, for a wonderful game.
Everyone who has posted supportive feedback in this thread - I appreciate it!

Copywrite Notice:
This mod is the intellectual property of the author. Anyone may reproduce or redistribute it freely or alter or borrow from it for other works, provided that they include visible written credit to the author. No permission is required so long as credit is given. The source code for this mod is freely available on request.

This looks awesome, and I'd love to use it for my own ores! Interested in sharing? ^^;;

If your mod doesn't conflict with this one (see Known Issues in OP) then it's just a matter of installing them together and adding a few lines to the config file. You're also welcome to bundle this mod with your own or copy/redistribute the source as necessary (PM me if you want the source link).

Support for SMP! A version of the mod for minecraft servers is now available.

No more base class edits. The mod no longer makes any changes to the core minecraft classes. It should now be compatible with nearly any other mod.

Simplified Installation. The mod is now installed in the /mods folder rather than dumped directly into the .jar archives.

Height values given meters. Height averages, ranges, and limits in the config file are now expected in meters rather than as a fraction of the total map height.

Config file name changed. The config file is now named CustomOreGen_Config.xml. The old config file, OreVeinsConfig.xml, will be *ignored*. Make sure to transfer any customizations from 1.2.3 to the new config file.

New vein parameter: BranchHeightLimit. Veins can now be prevented from extending too far upward or downward.

Bugfix: long branches. Vein branch length is no longer silently limited to 140m.

Major tweaks to default ore distributions. The default ore distributions have been redone (improved, hopefully).

java.lang.NullPointerException
at acf.a(Chunk.java:607)
at wz.b(World.java:654)
at hb.a(SourceFile:322)
at CustomOreGen.MapGenVeins$EllipsoidComponent.a(MapGenVeins.java:218)
at pc.a(SourceFile:29)
at agn.a(SourceFile:46)
at als.a(ChunkProviderGenerate.java:503)
at kl.a(ChunkProvider.java:203)
at acf.a(Chunk.java:1110)
at kl.c(ChunkProvider.java:113)
at kl.b(ChunkProvider.java:126)
at wz.d(World.java:633)
at wz.a(World.java:548)
at net.minecraft.client.Minecraft.e(Minecraft.java:2208)
at net.minecraft.client.Minecraft.a(Minecraft.java:2095)
at net.minecraft.client.Minecraft.a(Minecraft.java:2042)
at net.minecraft.client.Minecraft.a(Minecraft.java:1959)
at mt.c(SourceFile:162)
at mt.a(SourceFile:119)
at vl.a(SourceFile:68)
at vl.f(SourceFile:116)
at vl.i(SourceFile:104)
at net.minecraft.client.Minecraft.k(Minecraft.java:1584)
at net.minecraft.client.Minecraft.x(Minecraft.java:842)
at net.minecraft.client.Minecraft.run(Minecraft.java:747)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT dfc9e48e ----------

I haven't updated to 1.2.4 because of the mods I use.
edit: I found the problem. I wrote the config wrong.