Posted May 13, 201510 yr I'm attempting to make world gen for a custom block that works the same as vines. The following is my IWorldGenerator code: package dudesmods.fancycheeses.world.gen.feature; import java.util.Random; import cpw.mods.fml.common.IWorldGenerator; import dudesmods.fancycheeses.FancyCheeses; import net.minecraft.util.Direction; import net.minecraft.util.Facing; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; public class WorldGenBacteraLactococcus implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { if(world.provider.dimensionId == 0) { int firstBlockXCoord = chunkX + random.nextInt(16); int firstBlockYCoord = 64; int firstBlockZCoord = chunkZ + random.nextInt(16); generateBacteria(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord); } } public boolean generateBacteria(World world, Random rand, int x, int y, int z) { int l = x; for (int i1 = z; y < 128; ++y) { if (world.isAirBlock(x, y, z)) { for (int j1 = 2; j1 <= 5; ++j1) { if (FancyCheeses.bacteria_lactococcus.canPlaceBlockOnSide(world, x, y, z, j1)) { world.setBlock(x, y, z, FancyCheeses.bacteria_lactococcus, 1 << Direction.facingToDirection[Facing.oppositeSide[j1]], 2); break; } } } else { x = l + rand.nextInt(4) - rand.nextInt(4); z = i1 + rand.nextInt(4) - rand.nextInt(4); } } return true; } } but nothing is generating. Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
May 13, 201510 yr Did you register the Generator? The int chunkX is the number of the chunk that is getting generated. Which is NOT equals to the xPos of the first block.. remember each chunk is 16x16 so some simple math will bring you there Besides that.. There are some things in your coding style which you should REALLY work on. Your method generateBacteria is returning a boolean. Which is ALWAYS true, and you arent event using that value. Why not make your method a void then? You have a a loop in your generateBacteria method which is defining a variable i1 as counter variable. But you are never using that variable. If u want to check if y>128 maybe you should use a while loop, so you dont define useless variables? Greetz Fail
May 13, 201510 yr Author Did you register the Generator? The int chunkX is the number of the chunk that is getting generated. Which is NOT equals to the xPos of the first block.. remember each chunk is 16x16 so some simple math will bring you there Besides that.. There are some things in your coding style which you should REALLY work on. Your method generateBacteria is returning a boolean. Which is ALWAYS true, and you arent event using that value. Why not make your method a void then? You have a a loop in your generateBacteria method which is defining a variable i1 as counter variable. But you are never using that variable. If u want to check if y>128 maybe you should use a while loop, so you dont define useless variables? Greetz Fail Yes, it's registered. Didn't know that, will fix. Finally, generateBacteria is an exact copy of Minecraft's vine generation with the function name changed. So go yell at Jeb_ or whoever makes Minecraft nowadays. Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
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.