Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

  • Author

Thanks so much for the quick reply! This does indeed look like quite the amount of fun haha. Will post back if I can get my idea working.

 

Thanks again!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.