Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot detects Blocks at Y=-1 as air until the bot's Y is less than 0. #3332

Open
1 task done
ZombieStriker opened this issue Mar 19, 2024 · 0 comments
Open
1 task done
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@ZombieStriker
Copy link

ZombieStriker commented Mar 19, 2024

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.20.0
  • server: paper 1.20.4
  • node: 19.5.0

Detailed description of a problem

I'm creating a mining bot for 1.20.4. The bot can mine straight down to Y=0, before detecting that the deepslate block at Y=-1 is air. When it attempts to mine the block at y=-1, the bot gets kicked for invalid movement.

What did you try yet?

I tried mining the block for the bot. Once the bot is at y=-1, the bot detects the blocks type correctly and does not get kicked.

Your current code

I have a lot of other code that I'm using for my project, but the main bit of code for mining is as follows:

async function startloop(subroutineid){
    let statemachine = subroutines[subroutineid]
    if(statemachine!=undefined){
    let delay = 0;
    while(delay==0||delay==undefined){
        delay = await scriptloop(statemachine);
        if(delay==-1){
            statemachine["running"] = false;
            return;
        }
    }
    if(getStateMachinePath(statemachine,".moveupdate")===true){
        bot.pathfinder.setGoal(new pathfinder.goals.GoalNear(getStateMachinePath(statemachine,".x"),getStateMachinePath(statemachine,".y"),getStateMachinePath(statemachine,".z"),0.1))
        setStateMachinePath(statemachine,".moveupdate",false);
    }
    if(getStateMachinePath(statemachine,".digging")!=null && getStateMachinePath(statemachine,".digging")){
        await bot.dig(getStateMachinePath(statemachine,".digging"),true)
        setStateMachinePath(statemachine,".digging",null)
        }
    scriptlooptask = setTimeout(() => {
        startloop(subroutineid);
    }, delay);
    }
}

getStateMachinePath is how I access variables using a programming language I created, so that it becomes more modular. However, all that is important is "await bot.dig(.....,true)", which crashes the bot when at Y=0, and digging y=-1.

Expected behavior

Bot should be able to mine blocks at Y=-1 from y=0, and detect the correct block type of the block.

Additional context

@ZombieStriker ZombieStriker added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

1 participant