Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public class WorldGenBurnedTree extends WorldGenAbstractTree{
  2.    
  3.     public WorldGenBurnedTree(boolean notify) {
  4.           super(notify);
  5.         }
  6.  
  7.         public static final IBlockState TRUNK = BlockInit.BURNED_LOG.getDefaultState();
  8.  
  9.         public boolean generate(World worldIn, Random rand, BlockPos base) {
  10.             int trunkHeight = rand.nextInt(4) + 3;
  11.  
  12.             for (int i = 0; i < trunkHeight; i++) {
  13.                 if (!(worldIn.getBlockState(new BlockPos(base.getX(), base.getY() + i + 1, base.getZ())).equals(Blocks.AIR.getDefaultState()))) {
  14.                     return false;
  15.                 }
  16.             }
  17.             for (int i = 0; i < trunkHeight; i++) {
  18.               world.setBlockState(new BlockPos(base.getX(), base.getY() + i + 1, base.getZ()), TRUNK);
  19.             }
  20.         }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement