Jump to content

[SOLVED][1.4.7]Ore Generating Above Ground


Vemahk20

Recommended Posts

Simply that ^^^.

 

Ill paste my generation code here...

 

package IndustrialBreakout.world;

import java.util.Random;

import IndustrialBreakout.mod_IndustrialBreakout;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

public class WorldGeneratorIB implements IWorldGenerator {
        @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        	for(int i=10;i<=32;i++){
        		world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreTitanium.blockID);
        	}
        	for(int i = 32; i <= 64; i++){
        		world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreCopper.blockID);
        	}
        	for(int i = 10; i <= 32; i++){
        		world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreTin.blockID);
        	}
        	for(int i = 5; i <= 16; i++){
        		world.setBlock(chunkX*16 + random.nextInt(16), i, chunkZ*16 + random.nextInt(16), mod_IndustrialBreakout.oreChargedCoal.blockID);
        	}
        }
}

Link to comment
Share on other sites

Quite simply, you are not checking to see if it is a valid gen-replaceable block before generating your ores.

 

You need to check if the block going to be replaced is world-gen replaceable / stone

 

int x = chunkX*16 +random.nextInt(16);

int y = chunkY*16 +random.nextInt(16);

int z = chunkZ*16 +random.nextInt(16);

int id = world.getBlockID(x,y,z);

Block block = Block.blocksList[id];

if(block!=null && block.isGenMineableReplaceable(world, x, y, z, Block.stone.blockID))

  {

//set your blocks here....

  }

Link to comment
Share on other sites

Quite simply, you are not checking to see if it is a valid gen-replaceable block before generating your ores.

 

You need to check if the block going to be replaced is world-gen replaceable / stone

 

int x = chunkX*16 +random.nextInt(16);

int y = chunkY*16 +random.nextInt(16);

int z = chunkZ*16 +random.nextInt(16);

int id = world.getBlockID(x,y,z);

Block block = Block.blocksList[id];

if(block!=null && block.isGenMineableReplaceable(world, x, y, z, Block.stone.blockID))

  {

//set your blocks here....

  }

 

Thanks, it works great!

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.