Ore Generation (Legacy)

Introduction
GregTech disables all Vanilla ores (except Emerald Ore, and Twilight Forest Hollow Hills), and replaces them with its own ore generation system.

Ore Makeup
GregTech ore blocks do not work like other ore blocks you know from other mods or vanilla. Such mods or vanilla uses actual Blocks for placement of their ores, however in GregTech, ores are actually non-ticking MetaTileEntities, defined not by block ID or metadata but by TileEntity data. Meaning that instead of a static Block, these ores are actually TileEntities in that they are all the same "block", but have different data assigned to them that make them function differently. This also means that most, if not all, traditional x-ray mods will NOT work for finding specific ores. Even changing your textures to be invisible will not work as these ores appear as regular blocks until exposed to air (thus making stone invisible, will turn the ores invisible too.) Each ore contains the internal ID of the ore (not block ID), and a true/false value whether they were placed by the world generator or by other means. This is mainly used to determine drops for Small Ores.

When an ore is generated, if there was a type of stone (Stone, Red/Black Granite, Basalt, Marble, Netherrack, or End Stone) in that location, the ore takes on that stone's base type (note that ores can not generate in other blocks, such as dirt). So if an Iron Ore generates on Netherrack, the ore has a stone type of Netherrack, but is still Iron. The only real differences between each stone type is the dust or dirty dust produced when mining Small Ores or when pulverizing regular ores.

Ore Types
Ores generate in two types: Small Ores and Mix Veins (aka Vein Mixes).

Small Ores
These ores generate as semi-common single blocks throughout a dimension. They are intended as a way to get small amounts of raw materials useful for tools or any other small quantity needs; they are not intended to be used as a primary source of resources for progression or machinery. When broken, they drop either a Crushed Ore, an Impure Pile of Ore Dust, or, if applicable, a Gem, of the respective ore. Additionally, they may drop a Dust or a Dirty Dust of the stone type (Ore Makeup) they were found in. Small Ores cannot be picked up with a Silktouch Pickaxe, however a Fortune Pickaxe will slightly increase their yields. Importantly, Small Ores can be mined at 1 mining level lower than the ore itself, allowing a player with a stone-level pickaxe to mine iron-level ores.

Mix Veins
Mix Veins come in four parts, Primary, Secondary, Inbetween, and Around. Each of these parts can be a different ore. Each mix will always be 7 blocks tall, or in other words have 7 levels (unless unnaturally cut off by dirt/air/non-stone type blocks). The Primary part is contained in the top-most 3 layers, Secondary the bottom-most 3 layers, Inbetween the 3rd and 4th layers, and Around can be found randomly anywhere in the 7 layers in much smaller amounts.

Mix Veins can be a varying width and length depending on randomness and a configuration value called. Each different mix type has a  value set for it. For programmers the min and max x and z values are defined by the following code, regular users can just read the table after.

As you may have seen a pattern, the minimum is always 16 blocks, and the max is

Let's use the Iron mix type as an example. This mix type has a  value of 24. Meaning that the width could be anywhere between 16 and 64 meters/blocks, and same with the length (width and length could be the same, but more commonly will not match due to the random factor.)

Generation Process
Vein generation takes place as a series of steps. These steps will be explained in the following two subsections, first in a more basic, "dumbed-down" version, and second is a highly detailed an technical version for those who wish to learn the logic behind the vein generator process.

Simple Explanation
First the world generator locates a position for a new vein to be generated based on a formula (Vein Location). 75% of veins are configured to have ores. Next the generator creates a random number that is used to select which mix type should be used for this new vein. If the selected mix type is not allowed to generate in the dimension, this process is repeated in that a new random number is generated to hopefully select a new mix type. This process is repeated 64 times until a valid mix type is found for the dimension. If after 64 times, a mix is not found, then the generator will move onto the next location and start over. If a mix is found that works in the dimension, a new random number is created to determine the y-coordinate (vertical position) for where the vein should be generated; as well as generating the width and length values of the vein as explained in Mix Veins. Finally, the vein is generated. However remember that a mix vein requires a stone type to be able to generate. If the vein places 0 ores in the bottom layer, another mix is attempted (up to a maximum of 8 placement attempts). So if the y-coordinate generated positions the veins in the air, or in non-stone type blocks, the ores will not be generated.

The 75% filled vein configuration setting, as well as the absent stone type blocks, are the two primary reasons why some locations have no vein in them.

Technical Explanation
'''Remember, this explanation is intended for those looking to understand the complex logic that the generator uses when generating veins. You do NOT have to understand this section to continue.''' Before the explanation, note that in addition to the  value assigned to each mix type, there is also a ,  , and   value.

