Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
        	}
        }
}

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....

  }

  • Author

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!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.