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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi guys! I currently have a project that I've been developing in a 'vanilla' environment that I'm actually looking to transfer over to Forge, simply because of how much better the experience would be using Forge. Before starting on this Forge mod, I was planning ahead and was looking at options for proxies, of which I would greatly like to use Velocity. In their docs and by asking around their Discord, they don't support support versions of Forge of 1.13 or later because of changes in the "handshake protocol". But I also really don't want to use an unsupported version of Forge, such as 1.12.2, to be able to use a proxy. I was pointed in the direction of potentially making my own client-side mod to allow Forge to be compatible with an updated proxy, such as Velocity. When asking for a direction for achieving this, I was told to have a look at how the Forge server implements logins and that the discrepancy might be with how modified the handshake protocol is. This sounds like quite the challenge to me and I'm completely up for trying to accomplish it. So for the sake of planning ahead and having a rough idea of how I could accomplish that when the time comes to work on it, has anyone else had experience with trying to achieve this? I appreciate any help or direction offered! Thanks! 
    • Been trying to set up a server for myself and a few friends through BisectHosting. I ended up replicating the server on my own computer to see if the issue persisted (if it was on bisect's end) and it was still there. Every time a player tries to connect to the server they start connecting but after only around 2 seconds the player is disconnected with the error message Payload size exceeds 1048576 bytes.  Upon inspection of the server debug file, the player always disconnects while fmlhandshake ticking packet info is being sent, and I have repeatedly made sure the mods and their configs are identical. I tried to get RandomPatches to increase the max allowed byte size, as the default seems to be 32767, but either something is wrong with it or some other mod is limiting the packet size limit.     Server Debug: https://pastebin.com/xZLbtdQB (only includes portions from after the server launched as I couldn't upload the whole file) Server Log: https://pastebin.com/yrJ3tNaW (similarly only after server launched (hence the weird say commands) Client Log: https://pastebin.com/inSzZV96 (whole thing for once) Modlist: https://pastebin.com/Qvurg45j (All but Optifine and BetterFoliage are present on the server as they have caused issues during startup)   Honestly stumped on how to fix this, been working on it for 10 hours across two days to no avail.
    • quiero dormir uwu
    • Hi, mod called "charging gadgets" is crushing forge minecraft 1.18.1 when i place block from this mod, im temporary playing On 1.18 cuz its not happening on 1.18 but c'mon, pls fix it, 1.18.1 is better and I Wonder i could use this version
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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