mojira.dev
MC-108869

inconsistencies in the weather cycle

When using the various /weather commands, the effects on the weather cycle differ depending on which command is used. This is very difficult to observe directly in a given world, but is easier to see in the level.dat file.

Steps to reproduce:

1. Create a new world
2. Upon leaving the world, note the NBT data for the rain and thunder time. This is the default for starting a new world, and what one might expect when the weather cycle resets.
3. Reenter the world and use /weather clear (with no duration argument)
4. Note that the clear weather duration in this case is much less than the default, and that the rain and thunder times are fixed at 1.
5. Reenter the world and use /weather rain 1
6. Note that the rain time seems to be reset normally but the thunder time is less than normal.
7. Reenter the world and use /weather thunder 1
8. Note that the rain and thunder times are even longer than when first opening the world (likely the default)

Attachment notes:

First screenshot: New world
Second Screenshot: /weather clear
Third Screenshot: /weather rain 1
Fourth Screenshot: /weather thunder 1

Attachments

Comments 6

This is how the weather cycle works.

When rainTime reaches 0 while raining is 1 (that is, it is switching to a period of no rain), then rainTime is set to a random value between 12,000 and 180,000, and raining is set to 0. Once rainTime reaches 0 while raining is 0 (that is, it is switching to rainy weather), then rainTime is set to a random value between 12,000 and 24,000, and raining is set to 1.

Thunderstorms run on a separate timer, and the in-game weather will only be stormy if both raining and thundering are 1 at the same time. If thunderTime reaches 0 while thundering is 0 (i.e. becoming stormy weather), then thunderTime is set to a random value between 3,600 and 15,600 and thundering is set to 1. When thunderTime reaches 0 while thundering is 1 (i.e. becoming non-stormy weather), then thunderTime is set to a random value between 12,000 and 180,000.


The clearWeatherTime is specifically used by the /weather clear command and is not part of the natural weather cycle (where rainTime and thunderTime are locked at 1 so long as clearWeatherTime is 1+).

Using /weather rain 1 sets rainTime, thunderTime, and raining to 1, while setting thundering to 0. This means that after 1 tick, the values are randomized according to the raining and thundering state.

Using /weather thunder 1 sets rainTime, thunderTime, raining, and thundering to 1, so after a tick they will also randomize accordingly.

These commands are simply setting the initial values; how the values interact with the weather cycle is how it is always done under natural conditions.

This is still a problematic setup. Since weather events are mutually exclusive, it doesn't make sense to have separate timers for each weather event. This in particular causes a problem here:

If thunderTime reaches 0 while thundering is 0 (i.e. becoming stormy weather), then thunderTime is set to a random value between 3,600 and 15,600

Because thunderTime and rainTime are synchronous during rainy weather, this can happen even during the transition from rainy to clear weather, which should not happen. This explains why setting /weather rain 1 causes a thunderstorm to happen much faster than normal.

The separation of timers is necessary. Thunder and rain cannot use a single timer; how would it know when stop thundering and keep raining, or when to start thundering while it's raining? It cannot be done at a random point during the countdown, since then /weather essentially becomes useless (as you could no longer explicitly enforce rain, or specify a duration for thunder).

rainTime and thunderTime have to be synced when using /weather rain #, as otherwise it could start thundering during the duration you had explicitly told it to rain (or with /weather thunder #, would stop thundering if rainTime were not synced and depleted early).

Using /weather rain 1 and waiting the 1 second causes rainTime to be between 12,000 and 180,000 ticks (and raining set to 0) and thunderTime to be between 3,600 and 15,600 ticks (and thundering is set to 1). Since raining is 0, the weather is currently clear and there will not immediately be a thunderstorm. There is an extremely small window that a thunderstorm can occur after that clear cycle, being only if the random value for rainTime was chosen between 12,000 and 15,600 ticks (which is much less likely to occur compared to the remaining 15,601 to 180,000 ticks). This sort of thing can happen even without using the /weather command.

Thunder and rain cannot use a single timer; how would it know when stop thundering and keep raining, or when to start thundering while it's raining?

This isn't a problem, as there is still knowledge of the current weather event. A unified weather timer would merely count down the ticks until the weather changes, and then change the weather depending on which weather event was currently occurring (for example, if the timer depleted to 0 and the event was rain, it would have a small chance to change to thunder, otherwise it would change to clear).

I will say that that is a good idea (and honestly, I think it would be better than the current implementation), but changing the design of how weather is stored would be more of a feature request than a bug report, so would go on r/MinecraftSuggestions. That may clash with the current design of /weather (where depletion of rain/thunder means it will always become clear weather), though it's not like it couldn't have an extra flag to always become clear after.

But as it stands with the current implementation, what can randomly happen with /weather can randomly happen without using it.

I suppose, although r/MinecraftSuggestions isn't as good for technical suggestions. As well, the inconsistency is probably not an intended consequence of the weather cycle design.

That may clash with the current design of /weather (where depletion of rain/thunder means it will always become clear weather)

That would be a problem. Thunderstorms could start immediately from clear weather, like what happens when typing /weather clear 1. You could also have a tag called weatherChances defining that.

I probably also need a better understanding of how the current weather cycle works.

Ely G

(Unassigned)

Unconfirmed

Minecraft 1.10.2

Retrieved