Posted October 28, 201410 yr Hey guys, I made a few new plants and now I wonder how I can get them to spawn just like minecraft flowers Thanks in advance
October 28, 201410 yr 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!
October 28, 201410 yr Author Have you ever made an IWorldGenerator for ores? It's the same thing, but use WorldGenFlowers instead of WorldGenMineable. unfortunatly not, you know a good tutorial on that?
October 28, 201410 yr 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.
October 28, 201410 yr Have a look here on how to make a worldgen class. Look where I use WorldGenWaterPlants, it's very similar to WorldGenFlowers. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 28, 201410 yr Author 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:?]
October 29, 201410 yr Do it like that: // Worldgenerator Registration GameRegistry.registerWorldGenerator(new WorldGenerator(), 1); and put it in the init or even post-init
October 29, 201410 yr 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!
October 30, 201410 yr Author 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.