July 17, 201411 yr public void updateTick(World world, int x, int y, int z, Random random) { if (!world.isRemote && world.getBlockLightValue(x, y + 1, z) >= 9) for (int i = 0; i < 4; ++i) { int randX = x + random.nextInt(3) - 1; int randY = y + random.nextInt(3) - 1; int randZ = z + random.nextInt(3) - 1; if (world.getBlock(randX, randY, randZ) != Blocks.air && world.getBlock(randX, randY, randZ) != this && world.getBlock(randX, randY+1, randZ).isReplaceable(world, x, y, z)) world.setBlock(randX, randY+1, randZ, this); } } ?
July 17, 201411 yr gracious me is this thread still going? So what are we trying to accomplish? After the block is freshly placed, it should check all four spaces next to it, on the same y level. If any of them are empty, and the block underneath the empty space is full, then we fill the space with our block. That's it! Each time we place our block, it will schedule a random UpdateTick, so after a bit of time, that new block will be called with UpdateTick to check for adjacent spaces, and so on, until the block spreads out over the entire plateau. So long as we keep that in mind, the code for that is really pretty simple. No need for random stuff, no need to try the same twenty seven locations 45000 times. public void updateTick(World world, int x, int y, int z, Random random) { if (!world.isRemote) { // execute on server side only to avoid strange ghost blocks and disturbing things checkAndFillBlock(world, x - 1, y, z); checkAndFillBlock(world, x + 1, y, z); checkAndFillBlock(world, x, y, z - 1); checkAndFillBlock(world, x, y, z + 1); } } // check if this block is empty (air) and the block underneath it is solid (not air). If so, fill it with the this Block private void checkAndFillBlock(World world, int wx, int wy, int wz) { if (world.getBlock(wx, wy, wz) == Blocks.air && world.getBlock(wx, wy-1, wz) != Blocks.air) { world.setBlock(wx, wy, wz, this); } } All that other stuff is baggage that I'm guessing you probably don't want, eg getBlockLightValue -> only growing near torches or glowstone. -TGG
July 20, 201411 yr Author whoever keeps deleting my reply i'm not bumping this for no reason my problem has not been solved i want the block to spread over the top of adjacent blocks and all of the people trying to help reply's don't work BioWarfare Mod: http://goo.gl/BYWQty
July 20, 201411 yr Author If anyone can help with this that would be awesome?! BioWarfare Mod: http://goo.gl/BYWQty
July 21, 201411 yr Hi Show your latest code? I am surprised that the code I put in my last post doesn't work. -TGG
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.