I'm looking to override the vanilla ore generation strategy. I've been digging through all of the forge/minecraft source code, and scoured github looking for a solution, but I'm unable to find one.
I saw there is an ORE feature that is used to add all of the ores to the different biomes
In Feature.java
public static final Feature<OreFeatureConfig> ORE = register("ore", new OreFeature(OreFeatureConfig::deserialize));
In DefaultBiomeFeatures.java
public static void addStoneVariants(Biome biomeIn) {
biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226786_au_, 33)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(10, 0, 0, 256))));
... etc for other ore types
}
The default OreFeature.java that gets registered has a place method and a giant formula. I'm assuming this is how it ends up generating the ore.
At the end of the formula it ends up calling
worldIn.setBlockState(blockpos$mutable, config.state, 2);
So I thought I would go ahead and create my own CustomOreFeature which extends OreFeature (I just copied the exact formula from the original OreFeature), then register it
private static final DeferredRegister<Feature<?>> FEATURES = new DeferredRegister<>(ForgeRegistries.FEATURES, "minecraft");
public ExampleMod() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
FEATURES.register("ore", () -> new CustomOreFeature(OreFeatureConfig::deserialize));
FEATURES.register(modEventBus);
}
When i start up the client it says that is overrided the original ORE feature, which is good.
[21:49:06] [Render thread/INFO] [ne.mi.re.GameData/]: Potentially Dangerous alternative prefix `minecraft` for name `ore`, expected `examplemod`. This could be a intended override, but in most cases indicates a broken mod.
[21:49:06] [Render thread/DEBUG] [ne.mi.re.ForgeRegistry/REGISTRIES]: Registry Feature Override: minecraft:ore net.minecraft.world.gen.feature.OreFeature@57ac2910 -> com.example.examplemod.CustomOreFeature@67c1fc9b
However, no matter what i change in my CustomOreFeature class, it doesn't seems to affect the default ore generation (Altering the formula i copied, or just removing the formula entirely).
I'm brand new to modding minecraft, so any help or direction is greatly appreciated.
Thanks in advance!
CrueltE