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

[Solved][1.14.2] Custom Ore Generation


Recommended Posts

Hello, I wanted to make a mod for me and my friends again, last time was in 1.8 I think so im not really experienced in modding, and I started searching up tutorials for 1.14. I wasn't suprised that I didn't find any since 1.14.2 is still quite new. I did find one for 1.13.2 which worked quite well. I made an ore with the fitting ingot and the Tools for it.(No recepies right now). Then I watched the tutorial for custom ore generation and it didn't work. I couldn't import the CompositeFeature and MinableConfig, I have found the equivalent class to import of MinableConfig on this website https://gist.github.com/williewillus/2dfc945b7b7fdb69cc3ff830072d22fe but I still don't know what to write instead of MinableConfig and still haven't found the new equivalent to CompositeFeature. It would be awesome If someone could help me to get this to work in the nether and the normal world. If you want to look at the code I mean you can see it at 5 Minutes.

 

Edited by NickDerMitHut
Link to post
Share on other sites

PROGRESS! Okay thanks to @HyCraftHD(YT Comments) and @Kaelym searching in the DefaultBiomeFeatures Class did eventually help.

I only got it working for the overworld though so it would be great if someone could fiddle around with it to get it working in the nether/end/other dimension.

I've made an OreGeneration class that looks like this:

Spoiler

package nick.cockmod.world;

import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.common.BiomeManager;
import nick.cockmod.blocks.cockBlocks;

public class OreGeneration{
	public static void SetupOrGen() 
	{
	BiomeManager.getBiomes(BiomeManager.BiomeType.WARM).forEach((BiomeManager.BiomeEntry biomeEntry) -> biomeEntry.biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.func_222280_a(Feature.MINABLE, new OreFeatureConfig
			(OreFeatureConfig.FillerBlockType.NATURAL_STONE, cockBlocks.cockore.getDefaultState(), 8), Placement.field_215028_n, new CountRangeConfig(1, 0, 0, 16))));// Count, MinHeight, MaxHeightBase, MaxHeight


}  

}


 

  

 

I found this OreGen Class by @LTNightshade and edited it so it'd work with 1.14.2

 

The public static void SetupOrGen() can then be "called" in the setup function in your main class.

Spoiler

	private void setup(final FMLCommonSetupEvent event)
	{
		OreGeneration.SetupOrGen();		
	
		logger.info("Setup method registered");
	}

 

I realy hope a dimension implementation isn't too hard to pull off.

GL HF

  • Thanks 2
Link to post
Share on other sites

Nether Ore Generation works now thanks to  @MrTroble. He helped me a lot on the HyCraftHD Discord, and spent quite a lot of time to find out how the things work.

My OreGeneration class now looks like this

Spoiler

package nick.cockmod.world;

import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.common.BiomeManager;
import nick.cockmod.blocks.cockBlocks;

public class OreGeneration{
	public static void SetupOrGen() 
	{
	BiomeManager.getBiomes(BiomeManager.BiomeType.WARM).forEach((BiomeManager.BiomeEntry biomeEntry) -> biomeEntry.biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.func_222280_a(Feature.MINABLE, new OreFeatureConfig
			(OreFeatureConfig.FillerBlockType.NATURAL_STONE, cockBlocks.cockore.getDefaultState(), 3), Placement.field_215028_n, new CountRangeConfig(1, 1, 1, 16))));// Vein/Chunk Count, MinHeight, MaxHeightBase, MaxHeight


}  

	public static void SetupNetherOreGen() 
	{
		Biomes.NETHER.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.func_222280_a(Feature.MINABLE, new OreFeatureConfig
                (OreFeatureConfig.FillerBlockType.NETHERRACK, cockBlocks.cockore.getDefaultState(), 7), Placement.field_215028_n, new CountRangeConfig(8, 10, 10, 128)));
}  

	
}


 

  

 

so I made another "public static void" called it SetupNetherOreGen. Inside of that Mr.Troble found out how to change the biome to the Nether

biomes.NETHER.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.func_222280_a(Feature.MINABLE, new OreFeatureConfig
                (OreFeatureConfig.FillerBlockType.NETHERRACK, YOURBLOCK.getDefaultState(), 7/*MaxOreVeinSize*/), Placement.field_215028_n, new CountRangeConfig(8, 10, 10, 128)));// Vein/Chunk Count, MinHeight, MaxHeightBase, MaxHeight

The of course add it to your setup function in the main class and it should be working for the nether

private void setup(final FMLCommonSetupEvent event)
	{
		OreGeneration.SetupOrGen();		
		OreGeneration.SetupNetherOreGen();		
		
		logger.info("Setup method registered");
	}

GL HF

  • Like 1
  • Thanks 1
Link to post
Share on other sites

For the end I used a costume feature to replace the 1.13 MinableConfig

(See attachments)

 

And then added the Feature to the biom using the following line!

 

Feature ft = new MinableFeature(MinableConfig::func_214641_a);
Biomes.THE_END.addFeature(Decoration.UNDERGROUND_ORES, Biome.func_222280_a(ft, new MinableConfig(Blocks.END_STONE.getDefaultState(), Blocks.GRASS.getDefaultState(), 30), Placement.field_215028_n, new CountRangeConfig(100, 0, 0, 200)));

 

I hope this helps all of you!

 

Cheers

~MrTroble

MinableConfig.java MinableFeature.java

  • Thanks 2
Link to post
Share on other sites
  • 7 months later...

Hey does anyone know if these methods will work for 1.15? I am new to moddding as well, but have created a basic mod with a special ore, resulting ingot, and block, that works. However, I am struggling to get the custom ore to generate in the world. I think the stuff I have been going off of are too outdated (1.12), but this gives me hope, being 1.14. Does anyone know a good place to find how to insert custom ore generation in the over world in 1.15? I’ll try this stuff when I get home and update if these methods do indeed work for 1.15

I hate signatures, they're too distracting

Link to post
Share on other sites
2 hours ago, devguydan said:

Hey does anyone know if these methods will work for 1.15? I am new to moddding as well, but have created a basic mod with a special ore, resulting ingot, and block, that works. However, I am struggling to get the custom ore to generate in the world. I think the stuff I have been going off of are too outdated (1.12), but this gives me hope, being 1.14. Does anyone know a good place to find how to insert custom ore generation in the over world in 1.15? I’ll try this stuff when I get home and update if these methods do indeed work for 1.15

Hi Dan, I'm in the same boat as you. Trying to find a working custom ore generation for 1.15. It seems some things changed from 1.14 and you won't find a lot of the classes matching the names and fields used in the above examples.

 

I spent some time looking around and seemed to have found a solution that works.

 

Here's what I found to work so far:

 

for(Biome biome : ForgeRegistries.BIOMES )
{
  CountRangeConfig myCustomOrePlacementConfig = new CountRangeConfig(/*frequency per chunk*/  2, /*Min*/8,/*Offset*/ 8,/*Max*/ 22);
  biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.myCustomOreBlock.getDefaultState(), 4)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(myCustomOrePlacementConfig)));
}

 

Put this in the Preinit function (normally called setup(final FMLCommonSetupEvent event) in the Forge example mod ) or you can also place it inside a method in a separate OreGeneration class and then call it from setup.

 

If anyone has any corrections or better suggestions than this then definitely please let me know!

Link to post
Share on other sites
20 minutes ago, Jebadiah said:

Hi Dan, I'm in the same boat as you. Trying to find a working custom ore generation for 1.15. It seems some things changed from 1.14 and you won't find a lot of the classes matching the names and fields used in the above examples.

 

I spent some time looking around and seemed to have found a solution that works.

 

Here's what I found to work so far:

 


for(Biome biome : ForgeRegistries.BIOMES )
{
  CountRangeConfig myCustomOrePlacementConfig = new CountRangeConfig(/*frequency per chunk*/  2, /*Min*/8,/*Offset*/ 8,/*Max*/ 22);
  biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, ModBlocks.myCustomOreBlock.getDefaultState(), 4)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(myCustomOrePlacementConfig)));
}
 

 

Put this in the Preinit function (normally called setup(final FMLCommonSetupEvent event) in the Forge example mod ) or you can also place it inside a method in a separate OreGeneration class and then call it from setup.

 

If anyone has any corrections or better suggestions than this then definitely please let me know!

Thanks so much, will give this a go

 

I hate signatures, they're too distracting

Link to post
Share on other sites
@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))));
    }
}

Tried this, but unfortunately, withConfiguration is not a function in my case. Note sure why yet.

 

Ok turns out mine was "obsfucated" still? instead of withConfiguration I have func_225566_b_. Anyone know why this happens?

Edited by devguydan
updated mappings

I hate signatures, they're too distracting

Link to post
Share on other sites
23 hours ago, devguydan said:

withConfiguration is not a function in my case

Same

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give any applicable of: logs, code, desired effects, and actual effects. Be thorough or we can't help you, and don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile! GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Link to post
Share on other sites

Make sure your mappings are up to date.

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 post
Share on other sites
4 hours ago, rowan662 said:

withConfiguration is also not a function for me. I'm using Forge 1.15.2 - 31.1.0

 

2 hours ago, Cadiboo said:

Make sure your mappings are up to date.

Yes, either find the func_... function that matches the signature, or update your 

mappings channel: 'snapshot', '....'

 in build.gradle

Edited by devguydan
formatting

I hate signatures, they're too distracting

Link to post
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.

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.



×
×
  • Create New...

Important Information

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