Jump to content

Multiple Ore Generation Problem 1.7.2


tamanor

Recommended Posts

Could some one help me i trying to get more than one ore spawn in my custom dimension I have followed a tutorial on multiple ore generation (new to modding) xD but it does not generate right http://oi60.tinypic.com/x22jjp.jpg ignore all the random block just testing things ^^ but as you can see in the picture it spawning them all together and in the same veins of ore. can any one help me fix this please

Code

 

 

private void generateTestDimension(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++) //8 is rarity
{
int xCoord = chunkX + random.nextInt(16);
int yCoord = random.nextInt(256);
int zCoord = chunkZ + random.nextInt(16);

(new TvWorldGenMinable(Blocks.obsidian, 15)).generate(world, random, xCoord, yCoord, zCoord);
(new TvWorldGenMinable(Blocks.redstone_block, 15)).generate(world, random, xCoord, yCoord, zCoord);
(new TvWorldGenMinable(Blocks.emerald_block, 15)).generate(world, random, xCoord, yCoord, zCoord);
(new TvWorldGenMinable(Blocks.brick_block, 15)).generate(world, random, xCoord, yCoord, zCoord);
(new TvWorldGenMinable(Blocks.stonebrick, 15)).generate(world, random, xCoord, yCoord, zCoord);

}

 

 

also I have tried copying and pasting the whole loop and changing the xCoord yCoord zCoord to  xCoord1 yCoord1 zCoord1 and so on but it stops generating any chunks.

 

Thanks

Link to comment
Share on other sites

Hey, I remember being in the same place you are! except I didn't have my own dimension. I'm sure you can figure out how to convert this to work in your own dimension though.

This is the code I used:

package ryansmod;

import java.util.Random;

import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.World;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import ryansmod.common.block.AleniumOre;
import ryansmod.RyansMod;

public class Generator implements IWorldGenerator {
public static Block AleniumOreGen = new ryansmod.common.block.AleniumOre();
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        switch(world.provider.dimensionId){
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
        }

}

private void generateEnd(World world, Random random, int i, int j) {}

private void generateSurface(World world, Random random, int i, int j) {
                // Just copy the stuff below to spawn multiple kinds of ores. I hope its not to hard for you to read!
	//Number of clusters of the ore in question spawned
	for(int k = 0; k < 10; k++) {
		int AleniumOreXCoord = i + random.nextInt(16); //remember +i
		int AleniumOreYCoord = random.nextInt(14);
		int AleniumOreZCoord = j + random.nextInt(16); //remember +j
		//WordlGenMinable([block], [Number of block per cluster(?)])
		(new WorldGenMinable(RyansMod.aleniumOre, 5)).generate(world, random, AleniumOreXCoord, AleniumOreYCoord, AleniumOreZCoord);
	}
}

private void generateNether(World world, Random random, int i, int j) {}
}

 

And then in my main file I had it registered with:

 

    @EventHandler
    public void load(FMLInitializationEvent event) {
    		GameRegistry.registerWorldGenerator(new Generator(), 0); 
            proxy.registerRenderers();
    }

 

Hope this helps! Good luck on your mod!

Link to comment
Share on other sites

Hey, I remember being in the same place you are! except I didn't have my own dimension. I'm sure you can figure out how to convert this to work in your own dimension though.

This is the code I used:

package ryansmod;

import java.util.Random;

import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.World;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import ryansmod.common.block.AleniumOre;
import ryansmod.RyansMod;

public class Generator implements IWorldGenerator {
public static Block AleniumOreGen = new ryansmod.common.block.AleniumOre();
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        switch(world.provider.dimensionId){
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
        }

}

private void generateEnd(World world, Random random, int i, int j) {}

private void generateSurface(World world, Random random, int i, int j) {
                // Just copy the stuff below to spawn multiple kinds of ores. I hope its not to hard for you to read!
	//Number of clusters of the ore in question spawned
	for(int k = 0; k < 10; k++) {
		int AleniumOreXCoord = i + random.nextInt(16); //remember +i
		int AleniumOreYCoord = random.nextInt(14);
		int AleniumOreZCoord = j + random.nextInt(16); //remember +j
		//WordlGenMinable([block], [Number of block per cluster(?)])
		(new WorldGenMinable(RyansMod.aleniumOre, 5)).generate(world, random, AleniumOreXCoord, AleniumOreYCoord, AleniumOreZCoord);
	}
}

private void generateNether(World world, Random random, int i, int j) {}
}

 

And then in my main file I had it registered with:

 

    @EventHandler
    public void load(FMLInitializationEvent event) {
    		GameRegistry.registerWorldGenerator(new Generator(), 0); 
            proxy.registerRenderers();
    }

 

Hope this helps! Good luck on your mod!

 

Wow thanks that seems to have done the trick :) there all split up now and are spawning underground as well now :)

 

thanks again ill post back if I run into some problem with it but from what i can see it all working :)

Link to comment
Share on other sites

Sure! I ask lots of questions and am always glad to help someone else. Glad it worked.  :D

 

Do you no how I would go about make filler blocks and the top layer spawn. apart from the ores i got to spawn in the world its all diamond blocks and i tried a few things but i can not see to find out how to do it.

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.

Announcements



×
×
  • Create New...

Important Information

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