First the world generator locates a position for a new vein to be generated based on the formula explained in Vein Location. An RNG of 0-100 is compared against 75% to determine if a vein is placed at all. The generator then beings a loop that we will call, which will run 64 times, or until stopped. For each cycle in this loop, a random number is generated between 0 (inclusive) and the total weight (exclusive) of ALL mix types loaded in memory (regardless of dimension). This number is assigned to a variable that we will call.

While still inside, a new loop, which we will call   is started which loops through every mix type (again, regardless of dimension). Each cycle will subtract the mix type's weight from  and reassign it to the new value. Then it checks if W is equal to or less than 0; if yes, then the generator will attempt to use the last used mix type. If the generation succeeds,  is stopped and the generator moves to the next location to restart the whole process. If the generation fails because of the incorrect dimension, then  repeats, generating a new   value and so on. If the generation fails 256 times, then  is stopped. If the generation fails because no ores could be placed due to air or dirt, placementAttempts is incremented and compared against 8, then  repeats, and so on.

Upon generating the vein, the generator first picks where the vein will generate along the y-axis (vertically). The location is yet again random, however is confined using the  and   values and defined using this formula:

An example: Some mix type has the min and mix values of 10 and 90. According to this formula, the position (vertically) could be any number from 10 to 84.

The bottom-most layer of the vein is generated 1 block below the y-position generated by this formula.

Vein Location
The locations of veins are extremely important to know in order to mine efficiently. All mix veins are generated at specific locations defined by a mathematical formula. For programmers you can see the formula from the code here: In simpler form, the world generator will attempt the generation process where ever the formula holds true for any given chunk coordinates. Block coordinates you should be familiar with already, they are used to identify the 3-Dimensional location of any block in the world. Chunk coordinates however are used to identify the 2-Dimensional location of any chunk in the world. A chunk has a volume of 16 blocks wide, by 16 blocks long, by 256 blocks tall. Block coordinates can be represented like this  where x and z are horizontal, and y is vertical (from bedrock to the sky). Since chunks are always 256 blocks tall, the height of the world, a Chunk coordinate is represented like, with only an x and z.

The formula is true whenever a chunk's x and z coordinates follow the following comparison:. Now what does this mean? First check if either x or z is negative, and make it positive. So for example, if x is -5, change it to positive 5 instead. Next divide the new x and z values by 3 and count any remainders. If the remainder of the x division, and the remainder of the z division, both equal 1, then that chunk is where the generator would have attempted to generate a vein.

Calculating Your Position in Chunk Coordinates
There are multiple ways of doing this.
 * The Minecraft Debug screen (when pressing the F3 key) has these coordinates list on it.
 * If you do not wish to monkey around with the debug screen, you can also use a minimap mod, such as JourneyMap which comes with the GTNH modpack. Below the minimap, you will see your block coordinates. To convert this to chunk coordinates, you can type in these numbers to this converter.
 * The InGame Info XML mod can also be installed and configured to display chunk coordinates.

Example (Using Debug Screen)
To open the Debug Screen, press the F3 function key on your keyboard (usually along the top row). In this image you can see two circled numbers. These numbers are the x and z chunk coordinates for the chunk that you are currently standing in. In the example image, the chunk coordinates are (194, -94). So first we need to make any negative values positive, which gives us x: 194, and z: 94. Now we divide each by 3 and count the remainder.

For x: 194 divided by 3 equals 64 with a remainder of 2. For z: 94 divided by 3 equals 31 with a remainder of 1.

Because only the z coordinate has a remainder of 1, this chunk is not a valid location for vein generation; however it is next to one. So a player in this situation would need to move to an adjacent chunk so that both remainders equal 1.

Efficient Mining
This is the easy part after understanding how ore generation works. Using the Vein Location formula, you can find all the locations of potential mix veins, regardless of height in the world. Because of the formula, all you need to do to find mix veins in the most efficient way, is to find each location, and mine a vertical shaft down into the ground in the center of the chunk. There is no need to strip mine and no need to search caves; in fact, searching caves and strip mining is practically worthless. Each vein location can only have a maximum of a single vein (unless the size of the mix is so large that it overlaps, but this rarely happens except in the Deep Dark). Therefore, a single vertical shaft down the center of the chunk from the surface (or near surface) to bedrock will cover all the possible y-coordinates that a vein could have generated at. If you hit a vein before you reach bedrock, there is no reason to continue mining downward at that location.

