Posted January 11, 20214 yr Hi! I started modding a month ago and ran into a problem. I created ore and am unsure how to actually generate it naturally. I would appreciate any help.
January 12, 20214 yr You need to register a configured feature. to do so, you can create a field MY_ORE_CONFIG, of type ConfiguredFeature<?, ?>. Then in the common setup, you want to call Registry.register(), passing in the type of world gen registry (for ores, that's WorldGenRegistries.CONFIGURED_FEATURES), than a string that will be the registry key, and then the actual configured feature. you may want to take a look at the Features class, and see how it creates configured features for ores. For any standard ore you'll use Feature.ORE.withConfiguration(), and pass the feature configurations, which would be a new instance of a OreFeatureConfig. Again, looking at the Features class, and how that class register Configured Features should really simplify thing. After you have the Configured Feature Registered, you need to add it to the biomes generation algorithm. You can do this in the BiomeLoadingEvent. simply check the biome category for the biomes that you want (for instance, if you're adding the ore to the overworld, than don't add it to the Nether and End biomes). you can call BiomeLoadingEvent#getGeneration(), to get the biome's generation algorithm, from there you can call BiomeGenerationSettingsBuilder#getFeatures() to get all the features, and you'd need to pass the Generation Stage, for commom ores: GenerationStage.Decoration.Underground. and from there you can call .add() to add your configured feature (note: .add() will expect a Supplier of a ConfiguredFeature)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.