Merge pull request #7 from milutinke/1.20.2

Fixed division with a 0 error
This commit is contained in:
Anon 2023-11-25 14:04:04 +01:00 committed by GitHub
commit eb7bfff8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -959,9 +959,10 @@ namespace MinecraftClient.Protocol.Handlers
break;
case PacketTypesIn.ChunkBatchFinished:
dataTypes.ReadNextVarInt(packetData); // Number of chunks received
var time = (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastCHunkBatchStartedAt);
SendChunkBatchReceived(
// ReSharper disable once PossibleLossOfFraction
25 / (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastCHunkBatchStartedAt)
25 / time == 0 ? 5 : time
);
break;
case PacketTypesIn.ChunkBatchStarted: