Guest User

Untitled

a guest
Sep 1st, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. package com.mightydanp.eot.api.common.world.gen.feature;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.mightydanp.eot.common.block.ModBlocks;
  6.  
  7. import net.minecraft.util.math.BlockPos;
  8. import net.minecraft.world.World;
  9. import net.minecraft.world.gen.feature.WorldGenerator;
  10.  
  11. public class IWorldGenTwigs extends WorldGenerator{
  12.  
  13. public boolean generate(World worldIn, Random rand, BlockPos position)
  14. {
  15. for (int i = 0; i < 64; ++i)
  16. {
  17. BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
  18.  
  19. if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && ModBlocks.twigs.canPlaceBlockAt(worldIn, blockpos))
  20. {
  21. worldIn.setBlockState(blockpos, ModBlocks.twigs.getDefaultState(), 2);
  22. }
  23. }
  24.  
  25. return true;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment