OreFeatures .java

net.minecraft.data.worldgen.features.OreFeatures (class): members: ORE_COPPPER_SMALL, ORE_DIAMOND_SMALL, ORE_COAL_BURIED, ORE_GOLD_BURIED, ORE_NETHER_GOLD.

net.minecraft.data.worldgen.featuresclass146 linescommon9.6 KB

API Surface (1)

void bootstrap(final BootstrapContext<Feature> context)

Fields & Constants (32)

ORE_MAGMA
ORE_SOUL_SAND
ORE_NETHER_GOLD
ORE_QUARTZ
ORE_GRAVEL_NETHER
ORE_BLACKSTONE
ORE_DIRT
ORE_GRAVEL
ORE_GRANITE
ORE_DIORITE
ORE_ANDESITE
ORE_TUFF
ORE_COAL
ORE_COAL_BURIED
ORE_IRON
ORE_IRON_SMALL
ORE_GOLD
ORE_GOLD_BURIED
ORE_REDSTONE
ORE_DIAMOND_SMALL
ORE_DIAMOND_MEDIUM
ORE_DIAMOND_LARGE
ORE_DIAMOND_BURIED
ORE_LAPIS
ORE_LAPIS_BURIED
ORE_INFESTED
ORE_EMERALD
ORE_ANCIENT_DEBRIS_LARGE
ORE_ANCIENT_DEBRIS_SMALL
ORE_COPPPER_SMALL
ORE_COPPER_LARGE
ORE_CLAY

String literals (32)

"ore_magma"
"ore_soul_sand"
"ore_nether_gold"
"ore_quartz"
"ore_gravel_nether"
"ore_blackstone"
"ore_dirt"
"ore_gravel"
"ore_granite"
"ore_diorite"
"ore_andesite"
"ore_tuff"
"ore_coal"
"ore_coal_buried"
"ore_iron"
"ore_iron_small"
"ore_gold"
"ore_gold_buried"
"ore_redstone"
"ore_diamond_small"
"ore_diamond_medium"
"ore_diamond_large"
"ore_diamond_buried"
"ore_lapis"

Full Source

OreFeatures.java146 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.data.worldgen.features;
2
3
import java.util.List;
4
import net.minecraft.data.worldgen.BootstrapContext;
5
import net.minecraft.resources.ResourceKey;
6
import net.minecraft.tags.BlockTags;
7
import net.minecraft.world.level.block.Blocks;
8
import net.minecraft.world.level.levelgen.feature.BlockReplacement;
9
import net.minecraft.world.level.levelgen.feature.Feature;
10
import net.minecraft.world.level.levelgen.feature.OreFeature;
11
import net.minecraft.world.level.levelgen.feature.ScatteredOreFeature;
12
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
13
import net.minecraft.world.level.levelgen.structure.templatesystem.HeightMatchTest;
14
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
15
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
16
17
public class OreFeatures {
18
	public static final ResourceKey<Feature> ORE_MAGMA = FeatureUtils.createKey("ore_magma");
19
	public static final ResourceKey<Feature> ORE_SOUL_SAND = FeatureUtils.createKey("ore_soul_sand");
20
	public static final ResourceKey<Feature> ORE_NETHER_GOLD = FeatureUtils.createKey("ore_nether_gold");
21
	public static final ResourceKey<Feature> ORE_QUARTZ = FeatureUtils.createKey("ore_quartz");
22
	public static final ResourceKey<Feature> ORE_GRAVEL_NETHER = FeatureUtils.createKey("ore_gravel_nether");
23
	public static final ResourceKey<Feature> ORE_BLACKSTONE = FeatureUtils.createKey("ore_blackstone");
24
	public static final ResourceKey<Feature> ORE_DIRT = FeatureUtils.createKey("ore_dirt");
25
	public static final ResourceKey<Feature> ORE_GRAVEL = FeatureUtils.createKey("ore_gravel");
26
	public static final ResourceKey<Feature> ORE_GRANITE = FeatureUtils.createKey("ore_granite");
27
	public static final ResourceKey<Feature> ORE_DIORITE = FeatureUtils.createKey("ore_diorite");
28
	public static final ResourceKey<Feature> ORE_ANDESITE = FeatureUtils.createKey("ore_andesite");
29
	public static final ResourceKey<Feature> ORE_TUFF = FeatureUtils.createKey("ore_tuff");
30
	public static final ResourceKey<Feature> ORE_COAL = FeatureUtils.createKey("ore_coal");
31
	public static final ResourceKey<Feature> ORE_COAL_BURIED = FeatureUtils.createKey("ore_coal_buried");
32
	public static final ResourceKey<Feature> ORE_IRON = FeatureUtils.createKey("ore_iron");
33
	public static final ResourceKey<Feature> ORE_IRON_SMALL = FeatureUtils.createKey("ore_iron_small");
34
	public static final ResourceKey<Feature> ORE_GOLD = FeatureUtils.createKey("ore_gold");
35
	public static final ResourceKey<Feature> ORE_GOLD_BURIED = FeatureUtils.createKey("ore_gold_buried");
36
	public static final ResourceKey<Feature> ORE_REDSTONE = FeatureUtils.createKey("ore_redstone");
37
	public static final ResourceKey<Feature> ORE_DIAMOND_SMALL = FeatureUtils.createKey("ore_diamond_small");
38
	public static final ResourceKey<Feature> ORE_DIAMOND_MEDIUM = FeatureUtils.createKey("ore_diamond_medium");
39
	public static final ResourceKey<Feature> ORE_DIAMOND_LARGE = FeatureUtils.createKey("ore_diamond_large");
40
	public static final ResourceKey<Feature> ORE_DIAMOND_BURIED = FeatureUtils.createKey("ore_diamond_buried");
41
	public static final ResourceKey<Feature> ORE_LAPIS = FeatureUtils.createKey("ore_lapis");
42
	public static final ResourceKey<Feature> ORE_LAPIS_BURIED = FeatureUtils.createKey("ore_lapis_buried");
43
	public static final ResourceKey<Feature> ORE_INFESTED = FeatureUtils.createKey("ore_infested");
44
	public static final ResourceKey<Feature> ORE_EMERALD = FeatureUtils.createKey("ore_emerald");
45
	public static final ResourceKey<Feature> ORE_ANCIENT_DEBRIS_LARGE = FeatureUtils.createKey("ore_ancient_debris_large");
46
	public static final ResourceKey<Feature> ORE_ANCIENT_DEBRIS_SMALL = FeatureUtils.createKey("ore_ancient_debris_small");
47
	public static final ResourceKey<Feature> ORE_COPPPER_SMALL = FeatureUtils.createKey("ore_copper_small");
48
	public static final ResourceKey<Feature> ORE_COPPER_LARGE = FeatureUtils.createKey("ore_copper_large");
49
	public static final ResourceKey<Feature> ORE_CLAY = FeatureUtils.createKey("ore_clay");
50
51
	public static void bootstrap(final BootstrapContext<Feature> context) {
52
		RuleTest naturalStone = new TagMatchTest(BlockTags.BASE_STONE_OVERWORLD);
53
		RuleTest stoneOreReplaceables = RuleTest.either(
54
			new TagMatchTest(BlockTags.HEIGHT_SPECIFIC_ORE_REPLACEABLES), HeightMatchTest.min(0), new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)
55
		);
56
		RuleTest deepslateOreReplaceables = RuleTest.either(
57
			new TagMatchTest(BlockTags.HEIGHT_SPECIFIC_ORE_REPLACEABLES), HeightMatchTest.max(8), new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)
58
		);
