MCPcopy Create free account
hub / github.com/McJty/TutorialV3 / Ores

Class Ores

src/main/java/com/example/tutorialv3/worldgen/ores/Ores.java:21–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19import net.minecraftforge.event.world.BiomeLoadingEvent;
20
21public class Ores {
22
23 public static final RuleTest IN_ENDSTONE = new TagMatchTest(Tags.Blocks.END_STONES);
24
25 public static Holder<PlacedFeature> MYSTERIOUS_OREGEN;
26 public static Holder<PlacedFeature> OVERWORLD_OREGEN;
27 public static Holder<PlacedFeature> DEEPSLATE_OREGEN;
28 public static Holder<PlacedFeature> NETHER_OREGEN;
29 public static Holder<PlacedFeature> END_OREGEN;
30
31 public static void registerConfiguredFeatures() {
32 OreConfiguration mysteriousConfig = new OreConfiguration(OreFeatures.STONE_ORE_REPLACEABLES, Registration.MYSTERIOUS_ORE_OVERWORLD.get().defaultBlockState(), OresConfig.MYSTERIOUS_VEINSIZE.get());
33 MYSTERIOUS_OREGEN = registerPlacedFeature("mysterious_mysterious_ore", new ConfiguredFeature<>(Feature.ORE, mysteriousConfig),
34 CountPlacement.of(OresConfig.MYSTERIOUS_AMOUNT.get()),
35 InSquarePlacement.spread(),
36 new DimensionBiomeFilter(key -> key.equals(Dimensions.MYSTERIOUS)),
37 HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(90)));
38
39 OreConfiguration overworldConfig = new OreConfiguration(OreFeatures.STONE_ORE_REPLACEABLES, Registration.MYSTERIOUS_ORE_OVERWORLD.get().defaultBlockState(), OresConfig.OVERWORLD_VEINSIZE.get());
40 OVERWORLD_OREGEN = registerPlacedFeature("overworld_mysterious_ore", new ConfiguredFeature<>(Feature.ORE, overworldConfig),
41 CountPlacement.of(OresConfig.OVERWORLD_AMOUNT.get()),
42 InSquarePlacement.spread(),
43 new DimensionBiomeFilter(key -> !Dimensions.MYSTERIOUS.equals(key)),
44 HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(90)));
45
46 OreConfiguration deepslateConfig = new OreConfiguration(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Registration.MYSTERIOUS_ORE_DEEPSLATE.get().defaultBlockState(), OresConfig.DEEPSLATE_VEINSIZE.get());
47 DEEPSLATE_OREGEN = registerPlacedFeature("deepslate_mysterious_ore", new ConfiguredFeature<>(Feature.ORE, deepslateConfig),
48 CountPlacement.of(OresConfig.DEEPSLATE_AMOUNT.get()),
49 InSquarePlacement.spread(),
50 BiomeFilter.biome(),
51 HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.aboveBottom(64)));
52
53 OreConfiguration netherConfig = new OreConfiguration(OreFeatures.NETHER_ORE_REPLACEABLES, Registration.MYSTERIOUS_ORE_NETHER.get().defaultBlockState(), OresConfig.NETHER_VEINSIZE.get());
54 NETHER_OREGEN = registerPlacedFeature("nether_mysterious_ore", new ConfiguredFeature<>(Feature.ORE, netherConfig),
55 CountPlacement.of(OresConfig.NETHER_AMOUNT.get()),
56 InSquarePlacement.spread(),
57 BiomeFilter.biome(),
58 HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(90)));
59
60 OreConfiguration endConfig = new OreConfiguration(IN_ENDSTONE, Registration.MYSTERIOUS_ORE_END.get().defaultBlockState(), OresConfig.END_VEINSIZE.get());
61 END_OREGEN = registerPlacedFeature("end_mysterious_ore", new ConfiguredFeature<>(Feature.ORE, endConfig),
62 CountPlacement.of(OresConfig.END_AMOUNT.get()),
63 InSquarePlacement.spread(),
64 BiomeFilter.biome(),
65 HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(100)));
66 }
67
68 private static <C extends FeatureConfiguration, F extends Feature<C>> Holder<PlacedFeature> registerPlacedFeature(String registryName, ConfiguredFeature<C, F> feature, PlacementModifier... placementModifiers) {
69 return PlacementUtils.register(registryName, Holder.direct(feature), placementModifiers);
70 }
71
72 public static void onBiomeLoadingEvent(BiomeLoadingEvent event) {
73 if (event.getCategory() == Biome.BiomeCategory.NETHER) {
74 event.getGeneration().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, NETHER_OREGEN);
75 } else if (event.getCategory() == Biome.BiomeCategory.THEEND) {
76 event.getGeneration().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, END_OREGEN);
77 } else {
78 event.getGeneration().addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, MYSTERIOUS_OREGEN);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected