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 tried creating my own FillerBlockType and my custom ore won't generate. My plan was to have my custom ore (hematite) surrounded by iron ore. Can anyone help me? Here's my code below for the ore generation:

 

package com.theunknown.andraxxus.world.gen;

import com.theunknown.andraxxus.AndraxxMod;
import com.theunknown.andraxxus.util.RegistryHandler;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.pattern.BlockMatcher;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.ConfiguredPlacement;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.registries.ForgeRegistries;


@Mod.EventBusSubscriber(modid = AndraxxMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class AndraxxOreGen {

    public static  OreFeatureConfig.FillerBlockType END_STONE = OreFeatureConfig.FillerBlockType.create("END_STONE", "end_stone", new BlockMatcher(Blocks.END_STONE));
    public static  OreFeatureConfig.FillerBlockType IRON_ORE = OreFeatureConfig.FillerBlockType.create("IRON_ORE", "iron_ore", new BlockMatcher(Blocks.IRON_ORE));

    @SubscribeEvent
    public static void generateOres(FMLLoadCompleteEvent event) {
        for (Biome biome : ForgeRegistries.BIOMES)   {

            if (biome.getCategory() == Biome.Category.NETHER) {
                genOre(biome, 14, 22, 4, 111, OreFeatureConfig.FillerBlockType.NETHERRACK, RegistryHandler.HEMATITE_BLOCK.get().getDefaultState(), 0);
            } else if (biome.getCategory() == Biome.Category.THEEND) {
                genOre(biome, 14, 22, 4, 111, END_STONE, RegistryHandler.HEMATITE_BLOCK.get().getDefaultState(), 0);
            } else {
                genOre(biome, 14, 22, 4, 111, OreFeatureConfig.FillerBlockType.create("IRON_ORE", "iron_ore", new BlockMatcher(Blocks.IRON_ORE)), RegistryHandler.HEMATITE_BLOCK.get().getDefaultState(), 14);

            }
        }

    }
    private static void genOre (Biome biome, int count, int bottomOffset, int topOffset, int max, OreFeatureConfig.FillerBlockType filler, BlockState defaultBlockstate, int size)  {
        CountRangeConfig range = new CountRangeConfig(count, bottomOffset, topOffset, max);
        OreFeatureConfig feature = new OreFeatureConfig(filler, defaultBlockstate, size);
        ConfiguredPlacement config = Placement.COUNT_RANGE.configure(range);
        biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(feature).withPlacement(config));
    }
}
  • Author

My bad, I'm totally sorry, I just sorta barged in here desperate for a solution. Also thanks for the help, I will try this!

Also, where is my mod ID going, and do I have to repeat the ore generation cod for iron ore, and then the hematite ore? How do I generate the iron ore? 

 

I know I sound dumb; I'm super new to modding and just started learning last week and I don't know any Java other than what I've learned so far (which isn't a lot)

 

Also this is 1.16.1 btw

Edited by Kyberkreeper

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.