Ore Generation (Legacy)

TL;DR
Examples X c: 25, Z c: 11 => 25-1=24, 24/3=8. X is OK. 11-1=10, 10/3=3.33. Z is not OK. You need to go north 1 chunk (-Z). X c: 1, Z c: 1 => 1-1=0, 0/3=0. X and Z are ok. Dig here. x c: -123, Z c: -331 => 123-1=122, 122/3=40.6. X is not OK. Go east 1 chunk (+X). 331-1=330, 330/3=110. Z is OK. Protips
 * 1) Press F9 3 times and go to the blue area centers, then dig/stairstep down until you find the vein
 * 2) Can also use F3 and look for "This is an ore chunk".
 * 3) Look at the chunk location. The c: number in X and Z lines.
 * 4) Take away any negative sign.
 * 5) Subtract 1 from both numbers. Make sure the leftover is divisible by 3.  If it is not, move appropriately
 * Mark an orecenter chunk in Journeymap. Then go over 3 chunks in both X and Z. When crossing over the X or Z = 0 axis, you will need to redo the centers.
 * The orecenter chunks are normally 3 apart, except at the X or Z = 0 axis. A clever miner can take advantage of this.
 * Next to the c:xx number, the number in parenthesis is your location in the chunk. Dig down near 8,8.
 * There's a trick to quickly finding out if a number is divisible by 3 - the actual number doesn't matter, just if it is divisible by 3 and any remainder. Simply add the digits, and if the result is divisible by 3, so is the number. 120 = 1+2 = 3, 120 is divisible by 3 (40). Same for 102 or 210 or 201. 342 = 3+4+2 = 9, 342 is divisible by 3. 782 = 7+8+2 = 17, not divisible by 3, has remainder 2.

Here is a visual example of where to mine, with the X or Z = 0 axis visible. The 0,0 chunk is not special, just marks the center of the overworld

For those who are still confused, Happy mining!
 * Green Squares are the chunks centers wheres ores are likely (but not necessarily to be found).
 * The Yellow Square has no special significance other than showing where the chunk (0,0) is. This is purely meant as a reference point and there is NOT a chunk center located here. (Although, since there are 4 ore veins located 1 chunk away in each diagonal cardinal direction, you are almost certainly going to find a combination of ore veins here, but likely at different depths.  In other words, don't start counting from chunk (0,0), but rather one of the chunks with a green square and yellow coordinates.
 * On ANY GTNH MAP YOU COULD POSSIBLY GENERATE, you would find ore vein centers at each of the green squares and their displayed coordinates in yellow. You can simply extend this pattern out to keep finding more ore centers.

Introduction
GregTech disables all Vanilla ores (except Emerald Ore, Twilight Forest Hollow Hills, and Nether Quartz spawned around hives in the Nether), 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 Sporadic. Each of these parts can be a different ore. Each mix will always be 9 blocks tall, or in other words have 9 levels (unless unnaturally cut off by dirt/air/non-stone type blocks), in all dimensions, except Galacticraft ones. The Primary part is contained in the top-most 4 layers, Secondary the bottom-most 4 layers, Inbetween the 3rd to 6th layers, and Sporadic can be found randomly anywhere in the 9 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.)

The one exception is size 32. The reason is that after calculating the width/boundaries, the ore vein is moves 2 blocks east and 2 blocks south, to "avoid worldgen cascade" (?). However, chunks more than 32 blocks away from an ore chunk in either the x or z direction do not actually generate ores from that ore vein, so 2 blocks are cut off from the vein.

Mix Veins have varying densities depending on the distance of the chunk from the ore chunk and a configuration value called. Each different mix type has a  value set for it. For programmers the local density of a chunk is defined by the following code, regular users can just see the grid after with the factors by which density is affected (with rounding down). The maximum size of any existing vein is 32, which is 2 chunks either side of the ore chunk. The local density is only reduced by the factor in the grid if it will result in a density of at least 1 when rounding down. So only ore veins with a density of at least 3 see the full effect at the corners and only ore veins with a density of at least 2 see any effect at all. As is about to be demonstrated, a reduction in the local density by a factor of 1/2 actually corresponds to a reduction in density by a factor of 1/4, and 1/3 by 1/9, and there are further reductions as the chance of an ore generating is then affected by its distance from the center of the ore vein. An ore spawns at (tX,tZ) if both random numbers between 0-placeX and 0-placeZ exclusive are 0, where placeX and placeZ are calculated using: Since the maximum localDensity for any ore vein is 7, and the minimum width for any ore vein is 16, we will never have to use the first branch of the max condition, so the proportion chance of an ore generating simplifies to localDensity^2/([(wx + 1) // 2 + dx]*[(wz + 1) // 2 + dz]). Here wx and wz are the widths of the vein, and dx and dz are the distance from a center block in the vein, where if the corresponding width is even the center block is the easternmost/northernmost center block, and if the corresponding width is odd the center blocks are the center block and the block to the east/north of the center block. The distance from a center block to itself is 0. The maximum ore generation proportion you can have is 0.765625 at the very center of the smallest possible Lignite Coal vein, and the minimum is 0.0009765625 at the northwestern edge of a maximum size magnetite or gold vein. Note that the proportion is before checking if the block is actually valid to place an ore in (is stone, netherrack, end stone, granite, etc.).

The code determines whether to attempt to generate an ore type using the proportion using the priority: inbetween, primary/secondary, sporadic. The code only decides whether to generate the next type if the previous types were not attempted to be generated. Inbetween ores have an additional multplier of 1/2 to their generation and sporadic ores have an additional multiplier of 1/7. If the code decides to attempt to generate an ore type, it will check if the block is one that can be replaced with an ore (stone, netherrack, end stone, granite, etc.) and replace it if so. If this fails, the code does not try to generate any more of the ore types; it only does so when it decided not to attempt placing the other types of ore at all.

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 and 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). 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 8 times until a valid mix type is found for the dimension. If after 8 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.

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.

The world generator looks for any ore chunks, whose locations are based on the formula explained in (Vein Location), and whose veins could overlap with a chunk it is generating. Since the maximum  of ore veins is 32, this means looking in a 2 chunk radius around the chunk. For each nearby ore chunk, the generator then beings a loop that we will call, which will run until   is incremented 8 times, or until stopped due to a successful placement of an ore vein. Since the loop runs for each ore chunk all overlapping ores in the ore chunk will be placed, traversing nearby ore chunks from northwest to southeast by running lines west to east. I am not sure if placed ores can be rewritten, but my prior is that they cannot. 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 to fill in the chunk. If the generation succeeds or the ore vein does not overlap with the chunk and there is no air block in a certain spot described later,  is stopped and the generator moves to the next ore chunk to restart the whole process. If the generation fails because of incorrect dimension, then  repeats, generating a new   value and so on. If the generation fails because no ores could be placed on the bottom layer of the ore chunk due to air or dirt,  is incremented and compared against 8, then   repeats, and so on. If the ore vein does not overlap with the chunk but the block at the southwestern center of the chunk and on the 2nd-most bottom layer of the ore vein is an air block,  is incremented and compared against 8, then   repeats, and so on. This is the only part of the code where the ore vein generation is not determined by the ore chunk itself, and has the effects of biasing ore generation towards ore veins with larger sizes which overlap with air-blocked nearby chunks and avoid the re-selection of a new mix type. It also biases against high-altitude veins, since those are more likely to have air blocks in nearby chunks at their y-level, but this is also probably the reason this is done, since it means attempting to generate a high-altitude vein in a low-altitude location doesn't use up a. These biases only occur if the chunks around the ore chunk are loaded before the ore chunk itself. If LoopA executes 8 times without generating a vein, an empty vein will be placed. Note that the RNG for mix types is always the same since it is only dependent on the world seed, dimension, chunk X and Z coordinates, and the primary ore, so attempting to place the same mix type at an ore chunk will always either fail or succeed. Successfully generated veins are saved so that other nearby chunks to the ore chunk don't generate new veins.

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 wherever 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.

Quarry like a K1ng
When using the Ender Quarry, it is important to understand how it interacts with the GT oregen. For the Overworld, Nether, and Twilight Forest, per-chunk generation is used, so it's OK to setup the ender quarry any way you want.

However, when using the Quarry on other planets, it is important to place the boundaries so that the edges are GT ore centers.

Because with GTGC the ore is only generated when an ore center chunk is requested, if an Ender Quarry starts work outside from one of these chunks, it may have to fully mine one or two rows of chunks before triggering oregen.

This also has a secondary side effect - you will get less ores if you let the Ender Quarry generate the chunks! This is because it does not generate ores until after it has mined ~ 1/2 of the chunks the ore could be found.

So to maximize ender quarry GT ores, you have to make sure to trigger GT oregen inside the quarry area. To do this, you can fly/walk over the area (or play on a pregen server). You can do rows ~ every 256 blocks to make sure they are generated and have ores.

Or if you don't care about total volume, you can let your quarry run, but try to place the boundaries so that they are inside of ore centers.

Using InGameInfo
As an alternative to understanding the details of ore generation, you can install InGameInfoXML and use config files to show you when you are in an ore chunk.


 * [InGameInfoXML] - Install in your mods directory
 * [Lunatrius Core] - Install in your mods directory
 * [Mod configuration] - Install in your config directory
 * [Display setup] - Install in your config directory