Ore Generation

Like most of New Horizons, ore generation is very different compared to vanilla Minecraft and even most modpacks. Instead of sprinkling all ore types across the world, ores are concentrated in s of related materials and varying rarity. All Vanilla ore generation is disabled except for Emerald Ore, Twilight Forest Hollow Hills, and Nether Quartz spawned around hives in the Nether. Ores generate in specific dimensions, requiring visits to other dimensions and final frontiers.

Ore Types
Ores generate in two ways; Small Ores and Veins (aka Vein Mixes). Small Ores are sprinkled throughout the world for a dimension's common materials, as well as serving as indicators for a nearby vein. Veins generate at regular intervals of every three chunks, vary in size by type, and contain large amounts of several related ores. NEI can be used to see ore vein data including weight (frequency of generation), eligible dimensions, and composition. Press (default R) while hovering over an ore block, dust, or crushed ore and find the Vein Stats tab (purple ore block icon).

Biome does not matter for ore generation, only dimension and height. Veins cannot generate in terrain without any rock at their desired Y height.

Small Ores
These ores generate as semi-common single blocks throughout a dimension or around a matching vein. They have a different texture than full ore blocks, with a horizontal stripy appearance and will say "Small (type) Ore" when moused over in WAILA. When broken, they may drop either a Crushed Ore, an Impure Pile of Ore Dust, or, if applicable, a Gem of the respective type. Additionally, they may drop a Dust or a Impure Dust of the stone type (Ore Makeup) they were found in. Small Ores cannot be picked up with Silk Touch, however Fortune effects will increase yields. Importantly, Small Ores can be mined at one mining level lower than the normal ore block, allowing a player with a stone-level pickaxe to mine iron-level ores.


 * Official GTNH Spreadsheet has more specifics on Small Ores including other planets

Veins
Ore Veins generate in a regular grid pattern radiating outwards from chunk (0,0). Away from the 0,0 axis, veins are found every three chunks - that is, there will be an ore chunk, then two non-ore chunks, and then another ore chunk. JourneyMap's Show Grid overlay can be used to more easily visualize the spacing. Along the 0,0 axis both North-South and East-West, there is only one chunk spacing between ore veins. When a vein is discovered, it will be marked on the player's JourneyMap Show GT Ore Veins overlay.

When an ore block is generated it takes on the original stone's base type. (Stone, Red/Black Granite, Basalt, Marble, Netherrack, or End Stone.) Ores cannot generate in other blocks, such as dirt. So if an Iron Ore generates in 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 impure dust produced when mining Small Ores or pulverizing regular ores, and Nether/End Ores have increased yields.

Due to the vast number of ores in the pack, GregTech ore blocks generate as non-ticking MetaTileEntities, defined not by block ID or metadata but by TileEntity data. Ores are all the same "block", but have different data assigned to them that make them function differently. A side effect is x-ray mods will not work. Changing stone textures to be invisible will turn the ores invisible too, as they do not exist as ores until exposed or interacted with. Each ore contains and internal 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.

Vein Composition
Mixed veins may have up to four different ores - Primary, Secondary, Between, and Sporadic. Each of these parts can be a different ore, but some veins have duplicates and thus less variety. Each vein will always be 9 blocks in height, unless unnaturally cut off by dirt/air/non-stone type blocks, in all dimensions except those from Galacticraft. Veins vary in radius/size based on their type. Diamond Veins tend to be small, Iron and Coal veins are large, etc. The Primary part is contained in the top-most four layers, Secondary the bottom-most four layers, Between the third to sixth layers, and Sporadic can be found randomly anywhere in the nine layers in much smaller amounts.

The overall shape of ore veins is a rectangular cuboid. There is a distinct cutoff between the edge of a vein and the surrounding stone, beyond which no ore blocks will be found. Small ores will generate well past the confines of a vein as well as inside it. See for more detail.

Locating Veins
GTNH includes the InGame Info XML mod. By default it populates a text overlay in the upper left corner that lists a wide variety of game state attributes, including a "This is an ore chunk." message next to a diamond pickaxe if the player is in a valid ore chunk. This is the easiest way of finding a first ore chunk; simply wander around until the above message is shown. Dig down at the center of the chunk to locate the vein. Press F9 until blue lines mark the center of chunks for easier dig shaft placement. Discovered veins should appear in JourneyMap as a small icon when the "Show GT Ore Veins" overlay is turned on when the ore block is touched or scanned. Note that Small ores will not register a vein, it has to be a regular ore block or scanned, and prospecting near spawn requires a forced refresh (see the JourneyMap page).

The first long distance prospecting tool offered to players is the Ore Finder. Other options include the OV Scanner (IC2) and Prospector's Scanner (various tiers, GregTech).

