Jump to content

[Solved]1.15 Hook into world generation


devguydan

Recommended Posts

Looking for a good place to start to generate my custom ores and entities for 1.15. I previously tried a way that was written for 1.12 and no luck. I found a way for 1.14 on here, and will try that when I get home, but wondering if anyone has recommendations for best practices and methods for 1.15. I currently have my custom ore, ingot, and block. I want to generate that ore in levels 5-25 for example so players can find it.

Edited by devguydan
Solved

I hate signatures, they're too distracting

Link to comment
Share on other sites

1 hour ago, devguydan said:

I found a way for 1.14 on here, and will try that when I get home

Do that.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

5 minutes ago, Draco18s said:

Do that.

haha Thanks will do

 

1 hour ago, diesieben07 said:

Did you look at how vanilla ores are generated?

I have been digging through forge, and have not seen how vanilla generates ores yet. I did see the ChunkEvent, which looks promising. Mind pointing me what directories to look in for vanilla world generation? Not too familiar with the code base yet.

I hate signatures, they're too distracting

Link to comment
Share on other sites

20 hours ago, diesieben07 said:

Find a vanilla ore in the Blocks class. Find references.

biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.DIAMOND_ORE.getDefaultState(), 8), Placement.COUNT_RANGE, new CountRangeConfig(1, 0, 0, 16)));

 

This is how vanilla registers underground ores. Unfortunately there is no `createDecoratedFeature` function in `Biome` use in `ForgeRegistries.BIOMES`. Vanilla MC has this function in it's Biome class, but Forge's Biome class does not have anything matching this signature. Instead what works is to addFeature with a Underground Ores Decoration, and pass it your ore with a config, giving the config a filler block, your own ore, and the max size to generate the ores in. Then pass a placement config with min and max height, max generation per chunk, etc: 

 

@SuppressWarnings({"ConstantConditions"})
@SubscribeEvent
public static void FMLLoadCompleteEvent(FMLLoadCompleteEvent event) {
    for (Biome biome : ForgeRegistries.BIOMES) {
        biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(
                OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.LOAD_STONE_ORE.getDefaultState(), 8))
                .withPlacement(Placement.COUNT_RANGE.configure(new CountRangeConfig(4, 0, 0, 32))));
    }
}

This is in my ModEventSubscriber class obviously. Now I want to make sure I am reading it correctly. Is this saying, that once per chuck (ie, once per 65,536 blocks), it will generate up to 9 ores in a group, and that group may be generated anywhere between levels 0 and 16? If so then the above vanilla example means diamond groups only generate once per 65k blocks? I find that hard to believe. 

 

Also for a side note, would updating my snapshot in `build.gradle` give me better names for functions? I am currently using the default 1.15.2 mdk build file with 

mappings channel: 'snapshot', version: '20190719-1.14.3'

Edit: updating this DID resolve some more obsfucated function names.

Edited by devguydan
updated mappings

I hate signatures, they're too distracting

Link to comment
Share on other sites

2 hours ago, devguydan said:
4 hours ago, diesieben07 said:

Did you look at how vanilla ores are generated?

I have been digging through forge, and have not seen how vanilla generates ores yet. I did see the ChunkEvent, which looks promising. Mind pointing me what directories to look in for vanilla world generation? Not too familiar with the code base yet.

For anyone in the future, check `DefaultBiomeFeatures` for implementation for structure, entities, ores, blocks, etc

  • Like 1

I hate signatures, they're too distracting

Link to comment
Share on other sites

Update your mappings

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.