mojira.dev
MC-298558

Rain fog calculation can overshoot while game is unresponsive

The bug

While the game is unresponsive, the rain fog calculation can overshoot.

Steps to reproduce

This can be a bit tricky to replicate, and replicating it can differ depending on your machine. On my machine, I can switch tabs and the game will be frozen, and then when I tab back in, the fog will be super thick to the point where the world is completely blue. Below is a video showing how to replicate it using a stop signal; alternatively, Windows users could make the game unresponsive by dragging around the title bar.

https://youtu.be/pNxYLwFA5_4

Observed behavior

The fog will accumulate while the game is unresponsive.

Expected behavior

The fog would not accumulate while the game is unresponsive.

Code analysis

AtmosphericFogEnvironment#setupFog uses deltaTracker.getGameTimeDeltaTicks()*0.2F to adjust the rainFogMultiplier. When the game is frozen, getGameTimeDeltaTicks can return high values, causing the calculation to break and the rainFogMultiplier to be set to unintended values. The factor should be clamped to be less than 1 — e.g., Math.min(1, deltaTicks*0.2F).

Comments

No comments.

Moulberry

(Unassigned)

Confirmed

(Unassigned)

1.21.6 Pre-Release 3

Retrieved