Add Chunk Batch support#3263
Conversation
| chunkBatchStartTime = Date.now() | ||
| }) | ||
|
|
||
| bot._client.on('chunk_batch_finished', (packet) => { |
There was a problem hiding this comment.
can you add a comment explaining what is the purpose of this system ?
There was a problem hiding this comment.
Added a comment and comments each part of the calculation now that I am doing it correctly.
| 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.
A constant the client uses in that calculation.
There was a problem hiding this comment.
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.
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
| }) | ||
|
|
||
| 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.
Should start variable named with lower case
There was a problem hiding this comment.
I will fix that when I get home, surprised the linter didnt carch that.
There was a problem hiding this comment.
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.