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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BBpezsgo
Copy link

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
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
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.

1 participant