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

Hi All,

 

I'm looking for some guidance here.   I'm trying to spawn my ore in the End.

 

Here is how I did it in the the Overworld and Nether:

 public static void setupOregen()
    {
        for(Biome biome : ForgeRegistries.BIOMES)
        {
            if(WorldgenConfig.GOBBER2_ORE_GENERATION.get())
                biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.gobber2_ore.getDefaultState(), WorldgenConfig.GOBBER2_ORE_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_MAX_HEIGHT.get())));
 
            if(WorldgenConfig.GOBBER2_LUCKY_BLOCK_GENERATION.get())
                biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.gobber2_lucky_block.getDefaultState(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_LUCKY_BLOCK_CHANCE.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MAX_HEIGHT.get())));
        }
    }
    
    public static void setupNetherOregen()
    {
        if(WorldgenConfig.GOBBER2_ORE_NETHER_GENERATION.get())
           Biomes.NETHER.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NETHERRACK, BlockList.gobber2_ore_nether.getDefaultState(), WorldgenConfig.GOBBER2_ORE_NETHER_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_NETHER_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MAX_HEIGHT.get())));   
    }

 

When I change the biome to End biomes, I get nothing.

   public static void setupEndOregen()
    {    
        if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get())
            Biomes.THE_END.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get())));
        
    }

 

No ores spawning as a result.   I suspect it is because of the filler block (NATURAL_STONE).   I had to change the FillerBlockType to NETHERRACK for it to work in the Nether.

 

Looking through FillerBlockType, there doesn't seem to be any End related blocks.


   public static enum FillerBlockType {
      NATURAL_STONE("natural_stone", (p_214739_0_) -> {
         if (p_214739_0_ == null) {
            return false;
         } else {
            Block block = p_214739_0_.getBlock();
            return block == Blocks.STONE || block == Blocks.GRANITE || block == Blocks.DIORITE || block == Blocks.ANDESITE;
         }
      }),
      NETHERRACK("netherrack", new BlockMatcher(Blocks.NETHERRACK));

Any suggestions on how to approach this?

 

Thank you.

Unfortunately, because 

FillerBlockType

is an Enum, the only way to do this at the moment (or at least the only one I know) is to create your own class extending 

OreFeature

Then override 

func_207803_a

copy it and in there, replace 

if (p_207803_3_.target.func_214738_b().test(p_207803_1_.getBlockState(blockpos$mutableblockpos))) { ...

with something that checks for end stone, or whatever your ore should spawn in, like this:

if (p_207803_1_.getBlockState(blockpos$mutableblockpos).getBlock() == Blocks.END_STONE) { ...
  • Author

Thanks for the guidance.

 

How would it my custom version of OreFeature get used here?

 if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get())
            Biomes.THE_END.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get())));   

 

  • Author

Hi m00nl1ght,

 

I tried coding this up and perhaps some of the mappings changed with the latest update.   

 

You said to look for:

if (p_207803_3_.target.func_214738_b().test(p_207803_1_.getBlockState(blockpos$mutableblockpos))) { ...

 I presume in OreFeature.java, but there isn't one.

 

I did find:

if (config.target.func_214738_b().test(worldIn.getBlockState(blockpos$mutableblockpos))) {

inside of the protected boolean func_207803_a method

 

I created my own CustomOreFeature class and @Override on functionalists_207803.  I then replaced the following:

if (config.target.func_214738_b().test(worldIn.getBlockState(blockpos$mutableblockpos)))

replaced with:

if (config.target.func_214738_b().test(worldIn.getBlockState(blockpos$mutableblockpos).getBlock() == Blocks.END_STONE) ) {

I get the following error on test:  The method test(BlockState) in the type Predicate<BlockState> is not applicable for the arguments (boolean)

 

Doing this directly:

if (p_207803_1_.getBlockState(blockpos$mutableblockpos).getBlock() == Blocks.END_STONE)

Generates unresolved variable on p_207803_1 and blockpos$mutableblockpos cannot be resolved to a variable errors.

 

Any thoughts?

 

Regards.

 

Edited by kwpugh

p_207803_1_

is worldIn now, so

if (worldIn.getBlockState(blockpos$mutableblockpos).getBlock() == Blocks.END_STONE)

should work

  • Author

That compiles without error.

 

As to my OreGeneration.class, there are some many parameters on the biome line, that I am confused about how to pass in an instance of my CustomOreFeature.

 

  public static void setupEndOregen()
    {
        if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get())
           Biomes.END_HIGHLANDS.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get())));   
    
        if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get())
            Biomes.END_MIDLANDS.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get())));
    
        if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get())
            Biomes.THE_END.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get())));   

        
    }

 

In your OreGeneration class, add a field that holds your own feature instance

private static final YourOreFeature END_OREGEN = new YourOreFeature();

And then use that instead of 

Feature.ORE

like this:

Biomes.THE_END.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, Biome.createDecoratedFeature(END_OREGEN, new OreFeatureConfig( ...
  • Author

Well, that did the trick.   Thank you so much.   I have been struggling with this quite a lot.

 

I am halfway thru a 77 hour Java course on Udemy at the moment, so I am learning and doing at the same time.

 

Thanks for your help.

 

Regards.

 

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.