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

Fix silent failure when digging unbreakable blocks #3561

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

BBpezsgo
Copy link
Contributor

The bot.digTime function returns Infinity if the bot cannot break the block (such as "bedrock" or "barrier"), but if you pass Infinity to setTimeout it will produce the following warning:

TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed integer.
Timeout duration was set to 1.

This will result in a silent failure and the bot.dig function will resolve.

With this change, it will throw an error in such cases.

@BBpezsgo
Copy link
Contributor Author

This will still fail if the dig time is more than 2147483647 milliseconds, but Infinite is more readable than that.

@BBpezsgo BBpezsgo changed the title Fix infinity setTimeout by throwing error Fix silent failure when digging unbreakable blocks Jan 16, 2025
@rom1504 rom1504 merged commit 6953949 into PrismarineJS:master Jan 24, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants