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

activateBlock doesn't do anything #3428

Open
1 task done
ozaner opened this issue Jul 30, 2024 · 0 comments
Open
1 task done

activateBlock doesn't do anything #3428

ozaner opened this issue Jul 30, 2024 · 0 comments
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

@ozaner
Copy link

ozaner commented Jul 30, 2024

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

Versions

  • mineflayer: 4.20.1
  • server: vanilla 1.20.4
  • node: 22.5.1

Detailed description of a problem

I am making a bot that can MLG with a water bucket. It does so just fine, but the problem is picking up the water it left behind. Right now I'm just having it lookAt the water source, then calling activateItem while holding the bucket. This works 90% of the time, but 10% of the time the water_flowing blocks wash it away before it can pick up the water because, for some reason, the bot looks in the direction of its motion (i.e. away from the source block).

What did you try yet?

To solve this, I wanted to use the activateBlock method while holding the bucket. I thought this would be more precise than my previous approach. Problem is, the method doesn't seem to do anything. I've tested it with water sources (while holding a bucket), fence gates, levers. In all cases, the bot seems to just turn towards the block in question and wave its arm as if it "activated" it, but nothing happens.

I suppose this is an XY problem since my real problem is reliably picking up water source blocks (X), but solving the activateBlock problem (Y) would work too.

Your current code

Here is the code I used to test this:

  bot.on('chat', async (_, message) => {
    let block = bot.findBlock({
      matching: (block) => block.name === message,
      maxDistance: 3,
    });
    await bot.activateBlock(block).catch((e) => console.log(e));
  });

It just searches for the closest block types in chat and activates it. For water, you would just type 'water' in chat.

Expected behavior

The activateBlock method should do... something?

Additional Context

There is another issue from 2020, #1262, which deals with a similar issue, but it seems to fix it by "adding a delay" I'm not sure where. It also references a callback parameter in the activateBlock function which seems to longer exist.

@ozaner ozaner 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 Jul 30, 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