function createInitialInventory(blueprint, agents, evenlySplit = true) {
    const inventories = {};
    const materialCounts = {};
    let currentAgent = 0;

    // Initialize inventories
    for (let i = 0; i < agents; i++) {
        inventories[i] = {'diamond_pickaxe': 1};
    }

    // Count materials in blueprint and replace ladder variants with "ladder"
    for (const level of blueprint.levels) {
        for (let rowIndex = 0; rowIndex < level.placement.length; rowIndex++) {
            for (let blockIndex = 0; blockIndex < level.placement[rowIndex].length; blockIndex++) {
                let block = level.placement[rowIndex][blockIndex];

                if (block !== 'air') {
                    // Check if material contains 'door' or 'ladder' and convert appropriately
                    let materialKey = block;
                    if (block.includes('dark_oak_door')) {
                        materialKey = 'dark_oak_door';
                    } else if (block.includes('oak_door')) {
                        materialKey = 'oak_door';
                    } else if (block.includes('ladder')) {
                        materialKey = 'ladder';
                        level.placement[rowIndex][blockIndex] = 'ladder'; // Replace in blueprint
                    }

                    materialCounts[materialKey] = (materialCounts[materialKey] || 0) + 1;
                }
            }
        }
    }

    if (evenlySplit) {
        // Distribute materials evenly among agents
        for (const [material, count] of Object.entries(materialCounts)) {
            const baseAmount = Math.floor(count / agents);
            const remainder = count % agents;

            // Give each agent the base amount
            for (let i = 0; i < agents; i++) {
                inventories[i][material] = baseAmount;
            }

            // Distribute remainder one by one to agents
            for (let i = 0; i < remainder; i++) {
                inventories[i][material]++;
            }
        }
    } else {
        // Original distribution - one material type to one agent
        for (const [material, count] of Object.entries(materialCounts)) {
            inventories[currentAgent][material] = count;
            currentAgent = (currentAgent + 1) % agents;
        }
    }

    for (let i = 0; i < agents; i++) {
        inventories[i]['dirt'] = 128;
    }

    return inventories;
}
Helper function to initalize agent inventories
@param blueprint
@param agents
@param evenlySplit - When true, splits materials evenly across inventories
@returns {{}}