// This helper function checks if there's enough space above a sapling for the tree to grow
export default function checkTreeGrowSpace(location, dimension) {
  // Check if there's a block directly above the sapling
  try {
    // Get block above the sapling
    const blockAbove = dimension.getBlock({ x: location.x, y: location.y + 1, z: location.z });

    // If there's a block above, return false (no space to grow)
    if (blockAbove && blockAbove.typeId !== "minecraft:air") {
      return false;
    }

    // No blocks blocking tree growth
    return true;
  } catch (e) {
    console.error("Error checking space for tree growth:", e);
    // Default to true in case of error to preserve original behavior
    return true;
  }
}
