class Chunk
{
    public boolean cubeExists(int y)
    {
    	int cube = (y >> 4) + cubesOffset;
    	return cubes[cube] != null;
    }
    
    public ChunkCube cubeAtYIndex(int y)//TODO: handle top/bottom chunks
    {return cubes[y+cubesOffset];}

    public void setCubeAtYIndex(int y, ChunkCube cube)
    {cubes[y+cubesOffset] = cube;}


    public ChunkCube[] cubes = new ChunkCube[cubesLength];

    public short heightMap[];

    
    //------------CONSTANTS:---------------------
    //the size of the cubes array
    public static final int cubesLength = 4094;//(2<<16)-2

    //the offset of cubes. You can see how it works in the three functions
    public static final int cubesOffset = cubesLength>>1;

    public static final short cubesYOffset = (short) (cubesOffset * ChunkCube.YSIZE);
    
    //maxPossibleY is the highest possible elevation. IE: the equivalent of Vanilla 127
    // (or maybe vanilla 128?)
    public static final int maxPossibleY = (cubesLength-cubesOffset) * ChunkCube.YSIZE;
    public static final int minPossibleY = -cubesOffset * ChunkCube.YSIZE;
}