Jump to content

[1.16.1] Custom OreFillerType


Kyberkreeper

Recommended Posts

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));
    }
}
Link to comment
Share on other sites

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