Ore Generation

From GT New Horizons
Revision as of 20:34, 9 August 2017 by Bigbass (talk | contribs)
Jump to navigation Jump to search
Ambox warning pn.svg
This is an extensive guide for mining in GT New Horizons.
Everything here is important unless otherwise noted, therefore do NOT skip over anything!


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

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

Basic diagram of each layer from top to bottom.

Mix Veins can be a varying width and length depending on randomness and a configuration value called size. Each different mix type has a size 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.

int cX = aChunkX - aRandom.nextInt(this.mSize);
int eX = aChunkX + 16 + aRandom.nextInt(this.mSize);
// Where aChunkX is just the world (block) coordinate of where the vein is being generated along the x-axis

// This code is duplicated for the Z values
int cZ = aChunkZ - aRandom.nextInt(this.mSize);
int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize);
// Where aChunkZ is just the world (block) coordinate of where the vein is being generated along the z-axis

// Note that nextInt() generates a random number from 0 (inclusive) to the parameter (exclusive)
Size minWidth maxWidth
0 16 16
16 16 48
24 16 64
32 16 80
48 16 112
64 16 144

As you may have seen a pattern, the minimum is always 16 blocks, and the max is (2 * size) + min

Let's use the Iron mix type as an example. This mix type has a size 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). 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 256 times until a valid mix type is found for the dimension. If after 256 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. So if the y-coordinate generated positions the vein in the air, or in non-stone type blocks, the ores will not be generated.

Both the 256 tries, as well as the absent stone type blocks, are the two 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 size value assigned to each mix type, there is also a minY, maxY, and weight value.

First the world generator locates a position for a new vein to be generated based on the formula explained in #Vein Location. The generator then beings a loop that we will call LoopA, which will run 256 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 W.

While still inside LoopA, a new loop, which we will call LoopB is started which loops through every mix type (again, regardless of dimension). Each cycle will subtract the mix type's weight from W and reassign it to the new value. W = W - mixWeight; 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, LoopA is stopped and the generator moves to the next location to restart the whole process. If the generation fails, then LoopA repeats, generating a new W value and so on. If the generation fails 256 times, then LoopA is stopped.

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 minY and maxY values and defined using this formula:

yPos = minY + aRandom.nextInt(maxY - minY - 5);

// Note that nextInt() generates a random number from 0 (inclusive) to the parameter (exclusive)

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:

if ((Math.abs(this.mX / 16) % 3 == 1) && (Math.abs(this.mZ / 16) % 3 == 1)) {...}

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 (x, y, z) 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 (x, z), with only an x and z.

The formula is true whenever a chunk's x and z coordinates follow the following comparison: |x| mod 3 = 1, and |z| mod 3 = 1. 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

Throw away all your old concepts of mining in Minecraft. Gregtech completely changes how ore generation works in this modpack.
First go read the "Ores" section of this wiki http://ftb.gamepedia.com/GregTech_5/Mining_and_Processing#Ores. Ignore the "Default Ore Mixes" section!

Right off the bat know this: Exploring cave systems and traditional strip mining is completely worthless and a massive waste of time.

Your first task is to identify the ore generation grid. As described in the wiki page, all ore generation happens in 3x3 chunk sections, even if the vein itself is smaller or larger than 3x3 chunks.

Any mining that you do, whether before or after you identify the grid should be done using vertical shafts. (the only exception being if you want to make a horizontal tunnel underground to connect each shaft together, but this tunnel is not for finding veins.)

The vertical shaft should be positioned in the center of whatever chunk you are mining in, you can choose how the shaft is structured, but I recommend a 2x2 block shaft so that it can be a staircase of sorts.

This image is a topdown map of a random world where the stone/dirt/etc has been removed leaving only ore veins and small ore blocks. The thin gray lines show the vanilla chunk grid. The red lines I have drawn ontop of the original image, to help show the 3x3 ore generation grid.
JourneyMap OreGen Visual.png

To identify this grid without removing all the stone/dirt/etc, pick a bunch of chunks and start mining a shaft in each one. Use the size of any veins you find and your map to help you identify the grid. Remember that all veins generate out from the center chunk of each 3x3 chunk section. However also note that some veins can be 2x3 or other rectangular shapes, so if you dont find a 1x1 or 3x3 vein right away, you may need to find more veins nearby, or use existing veins you have found already.

If you think you have figured out the grid, test it out and correct it if needed. Once you figure out the grid, or otherwise have a guess for how it is positioned in your world, you only need to mine 1 vertical shaft in the center-most chunk of each 3x3 chunk section of the grid. If you find a vein there, great, if not move onto the next 3x3 chunk section. This way you are gurenteed to find every vein, assuming a vein generated. As seen in the above image, some sections of the grid do not have any veins in them, this is completely normal.

Good luck and have fun! Note that this process may take at minimum a few hours, be prepared to mine for quite a while. If you have any questions please contact bigbass1997 on Discord.

TODO: This guide needs to be revised with new information about how to identify the ore grid without ever mining any shafts.