Jump to content

Nether and End ore generation not working [Solved - see end for solution]


Yagoki

Recommended Posts

Sorted out all of my blocks for the world section of my mod, and have managed to get them to generate successfully in the overworld, however the ores which i set to generate in the nether and end do not seem to be spawning anywhere (several extended searches and high spawn rates for testing yielded nothing).

not sure what i'm doing wrong so any help would be welcome.

 

World Generator class (only showing one ore form each method as there's a lot of them)

package mods.mtech.code.common;

import java.util.Random;

import mods.mtech.code.blocks.BlockOreNether;
import mods.mtech.code.blocks.BlockOreOverworld;
import mods.mtech.code.client.Config;
import net.minecraft.block.Block;
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 OreGeneration implements IWorldGenerator
{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	switch(world.provider.dimensionId)
	{
	case -1:
		generateNether(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	case 1:
		generateEnd(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	case 0:
		generateOverworld(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	}
}

private void generateOverworld(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{

	System.out.println("generating overworld");
	if(Config.Blocks.aluminiumOreEnabled)
	{
		for (int i = 0; i < 10; i++)
		{
			(new WorldGenMinable(BlockOreOverworld.oreAluminium.blockID, 5)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(32), chunkZ + random.nextInt(16));
		}
	}
}

private void generateNether(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	System.out.println("generating nether");
	if(Config.Blocks.azuriteOreEnabled)
	{
		for (int i = 0; i < 30; i++)
		{
			(new WorldGenMinable(BlockOreNether.oreAzurite.blockID, 50, Block.netherrack.blockID)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(256), chunkZ + random.nextInt(16));
		}
	}
}

private void generateEnd(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	System.out.println("generating end");
	if(Config.Blocks.calciteOreEnabled)
	{
		for (int i = 0; i < 50; i++)
		{
			(new WorldGenMinable(BlockOreNether.oreCalciteEnd.blockID, 10, Block.whiteStone.blockID)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(256), chunkZ + random.nextInt(16));
		}
	}
}
}

 

the debug printing shows the correct prints for each dimension, but there's still no ore. (other than in the overworld)

I've also tried this with adapted versions of the WorldGenMinable class (just replacing the block id it was replacing with the one i was trying to spawn it in), but the results were the same

 

Thanks in advance

Link to comment
Share on other sites

Understand the classes you are using.

WorldGenMinable only replaces stone. No stone in nether or end, so your ore doesnt generate.

Please do some research before posting, this is a inacturate statement.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

i know what the classes are using, if you look in the code for WorldGenMinable there are 3 constructors, one which will only replace stone and two where you can specify a target block (at least that's my understanding of it looking through the class). in my code i've specified the target blocks as netherrack and whitestone (endstone) so which is where my confusion arises from.

 

your point was one of the first things i though of, hence to start with i tred with my own versions of the code for this replacing the Block.stone.blockID with the necessary ones, which still had no effect.

 

(new WorldGenMinable(BlockOreNether.oreCalciteEnd.blockID, 10, Block.whiteStone.blockID))

Link to comment
Share on other sites

How very odd...

 

looking further through the class, and the paths for all the variables i was passing it the target which can be set using the other constructors seems to be rather redundant

 

the following line is called before the ore is added to the chunk, and in the declaration for the method none of the parameters are relay necessary other than the block as when it's called it just checks to see if the id == stone.blockID.

 

if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3, field_94523_c)))

 

field_94523_c is supposed to be the id of the target block, and the bit which seems odd is the block.isGenMineableReplaceable(...) method.

 

this all seems rather odd to me, as i can't find it overridden in netherrack or anything ???

 

this could explain the problem, please say if I've missed anything here with the code or what it's actually doing. I do have a fair amount of experience of java, but we all make mistakes so i could've missed something.

 

 

P.S. currently making custom class to test

Link to comment
Share on other sites

You could you know, read it, and see that there was a bug that has been fixed referecing this exact things:

https://github.com/MinecraftForge/MinecraftForge/commit/58ad89ca9066b2e0b0749e2b795a6ce953005b0e

 

Or if I have to explicity say it: UPDATE YOUR FORGE.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.