Mojira Archive
MC-63340

Sleeping always resets time until rain

The bug

When all players are sleeping and then woken up, rain and thunder times are always reset, regardless whether or not it was raining while the players were sleeping.

As a result, if you skip every night, you are very unlikely to ever experience rain or thunder, since the rain time is usually set to a value that is longer than a day (10 minutes).

How to reproduce

  1. Reset weather
    /weather clear 0
    
  2. Pause the world (to save it) and inspect the rainTime and thunderTime values in the level.dat file using for example NBTExplorer or NBT Studio
  3. Set time to night
    /time set midnight
    
  4. Sleep and wait until you are woken up
  5. Repeat step 2
    The values were changed to a random value despite it not raining or thundering

It would be expected for the weather to be reset only if it is currently raining/thundering.

Code analysis

Based on 1.12.2 decompiled using MCP 9.40

The method net.minecraft.world.WorldServer.wakeAllPlayers() always resets thunder and rain time.

Fixed

ChocolateChip Cookies

hkniberg

2014-07-24, 04:43 AM

2021-11-03, 04:57 PM

2021-11-03, 04:57 PM

38

17

Confirmed

Important

Player

rain, sleeping, thunder

Minecraft 1.7.10 - 1.17.1 Pre-release 1Minecraft 1.7.10, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w31a, Minecraft 1.12.2, Minecraft 17w50a, Minecraft 1.13.1, Minecraft 1.14.1, 1.14.4, 19w34a, 19w35a, 1.15.2, 20w51a, 1.16.5, 1.17, 1.17.1 Pre-release 1

21w44a