59
		RuleTest netherrack = new BlockMatchTest(Blocks.NETHERRACK);
60
		RuleTest netherOreReplaceables = new TagMatchTest(BlockTags.BASE_STONE_NETHER);
61
		List<BlockReplacement> oreIronTargetList = List.of(
62
			BlockReplacement.replace(stoneOreReplaceables, Blocks.IRON_ORE.defaultBlockState()),
63
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_IRON_ORE.defaultBlockState())
64
		);
65
		List<BlockReplacement> oreGoldTargetList = List.of(
66
			BlockReplacement.replace(stoneOreReplaceables, Blocks.GOLD_ORE.defaultBlockState()),
67
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_GOLD_ORE.defaultBlockState())
68
		);
69
		List<BlockReplacement> oreDiamondTargetList = List.of(
70
			BlockReplacement.replace(stoneOreReplaceables, Blocks.DIAMOND_ORE.defaultBlockState()),
71
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_DIAMOND_ORE.defaultBlockState())
72
		);
73
		List<BlockReplacement> oreLapisTargetList = List.of(
74
			BlockReplacement.replace(stoneOreReplaceables, Blocks.LAPIS_ORE.defaultBlockState()),
75
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_LAPIS_ORE.defaultBlockState())
76
		);
77
		List<BlockReplacement> oreCopperTargetList = List.of(
78
			BlockReplacement.replace(stoneOreReplaceables, Blocks.COPPER_ORE.defaultBlockState()),
79
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_COPPER_ORE.defaultBlockState())
80
		);
81
		List<BlockReplacement> oreCoalTargetList = List.of(
82
			BlockReplacement.replace(stoneOreReplaceables, Blocks.COAL_ORE.defaultBlockState()),
83
			BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_COAL_ORE.defaultBlockState())
84
		);
85
		context.register(ORE_MAGMA, new OreFeature(netherrack, Blocks.MAGMA_BLOCK.defaultBlockState(), 33));
86
		context.register(ORE_SOUL_SAND, new OreFeature(netherrack, Blocks.SOUL_SAND.defaultBlockState(), 12));
