Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.2] How to check for filler block in the End


kwpugh
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

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())));   

 

Link to comment
Share on other sites

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

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())));   

        
    }

 

Link to comment
Share on other sites

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( ...
Link to comment
Share on other sites

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.

 

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.