Jump to content

Ore Generation 1.16.5


KillerRose83

Recommended Posts

I am trying to add end ores. for some reason they just wont generate period. I cant seem to find a solution

This is my init class

import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.feature.template.BlockMatchRuleTest;
import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
import net.minecraftforge.event.world.BiomeLoadingEvent;

public class FeatureInit {

    public static final ConfiguredFeature<?, ?> VIBRANIUM_ORE = Feature.ORE.configured(
            new OreFeatureConfig(new BlockMatchRuleTest(Blocks.END_STONE), BlockInit.VIBRANIUM_ORE.get().defaultBlockState(), 4)) //vein size
            .range(100).squared() //maximum y level where ore can spawn
            .count(13); //how many veins maximum per chunk

    public static void generateOre(final BiomeLoadingEvent event) {
        BiomeGenerationSettingsBuilder generation = event.getGeneration();
        if (event.getCategory().equals(Biome.Category.THEEND)) { //OPTIONAL IF STATEMENT allows you to generate ores in specific biome types for example icy biomes
            generation.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, VIBRANIUM_ORE);
        }
    }
}


And this is in the original class

    //Ore Generation
    private void setup(final FMLCommonSetupEvent event) {
        // some preinit code
        LOGGER.info("HELLO FROM PREINIT");
        LOGGER.info("ORE BLOCK >> {}", BlockInit.VIBRANIUM_ORE.get());
        MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, FeatureInit::generateOre);
}

I am confused as to why this doesn't work. Any info would help

Link to comment
Share on other sites

"MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, FeatureInit::generateOre);" 

It should not be in "FMLCommonSetupEvent".

 

Solution:

The main: 

@Mod(Example.modid)
public class Example {
    public static final String modid = "examplemod";
    private static final Logger LOGGER = LogManager.getLogger("examplemod");
    public static final CreativeModeTab examplemod = new ExampleTab();

    public Example() {
        IEventBus modEventbus = FMLJavaModLoadingContext.get().getModEventBus();

        ExampleBlocks.BLOCKS.register(modEventbus);
        ExampleItems.ITEMS.register(modEventbus);

        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
      
      	MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, FeatureInit::generateOre);

        ModLoadingContext.get().registerConfig(Type.COMMON, GWorldConfig.SPEC, "example-common.toml");

        MinecraftForge.EVENT_BUS.register(this);
    }
	etc.........
}

 

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.