Posted January 11, 201510 yr Hi, I have some trouble with generating my bush (strawberry bush) into the world and let it randomly spawn uppon the surface. I took the code of WorldGenPumpkin and changed it but that does not work. This is my code: package com.chef.mod.generate; import java.util.Random; import com.chef.mod.Chef; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class BushGeneration extends WorldGenerator { public int bugger; private static final String __OBFID = "CL_00000428"; public boolean generate(World world, Random random, int x, int y, int z) { for (int l = 0; l < 64; ++l) { int i1 = x + random.nextInt( - random.nextInt(; int j1 = y + random.nextInt(4) - random.nextInt(4); int k1 = z + random.nextInt( - random.nextInt(; if (world.isAirBlock(i1, j1, k1) && world.getBlock(i1, j1 - 1, k1) == Blocks.grass && Chef.bushStrawberryBush.canPlaceBlockAt(world, i1, j1, k1)) { world.setBlock(i1, j1, k1, Chef.bushStrawberryBush, random.nextInt(75), 10); } } return true; } } Thanks. Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
January 11, 201510 yr int j1 = y + random.nextInt(4) - random.nextInt(4); Thats where u set the height, ofc your flowers get set in the groung use the method world.getHeightValue() to get the height of a position
January 11, 201510 yr Author I need to register it too, right? Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
January 11, 201510 yr Author How do I do this then? Cause GameRegistry.registerWorldGenerator(new BushGeneration(), 0); Gives an error that I need to implements IWorldGenerator? Or iam just being stupid. Thanks. Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
January 11, 201510 yr 1. Yes, world generators need to implement IWorldGenerator. 2. Check out this tutorial on world generation. 3. This is the world generator I made. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 13, 201510 yr Author Thanks. Now it generates strawberry bushes, but I can't control how much bushes are generated. (minimal bushes to spawn, maximum bushes to spawn and the chance to spawn) No mather what I use as values, it seems to have no effect. Thanks. Code: http://pastebin.com/f0yKEK72 http://pastebin.com/d1buwQVv Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
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.