87
		context.register(ORE_NETHER_GOLD, new OreFeature(netherrack, Blocks.NETHER_GOLD_ORE.defaultBlockState(), 10));
88
		context.register(ORE_QUARTZ, new OreFeature(netherrack, Blocks.NETHER_QUARTZ_ORE.defaultBlockState(), 14));
89
		context.register(ORE_GRAVEL_NETHER, new OreFeature(netherrack, Blocks.GRAVEL.defaultBlockState(), 33));
90
		context.register(ORE_BLACKSTONE, new OreFeature(netherrack, Blocks.BLACKSTONE.defaultBlockState(), 33));
91
		context.register(ORE_DIRT, new OreFeature(naturalStone, Blocks.DIRT.defaultBlockState(), 33));
92
		context.register(ORE_GRAVEL, new OreFeature(naturalStone, Blocks.GRAVEL.defaultBlockState(), 33));
93
		context.register(ORE_GRANITE, new OreFeature(naturalStone, Blocks.GRANITE.defaultBlockState(), 64));
94
		context.register(ORE_DIORITE, new OreFeature(naturalStone, Blocks.DIORITE.defaultBlockState(), 64));
95
		context.register(ORE_ANDESITE, new OreFeature(naturalStone, Blocks.ANDESITE.defaultBlockState(), 64));
96
		context.register(ORE_TUFF, new OreFeature(naturalStone, Blocks.TUFF.defaultBlockState(), 64));
97
		context.register(ORE_COAL, new OreFeature(oreCoalTargetList, 17));
98
		context.register(ORE_COAL_BURIED, new OreFeature(oreCoalTargetList, 17, 0.5F));
99
		context.register(ORE_IRON, new OreFeature(oreIronTargetList, 9));
100
		context.register(ORE_IRON_SMALL, new OreFeature(oreIronTargetList, 4));
101
		context.register(ORE_GOLD, new OreFeature(oreGoldTargetList, 9));
102
		context.register(ORE_GOLD_BURIED, new OreFeature(oreGoldTargetList, 9, 0.5F));
103
		context.register(
104
			ORE_REDSTONE,
105
			new OreFeature(
106
				List.of(
107
					BlockReplacement.replace(stoneOreReplaceables, Blocks.REDSTONE_ORE.defaultBlockState()),
108
					BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_REDSTONE_ORE.defaultBlockState())
109
				),
110
				8
111
			)
112
		);
113
		context.register(ORE_DIAMOND_SMALL, new OreFeature(oreDiamondTargetList, 4, 0.5F));
114
		context.register(ORE_DIAMOND_LARGE, new OreFeature(oreDiamondTargetList, 12, 0.7F));
115
		context.register(ORE_DIAMOND_BURIED, new OreFeature(oreDiamondTargetList, 8, 1.0F));
116
		context.register(ORE_DIAMOND_MEDIUM, new OreFeature(oreDiamondTargetList, 8, 0.5F));
117
		context.register(ORE_LAPIS, new OreFeature(oreLapisTargetList, 7));
118
		context.register(ORE_LAPIS_BURIED, new OreFeature(oreLapisTargetList, 7, 1.0F));
119
		context.register(
120
			ORE_INFESTED,
121
			new OreFeature(
122
				List.of(
123
					BlockReplacement.replace(stoneOreReplaceables, Blocks.INFESTED_STONE.defaultBlockState()),
124
					BlockReplacement.replace(deepslateOreReplaceables, Blocks.INFESTED_DEEPSLATE.defaultBlockState())
125
				),
126
				9
127
			)
128
		);
129
		context.register(
130
			ORE_EMERALD,
131
			new OreFeature(
132
				List.of(
133
					BlockReplacement.replace(stoneOreReplaceables, Blocks.EMERALD_ORE.defaultBlockState()),
134
					BlockReplacement.replace(deepslateOreReplaceables, Blocks.DEEPSLATE_EMERALD_ORE.defaultBlockState())
135
				),
136
				3
137
			)
138
		);
139
		context.register(ORE_ANCIENT_DEBRIS_LARGE, new ScatteredOreFeature(netherOreReplaceables, Blocks.ANCIENT_DEBRIS.defaultBlockState(), 3, 1.0F));
140
		context.register(ORE_ANCIENT_DEBRIS_SMALL, new ScatteredOreFeature(netherOreReplaceables, Blocks.ANCIENT_DEBRIS.defaultBlockState(), 2, 1.0F));
141
		context.register(ORE_COPPPER_SMALL, new OreFeature(oreCopperTargetList, 10));
142
		context.register(ORE_COPPER_LARGE, new OreFeature(oreCopperTargetList, 20));
143
		context.register(ORE_CLAY, new OreFeature(naturalStone, Blocks.CLAY.defaultBlockState(), 33));
144
	}
145
}
146

Decompiled Minecraft 26.3 source of OreFeatures (net/minecraft/data/worldgen/features/OreFeatures.java) with Mojang official mappings, stored verbatim on the site.