Guest User

Untitled

a guest
Aug 13th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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.BlockTwigs;
  6.  
  7. import net.minecraft.block.state.IBlockState;
  8. import net.minecraft.util.math.BlockPos;
  9. import net.minecraft.world.World;
  10.  
  11. public class IWorldGenTwigs {
  12. private BlockTwigs getBlock;
  13. private IBlockState state;
  14.  
  15. public IWorldGenTwigs(BlockTwigs blockIn){
  16. this.getBlock = blockIn;
  17. }
  18.  
  19. public void setGeneratedBlock(BlockTwigs blockIn)
  20. {
  21. this.getBlock = blockIn;
  22. this.state = blockIn.getDefaultState();
  23. }
  24.  
  25. public boolean generate(World worldIn, Random rand, BlockPos position)
  26. {
  27. for (int i = 0; i < 64; ++i)
  28. {
  29. BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
  30.  
  31. if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.getBlock.canBlockStay(worldIn, blockpos, this.state))
  32. {
  33. worldIn.setBlockState(blockpos, this.state, 2);
  34. }
  35. }
  36.  
  37. return true;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment