Reputation: 3
I have just started minecraft modding and I am a bit unsure of how to do something. I am trying to add Platinum into the Fabric modded minecraft game and that all worked but I am unsure how to make my platinum ore generate randomly like other ones. I have looked at lots of videos but none I saw have been very helpful at all.
My question at the end is:
How do I randomly generate my platinum ore at y = 12 - 15 without having to place it by hand?
Upvotes: 0
Views: 415
Reputation: 81
You need to create a ConfiguredFeature. Make sure to register your ConfiguredFeature at onInitialize. Feel free to change the values to suit your mod.
public class ExampleMod implements ModInitializer {
private static ConfiguredFeature<?, ?> ORE_WOOL_OVERWORLD = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
Blocks.WHITE_WOOL.getDefaultState(),
9)) // vein size
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(
UniformHeightProvider.create(
YOffset.fixed(0),
YOffset.fixed(64)))))
.spreadHorizontally()
.repeat(20); // number of veins per chunk
@Override
public void onInitialize() {
RegistryKey<ConfiguredFeature<?, ?>> oreWoolOverworld = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN,
new Identifier("tutorial", "ore_wool_overworld"));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, oreWoolOverworld.getValue(), ORE_WOOL_OVERWORLD);
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, oreWoolOverworld);
}
}
(Took from https://fabricmc.net/wiki/tutorial:ores )
Upvotes: 0