GenuineSounds

Highest Block Height for Chunk

Sep 26th, 2014
409
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. package com.genuineminecraft.ores.generator;
  2.  
  3. import net.minecraft.init.Blocks;
  4. import net.minecraft.world.chunk.Chunk;
  5.  
  6. public class Utility {
  7.  
  8.     public static int findHighestBlock(Chunk chunk) {
  9.         int yMax = chunk.getTopFilledSegment() + 15;
  10.         for (int y = yMax; y > 0; y--) {
  11.             for (int x = 0; x < 16; x++) {
  12.                 for (int z = 0; z < 16; z++) {
  13.                     if (chunk.getBlock(x, y, z).equals(Blocks.air))
  14.                         yMax = y;
  15.                     else
  16.                         return yMax;
  17.                 }
  18.             }
  19.         }
  20.         return yMax;
  21.     }
  22. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment