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

Hello

I would like to add a custom ore to the generation of the overworld. I followed some tutorials, but nothing works.

Here are my classe:

Main class:

@Mod(MyMod.MODID)
public class MyMod {

    public static final String MODID = "mymod";

    public static final Logger LOGGER = (Logger) LogManager.getLogger(MODID);


    public MyMod() {

        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverSetup);

        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        ModItems.ITEMS.register(bus);
        ModBlocks.BLOCKS.register(bus);

    }

    private void setup(FMLCommonSetupEvent e) {

        ModFeatures features = new ModFeatures();
        features.init();

        MinecraftForge.EVENT_BUS.register(features);

    }

    private void clientSetup(FMLClientSetupEvent e) {

        MinecraftForge.EVENT_BUS.register(this);

    }

    private void serverSetup(FMLDedicatedServerSetupEvent e) {

    }

}

ModFeatures class:

public class ModFeatures {

    public ConfiguredFeature<?, ?> ORE_CUSTOM;

    public void init() {

        ORE_CUSTOM = register("custom_ore", Feature.ORE.configured(
                        new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
                                ModBlocks.ORE_CUSTOM.get().defaultBlockState(),
                                2))
                .range(20).squared()
                .count(20));

    }

    public <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> feature) {

        return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, name, feature);

    }

    @SubscribeEvent
    public void biomeLoading(BiomeLoadingEvent e) {
        BiomeGenerationSettingsBuilder generation = e.getGeneration();
        if (e.getCategory() != Biome.Category.NETHER && e.getCategory() != Biome.Category.THEEND) {
            generation.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, ORE_CUSTOM);
        }
    }

}

I get no error, but I can't find any custom ore. I don't know if it is because my values are too low (because I do not really understand how does work range() and count(): where are the min and the max Y level for generation?) or if I forgot something...

Thanks for your help.

Edited by GoldFrite

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.