Advertisement
Eragonn14900

Untitled

Dec 9th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package com.reactioncraft.desert.common;
  2.  
  3. import java.util.Random;
  4. import net.minecraft.block.BlockBush;
  5. import net.minecraft.block.state.IBlockState;
  6. import net.minecraft.util.math.BlockPos;
  7. import net.minecraft.world.World;
  8. import net.minecraft.world.gen.feature.WorldGenerator;
  9.  
  10. public class WorldGenFlowerState extends WorldGenerator
  11. {
  12. private final IBlockState block;
  13.  
  14. public WorldGenFlowerState(IBlockState blockIn)
  15. {
  16. this.block = blockIn;
  17. }
  18.  
  19. public boolean generate(World worldIn, Random rand, BlockPos position)
  20. {
  21. for (int i = 0; i < 64; ++i)
  22. {
  23. BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
  24.  
  25. if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < worldIn.getHeight() - 1))
  26. {
  27. worldIn.setBlockState(blockpos, block, 2);
  28. }
  29. }
  30.  
  31. return true;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement