Jump to content

Alter vanilla ore generation strategy


CrueltE

Recommended Posts

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

Link to comment
Share on other sites

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.