The shape of the shaft is completely up to you. However, it is recommended to make the shaft 2x2 blocks in size, creating a "staircase" that you can safely mine downwards in but also be able to get back up and down again at a later time if needed. Another option is a 2x1 shaft, where you stand in the middle and mine one side and then the other, alternating. This is obviously much faster than the 2x2, however in the future if you need to make another trip or more it can be quite tedious to mine back down, and build back up every trip.

If you wish, you may also consider making underground connections to each shaft so that you do not have to walk outside on the surface and risk being attacked by monsters. This also gives you a potential pathway if you ever wish to install mine-carts for faster travel to your shafts, as sometimes mining can take you a far ways away from your base (depending on luck, and how many materials you require for building).

The only other thing to consider is which dimensions specific mix veins generate in. Mix vein generation is NOT dependent on biome, only on dimension, meaning that some ores, such as sulfur, you will need to go to the Nether to find instead of mining in the Overworld. To find out which ores generate in which mix types, in which dimensions, please refer to this spreadsheet created by MineAnPlay. The spreadsheet lists all available mix types and the various attributes associated with each, including which dimensions they generate in. Click on the down-arrow at the top of a column to sort by that column, for example the N above Nether. This will let you see which ores are available in that dimension.

Tools
As you progress, it is important to use available tools to make sure you are mining as efficiently as possible. Once you get a jetpack, you can quickly move from center to center, as well as dig down without needing any sort of staircase to move back up the shaft. The Coal jetpack is the first decent pack, with the Copter pack being excellent for this. Just be aware of their limitations (ie, copter pack won't work in water).

The other important thing is to replace your pickaxe/hammer head as you tier up. You can also mix and match the materials for some good effects, such as perditio large plates with a vanadiumsteel head. Some good fast mining materials to keep an eye out for:
 * Periditio (Thaumcraft shards) - Even if you don't plan to use Thaumcraft, Perditio shards can be used to make hammer and pick heads with very high mining speeds. Their drawback is the low durability, so be prepared to repair often with the shards, which can get expensive.
 * Vanadiumsteel - Almost as fast as Peridtio, but with very high durability. Takes a really long time in the MV extruder to make a head - ~30 minutes! Fairly common components (hint: centrifuge redstone for chrome) so it is easy to carry a few along with a tool station for repairs.
 * Shadowmetal - Available from the Tainted Magic mod under the Malefica tab. High durability, really high mining speed. Costs some Warp to research, and requires alchemy to make. Also requires vacuum freezer to cool the hot ingots for use.

There are some additional tools that are useful
 * Traveller's Glove (Tinker's Construct) - This useful item will make your mining even faster. Load it up with Redstone and it will accelerate your mining speed.
 * Traveller's Belt (Tinker's Construct) - This is an really useful item since it will give you an additional Hotbar. Use it to store your mining equipment or GT tools.
 * Jetpack (especially Copter pack) - The copterpack can be left on in normal mode, where it slowly falls as material underneath you is removed. It does slow mining speed slightly, but much less than hovering.

Special Cases
There are special situations where the above mentioned Efficient Mining technique is not applicable.
 * When mining in the Nether, netherrack can be broken at much faster rates than any other dimension, especially when MV tier is reached and the Tinkers Construct Hammer can be crafted. On top of this, the Nether's world generation causes massive open areas which could easily lead to your death when mining shafts. Because of these reasons, it is recommended to actually mine horizontally within the y-coordinate ranges for whichever mix types you are looking for. So if the mix type that contains Sulfur Ore generates between y5 and y20, you should mine horizontal tunnels within that range. Since veins are 7 blocks high, mining at y12 with a hammer will expose any veins.
 * The above trick will also work on the Overworld when searching for Mica (only for Mica! otherwise, this should not be used in the Overworld). Mining horizontally at y31 you should be hitting centers every 2 minutes or so with a good hammer or pickaxe. Mining down 4 blocks every center would catch every vein, but just continuing horizontally is still fast. It may still take a while, but shouldn't take more than 150 centers to find unless you are extremely unlucky.
 * Once you have an OV scanner, the above trick is even better, since it can scan above and below you 12 blocks.
 * The Electric Prospector, available at LuV and above, makes ore vein searching a breeze with a visual interface that shows ores in the chunks.
 * The Asteroids dimension does not use the same generation process as usual, by this point you should have some reliable source of flight, and you will need such as most of this dimension is just empty space. While ores still generate according to mix types, instead of rectangular generation, they generate in large clumps that look like asteroids. Sometimes the ore can be spread throughout the asteroid, other times it is contained only in the center core of the asteroid. Best practice here is to mine horizontally through the center of each asteroid you see.