tutorial:ores
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:ores [2023/03/01 18:44] – Added 1.19.3 section explaining the process of adding custom ores vextin | tutorial:ores [2024/10/28 17:55] (current) – Fix new identifier vs Identifier.of cassiancc | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME: | + | If you are looking for 1.19.3, ores should be done completely in jsons. A helpful tool to know is: [[https:// |
====== Generating Custom Ores [1.19.3+] ====== | ====== Generating Custom Ores [1.19.3+] ====== | ||
Line 6: | Line 6: | ||
* Use [[https:// | * Use [[https:// | ||
- | + | To simplify, we use vanilla end rod as ore, because | |
- | This tutorial assumes that you have already created your ore block, and that it appears correctly | + | |
==== Adding to the overworld biomes ==== | ==== Adding to the overworld biomes ==== | ||
Line 14: | Line 13: | ||
First, create two new JSON files in your mod's data directory: | First, create two new JSON files in your mod's data directory: | ||
- | <code JavaScript src\main\resources\data\examplemod\worldgen\configured_feature\ore_custom.json> | + | <code JavaScript src\main\resources\data\tutorial\worldgen\configured_feature\ore_custom.json> |
{ | { | ||
" | " | ||
Line 23: | Line 22: | ||
{ | { | ||
" | " | ||
- | " | + | " |
}, | }, | ||
" | " | ||
Line 32: | Line 31: | ||
{ | { | ||
" | " | ||
- | " | + | " |
}, | }, | ||
" | " | ||
Line 44: | Line 43: | ||
</ | </ | ||
- | This Configured Feature tells the game the size of the ore veins, what fraction of the ore blocks should be removed due to air exposure, and, importantly, | + | This Configured Feature tells the game the size of the ore veins, what fraction of the ore blocks should be removed due to air exposure, and, importantly, |
- | <code JavaScript src\main\resources\data\examplemod\worldgen\placed_feature\ore_custom.json> | + | <code JavaScript src\main\resources\data\tutorial\worldgen\placed_feature\ore_custom.json> |
{ | { | ||
- | " | + | " |
" | " | ||
{ | { | ||
Line 78: | Line 77: | ||
This Placed Feature tells the game how many ore veins to place in a chunk, what shape the ore veins are placed in, and at what y-levels the ore veins are placed in. Note that the first line of the Placed Feature references the Configured Feature that was created a moment ago. | This Placed Feature tells the game how many ore veins to place in a chunk, what shape the ore veins are placed in, and at what y-levels the ore veins are placed in. Note that the first line of the Placed Feature references the Configured Feature that was created a moment ago. | ||
- | Writing these JSON files by hand is strenuous and inefficient. Note that the bulk of the work can be skipped by using tools like this [[https:// | + | Writing these JSON files by hand is strenuous and inefficient. Note that the bulk of the work can be skipped by using tools like this [[https:// |
Now that our data is created, it's time for code! Thanks to the changes in Minecraft 1.19.3, adding ore to world generation requires much less Java code. All we need to do is register the feature, then use the Fabric Biome Modification API to tell Minecraft which dimension to generate the ore in (and during which stage of world generation to generate the ore). | Now that our data is created, it's time for code! Thanks to the changes in Minecraft 1.19.3, adding ore to world generation requires much less Java code. All we need to do is register the feature, then use the Fabric Biome Modification API to tell Minecraft which dimension to generate the ore in (and during which stage of world generation to generate the ore). | ||
Line 84: | Line 83: | ||
First, at the class level, let's create a new '' | First, at the class level, let's create a new '' | ||
- | <code Java src/ | + | <code Java src/ |
public class ExampleMod implements ModInitializer { | public class ExampleMod implements ModInitializer { | ||
- | //public static final Logger LOGGER... | + | public static final RegistryKey< |
- | public static final RegistryKey< | + | |
@Override | @Override | ||
Line 106: | Line 103: | ||
Now to add the Feature to a biome: | Now to add the Feature to a biome: | ||
- | <code Java src/ | + | <code Java src/ |
@Override | @Override | ||
- | public void onInitialize() { | + | public void onInitialize() { |
- | + | ||
- | //Your other code here... | + | //Your other code here... |
- | BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), | + | BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), |
- | + | } | |
- | } | + | |
</ | </ | ||
Line 120: | Line 116: | ||
==== Testing ==== | ==== Testing ==== | ||
- | To test your new ore, generate a new world. | + | To test your new ore, generate a new world. |
- | < | + | |
- | /fill ~-8 0 ~-8 ~8 ~-16 ~8 minecraft: | + | |
- | </ | + | |
==== Adding to the Nether or End ==== | ==== Adding to the Nether or End ==== | ||
Line 132: | Line 124: | ||
As with the Overworld, we begin with the JSON files. Using vanilla' | As with the Overworld, we begin with the JSON files. Using vanilla' | ||
- | <code JavaScript src/ | + | <code JavaScript src/ |
{ | { | ||
- | " | + | " |
" | " | ||
{ | { | ||
Line 166: | Line 158: | ||
As before, we add a Configured Feature as well. | As before, we add a Configured Feature as well. | ||
- | <code JavaScript src/ | + | <code JavaScript src/ |
{ | { | ||
" | " | ||
Line 175: | Line 167: | ||
{ | { | ||
" | " | ||
- | " | + | " |
}, | }, | ||
" | " | ||
Line 191: | Line 183: | ||
Finally, back in our Java code, right after our other BiomeModification line, | Finally, back in our Java code, right after our other BiomeModification line, | ||
- | <code Java src/ | + | <code Java src/ |
- | BiomeModifications.addFeature(BiomeSelectors.foundInNether(), | + | BiomeModifications.addFeature(BiomeSelectors.foundInNether(), |
</ | </ | ||
tutorial/ores.1677696297.txt.gz · Last modified: 2023/03/01 18:44 by vextin