Guest User

Untitled

a guest
Jun 18th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public class ModWorldGeneratorFlowers extends WorldGenerator {
  2.  
  3. private BlockBush flower;
  4. private IBlockState state;
  5.  
  6. public ModWorldGeneratorFlowers(BlockBush flower) {
  7. this.setGeneratedBlock(flower);
  8. }
  9.  
  10. public void setGeneratedBlock(BlockBush flower) {
  11. this.flower = flower;
  12. this.state = flower.getDefaultState();
  13. }
  14.  
  15. public boolean generate(World worldIn, Random rand, BlockPos position) {
  16. for (int i = 0; i < 20; ++i) {
  17. BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4),
  18. rand.nextInt(8) - rand.nextInt(8));
  19. if (blockpos.getX() > 0 && blockpos.getY() > 0 && blockpos.getZ() > 0 && blockpos.getY() < 255) {
  20. if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky())
  21. && this.flower.canBlockStay(worldIn, blockpos, this.state)) {
  22. worldIn.setBlockState(blockpos, this.state, 2);
  23. }
  24. }
  25. }
  26.  
  27. return true;
  28. }
  29.  
  30. }
Add Comment
Please, Sign In to add comment