Jump to content

How to generate a custom ore?


Recommended Posts

I'm very confused here...I have a custom ore I want to generate, and I was told to run "OreDictionary.registerOre" on the ore to add it to the ore dictionary. However, that still doesn't seem to cause it to spawn? I'm confused on how to set it up to spawn how I want it to spawn (I'd like to add multiple ores with varying spawn rates).

Link to comment
Share on other sites

Sweet! Thanks! That fixed all of my problems. Only one more question. Do I have to make a new generation code for every ore? Here's my OreGen code.


package radial.Main;

import java.util.Random;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;

public class OreGen implements IWorldGenerator {

public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
	// TODO Auto-generated method stub
	case 0 : generateSurface(world, random,chunkX*16,chunkZ*16);

private void generateSurface(World world, Random random, int BlockX, int BlockZ) {
for(int i = 0; i<10;i++){
	int Xcoord = BlockX + random.nextInt(16);
	int Zcoord = BlockZ + random.nextInt(16);
	int Ycoord = random.nextInt(100);
	(new WorldGenMinable(mainClass.TestOre, 4)).generate(world,  random,  Xcoord,  Ycoord,  Zcoord);

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.

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.