private static int GetHeight(TAG_Compound[] sections, int x, int z, int yStart = 255, int yEnd = 0, HashSet<byte> only = null, HashSet<byte> exclude = null)
{
int h = yStart;
for (; h >= yEnd; h--)
{
byte b = GetBlock(sections, x, h, z);
if (b != 0)
{
if(only != null && only.Contains(b))
return h;
else if(exclude != null && !exclude.Contains(b))
return h;
else if(only == null && exclude == null)
return h;
}
}
return yEnd - 1;
}