File size: 814 Bytes
36ba3ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async function mineDiamondOre(bot) {
    bot.chat('Mining diamond ore started');
    const ironPickaxeCount = bot.inventory.count(mcData.itemsByName.iron_pickaxe.id);

    if (ironPickaxeCount < 1) {
        bot.chat("No iron_pickaxe. Mining diamond ore failed");
        return;
    }

    // Find a diamond ore block
    const diamondOreBlock = await exploreUntil(bot, new Vec3(0, -1, 0), 120, () => {
        const diamondOre = bot.findBlock({
            matching: mcData.blocksByName["deepslate_diamond_ore"].id,
            maxDistance: 32
        });
        return diamondOre;
    });

    if (!diamondOreBlock) {
        bot.chat("No diamond ore found.");
        return;
    }
    // Mine the diamond ore block
    await mineBlock(bot, "deepslate_diamond_ore", 1);
    bot.chat("Mined 1 diamond ore.");
}