Jump to content

Recommended Posts

Posted

Have you ever made an IWorldGenerator for ores? It's the same thing, but use WorldGenFlowers instead of WorldGenMineable.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

Add this to you initializationEvent: "GameRegistry.registerWorldGenerator(new RPGGenerator(), 1);".

But use instead of my class a new class that implements IWorldGenerator.

If you have eclipse, you can use "add unimplement methods" to get the method you will have to use.

That method is called every time a new chunk is generated, I hope I have you told enough.

Posted

Alright Thanks so far, but I get a crash :/

Dont know why it wont work, only thing im not too sure about is where to register my generator? (currently in my preInit)

There's my code :

 

public class PlantGenerator implements IWorldGenerator
{
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
	if(world.provider.dimensionId == 0) generateFlowers(world, random, chunkX*16, chunkZ*16);

}

private void generateFlowers(World world, Random random, int x, int z) {
	for(int i = 0; i < 3; i++){
	int xCoord = x + random.nextInt(16);
	int zCoord = z + random.nextInt(16);
	new WorldGenFlowers(Blocks.red_flower).generate(world, random, xCoord, world.getHeightValue(xCoord, zCoord), zCoord);
	}
}
}





public static PlantGenerator plantGene;
    public void preInit(FMLPreInitializationEvent event) {
	GameRegistry.registerWorldGenerator(plantGene, 0);
}

 

Crash:

 

 

java.lang.NullPointerException: at index 0
at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:240) ~[guava-15.0.jar:?]
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:231) ~[guava-15.0.jar:?]
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:226) ~[guava-15.0.jar:?]
at com.google.common.collect.ImmutableList.construct(ImmutableList.java:303) ~[guava-15.0.jar:?]
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:258) ~[guava-15.0.jar:?]
at cpw.mods.fml.common.registry.GameRegistry.computeSortedGeneratorList(GameRegistry.java:120) ~[GameRegistry.class:?]
at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:95) ~[GameRegistry.class:?]
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:310) ~[ChunkProviderServer.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163) ~[Chunk.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:52) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor$Task.finish(AsynchronousExecutor.java:189) ~[AsynchronousExecutor$Task.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor.finishActive(AsynchronousExecutor.java:354) ~[AsynchronousExecutor.class:?]
at net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(ChunkIOExecutor.java:30) ~[ChunkIOExecutor.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:657) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:608) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:747) [MinecraftServer$2.class:?]

 

Posted

That's not the problem, it looks like he's registering it. The problem is you don't assign that PlantGenerator field a value before registering it.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

uhm now I got another problem, when i create a new world it takes around 50 times longer and theres a huge hole where i spawn where there are just no blocks at all, and it takes another 5 min to fill that gap, not too sure if thats caused by my epic generator tho..

But Thanks anyway :)

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.