Fixes fireworkRocketDuration
calculation
#3222
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
fireworkRocketDuration
is set to wrong values that cause elytra to fly shorter (#3221). The correct formula is: 10 × (number of gunpowder + 1) + random value from 0 to 5 + random value from 0 to 6The above figure illustrates the difference: the plank post on the left stands for mineflayer's fly height, the log post on the right stands for notchian client fly height (both are done with 1 rocket with flight of 1).
The problem is about the following part:
mineflayer/lib/plugins/entities.js
Lines 384 to 399 in 08208e2
There are two bug in this code:
byte
instead ofint
(at least for 1.20.1)Changes
In this pull request:
handleBotUsedFireworkRocket
to fixfireworkRocketDuration
calculation.knownFireworks
a Set, this in more efficient than using Array.usedFirework
in the API document (usedfirework
tousedFirework
).usedFirework
:fireworkEntityId
- the entity id of the firework.usedfirework
event. I am a native speaker of that language.Fixes #3221