Efficient Mining
Once an initial ore chunk has been discovered, further placements are easy to intuit - always two empty chunks in between ore veins that do not lie on the (0,0) axis. Early on the only way of assessing the vein's content is to dig a two-block shaft straight down until the ore layer is reached. Bring ladders and remember they are only necessary every second block in 1.7.10. Another option is to make the shaft 2x2 blocks in size, creating a "staircase" that can safely be mined downwards in but also usable to get back up and down again at a later time if needed. Local deposits close to the player's base can be connected with underground tunnels for greater safety from mobs and quick travel.

There is no need to strip mine or search caves for resources. Each vein location can only have a maximum of a single vein unless adjacent ones overlap. 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 a vein is found before reaching bedrock, there is no reason to continue mining downward at that location.

Tools
New tiers unlock new ways of mining more efficiently. As soon as a Tool Forge is available, a Tinker's Construct Hammer can be made which will mine a 3x3 area instead of single blocks. Upgrade pickaxe and hammer heads as new materials become available with better mining speeds, durability, or mining level. Materials can be mixed to good effect, such as perditio large plates with a vanadiumsteel head. See Tinker's Tools for a complete breakdown of best in class materials at any tier. Good options include Perditio shards, Vanadiumsteel and Shadow Metal.

Scanners
 * Ore Finder Wand (Stone+) will register veins up to 60 blocks below but with a radius of only three blocks.
 * Prospector's Scanners (MV+) Consumable durability. Can be made as early as LV but require three circuits, so it's recommended to hold off for MV and better durability materials to make expense worthwhile.
 * OV Scanner (EV+) can scan above and below the player up to 12 blocks.
 * Electric Prospector's Scanner (LuV+) is rechargeable and makes ore vein searching a breeze with a visual interface that shows ores in nearby chunks.

Support Items
 * Traveller's Glove (Tinker's Construct) - Makes mining faster. Load it up with Redstone and it will accelerate any tool's mining speed.
 * Traveller's Belt (Tinker's Construct) - Grants an additional Hotbar. Use it to store mining equipment or GT tools for easy access.
 * Jetpack (especially Copter pack) - The copterpack can be left on in normal mode, where it slowly falls as material underneath is removed. It does slow mining speed slightly, but much less than hovering. Also avoids the need for ladders and shortens travel time. Won't function in water.

Special Cases
There are special situations where the above mentioned Efficient Mining technique is not applicable.

Nether
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 a lethal fall when mining shafts. Thus it's recommended to mine horizontally within the y-coordinate ranges for whichever ore vein types are sought. So if the mix type that contains Sulfur Ore generates between y5 and y20, mine horizontal tunnels within that range. Since veins are nine blocks high, mining at y12 with a hammer will expose any veins.

Another consideration is that Zombie Pigmen will aggro when mining ores in the Nether. One way to avoid this is to use Miners instead of hand tools.

Mica
Horizontal mining is also an option when searching for Mica (only for Mica! otherwise, this should not be used in the Overworld). Mining horizontally at y31 hits ore vein centers every 2 minutes or so with a good hammer or pickaxe. Mining down four blocks every center would catch every vein, but just continuing horizontally is still fast. Prospecting from the surface is faster if a piece of Cassiterite Ore (not sand!) is available to use with the Ore Finder Wand.

Cassiterite is found only at high elevations, y50-60 for sand and y60-220 for ore. Mountainous biomes are the most likely targets, as well as some deserts and clay canyons.

Asteroids
The Asteroids dimension does not use the same ore generation process. Reliable flight from a jetpack or similar equipment is required, as most of the dimension is empty void. While ores still generate according to mix types, instead of rectangular generation they spawn 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 found.

Ender Quarry
When using the Ender Quarry, it is important to understand how it interacts with the GT ore generation. 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.

In GT GalacticCraft dimensions the ore is only generated when an ore center chunk is requested. If an Ender Quarry starts work outside an ore chunk, it may fully mine one or two rows of worthless chunks before triggering oregen.

This also has a secondary side effect - fewer ores will be created if the Ender Quarry generates the chunks! This is because it does not trigger oregen until after it has mined ~ 1/2 of the chunk area, when it reaches the middle.

To maximize Ender Quarry yield, trigger GT oregen inside the quarry area before quarrying. To do this, fly/walk over the area (or play on a pregen server) approximately every 256 blocks to make sure they are generated and have ores. If pre-generation isn't feasible, try to place boundaries so that they are inside of ore centers.

=Technical Details=

Vein Composition (Technical)
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.

Overview
Vein generation takes place as a series of steps. 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 eight times until a valid mix type is found for the dimension. If after eight attempts a mix is not found, 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 eight 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.

Detailed Explanation
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.

Ore Vein Location (Technical)
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.