Advertisement
HalestormXV

Untitled

Apr 8th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1.     private static int calculateGenerationHeight(World world, int x, int z) {
  2.         int y = world.getHeight();
  3.         boolean foundGround = false;
  4.         while (!foundGround && y-- >= 64)
  5.         {
  6.             Block blockAt = world.getBlockState(new BlockPos(x, y, z)).getBlock();
  7.             foundGround =  blockAt == Blocks.WATER
  8.                     || blockAt == Blocks.FLOWING_WATER
  9.                     || blockAt == Blocks.GRASS
  10.                     || blockAt == Blocks.SAND
  11.                     || blockAt == Blocks.SNOW
  12.                     || blockAt == Blocks.SNOW_LAYER
  13.                     || blockAt == Blocks.GLASS
  14.                     || blockAt == Blocks.DIRT
  15.                     || blockAt == Blocks.MYCELIUM;
  16.         }
  17.         return y;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement