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

I have Updated my Worldgen class.

For the overworld the blocks are generating, but for the nether they don't.

 

public class ModWorldGenerator implements IWorldGenerator {



@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	// TODO Auto-generated method stub
	switch(world.provider.getDimensionType())
	{
	case NETHER:
		generateNether(world, random, chunkX, chunkZ);
		break;
	case OVERWORLD:
		generateOverworld(world, random, chunkX, chunkZ);
		break;
	case THE_END:
		generateEnd(world, random, chunkX, chunkZ);
		break;
	}
}

public void generateNether(World world, Random rand, int x, int z){
	generateOre(ModBlocks.demonite.getDefaultState(), world, rand, 0, x, z, 33, 66, 75, 1, 256, Blocks.NETHERRACK);
	//generateSingleOre(TemBlocks.fel_iron_ore, world, rand, 0, x, z, 100, 1, 256, TemBlocks.demonite);

}

public void generateOverworld(World world, Random rand, int x, int z){


	int XX = x* 16;
	int ZZ = z* 16;
	BlockPos pos = new BlockPos(XX, 70, ZZ);
	String biome = world.getBiomeGenForCoords(pos).getBiomeName();//getWorldChunkManager().getBiomeGenAt(XX, ZZ);


	if(biome.contains("River")){
		generateOre(ModBlocks.chalkstone.getDefaultState(), world, rand, 0, x, z, 25, 33, 100, 45, 65, Blocks.STONE);
	}
	if(biome.contains("Ocean")){
		generateOre(ModBlocks.chalkstone.getDefaultState(), world, rand, 0, x, z, 15, 33, 50, 20, 50, Blocks.STONE);
		generateOre(ModBlocks.chalkstone.getDefaultState(), world, rand, 0, x, z, 15, 33, 50, 10, 50, Blocks.STONE);
		generateOre(ModBlocks.chalkstone.getDefaultState(), world, rand, 0, x, z, 10, 15, 50, 30, 50, Blocks.GRAVEL);
	}
	if(biome.contains("Hills") || biome.contains("Mountain")){
		generateOre(ModBlocks.marblestone.getDefaultState(), world, rand, 0, x, z, 25, 33, 50, 65, 256, Blocks.STONE);
	}

	//generateOre(TemBlocks.andesite, world, rand, 0, x, z, 25, 33, 50, 1, 250, Blocks.stone);
	//generateOre(TemBlocks.diorite, world, rand, 0, x, z, 25, 33, 50, 1, 250, Blocks.stone);
	//generateOre(TemBlocks.granite, world, rand, 0, x, z, 25, 33, 50, 1, 250, Blocks.stone);




}

public void generateEnd(World world, Random rand, int x, int z){
	//generateOre(TemBlocks.chalkstone, world, rand, 1, x, z, 2, 10, 5, 1, 100, Blocks.end_stone);

}

public void generateOre(IBlockState state, World world, Random random, int meta, int chunkX, int chunkZ, int minVienSize, 
		int maxVienSize, int chance, int minY, int maxY, Block generateIn){
	int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
	int heightRange = maxY - minY + 1;
	WorldGenMinable gen = new WorldGenMinable(state,vienSize);
	for(int i =0; i < chance; i++){
		int xRand = chunkX * 16 + random.nextInt(16);
		int yRand = random.nextInt(heightRange) + minY;
		int zRand = chunkZ * 16 + random.nextInt(16);
		//Block testblock = world.getBlock(xRand, yRand, zRand);
		BlockPos pos = new BlockPos(xRand, yRand, zRand);

		gen.generate(world,  random ,pos);


	}


}
/*	
public void generateSingleOre(Block block, World world, Random random, int meta, int chunkX, int chunkZ, 
		int chance, int minY, int maxY, Block generateIn){
	//int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
	int heightRange = maxY - minY + 1;
	WorldGenSingleMinable gen = new WorldGenSingleMinable(block, meta,  generateIn);
	for(int i =0; i < chance; i++){
		int xRand = chunkX * 16 + random.nextInt(16);
		int yRand = random.nextInt(heightRange) + minY;
		int zRand = chunkZ * 16 + random.nextInt(16);
		Block testblock = world.getBlock(xRand, yRand, zRand);
		if (testblock==generateIn){
		gen.generate(world,  random , xRand, yRand, zRand);

		}
	}



}
*/



}

 

 

Anyone has an idea why my blocks don't generate in the nether?

 

nvm i looked into the WorldGenMinable and i saw i need to use a predicate.

Solved it :-)

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.