-
-
Notifications
You must be signed in to change notification settings - Fork 978
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
Add Chunk Batch support #3263
Add Chunk Batch support #3263
Conversation
chunkBatchStartTime = Date.now() | ||
}) | ||
|
||
bot._client.on('chunk_batch_finished', (packet) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment explaining what is the purpose of this system ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment and comments each part of the calculation now that I am doing it correctly.
lib/plugins/blocks.js
Outdated
bot._client.on('chunk_batch_finished', (packet) => { | ||
const chunkPerMill = packet.batchSize / (Date.now() - chunkBatchStartTime) // Get chunks per millisecond | ||
bot._client.write('chunk_batch_received', { | ||
chunksPerTick: 25 / chunkPerMill |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is 25 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A constant the client uses in that calculation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ what is the source of this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, now I feel dumb and have learned to always double check wiki.vg's info since there is a good chance it could be wrong or slightly incorrect.
Normal client uses this insanity to get its chunksPerTick.
While the input to the onBatchFinished is the batchsize. No sure where someone got the 25 from and put it on wiki.vg going to probably correct that information later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to used the same calculation as 1.20.2 Vanilla client uses. (Although converted to millisecond instead of the nanoseconds they use.)
…Milliseconds vs Nanoseconds
lib/plugins/blocks.js
Outdated
}) | ||
|
||
bot._client.on('chunk_batch_finished', (packet) => { | ||
const MilliPerChunk = (Date.now() - chunkBatchStartTime) / packet.batchSize // Gets millisecond per chunk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should start variable named with lower case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix that when I get home, surprised the linter didnt carch that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both now start with lower case
* Implement configuration.registry_data packet handling * Fix player entities in >= 1.20.2 * add 1.20.2 in tested versions * Add Chunk Batch support (#3263) * Add Chunk Batch support * Fix linting errors. * I really hate the linter right now. * Comment what chunkbatches are for. * Update chunk batch calculation to use Vanilla's calc but updated for Milliseconds vs Nanoseconds * Fix usage of variables starting with capital letters * Update package.json dump mcdata * server on `login` -> `playerJoin` * try CI on node20 * node20 on mc test * revert CI to node18 * update entity handling * fix typo * update internal tests * update internalTest to use feature * Update README.md * update pathfinder dep in example and add npmrc in examples --------- Co-authored-by: Crux <crux153@gmail.com> Co-authored-by: William Gaylord <chibill110@gmail.com> Co-authored-by: extremeheat <extreme@protonmail.ch>
Adds support for 1.20.2 chunk batches.