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 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
thunderTimereaches 0 whilethunderingis 0 (i.e. becoming stormy weather), thenthunderTimeis 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.
This is how the weather cycle works.
When
rainTimereaches 0 whilerainingis 1 (that is, it is switching to a period of no rain), thenrainTimeis set to a random value between 12,000 and 180,000, andrainingis set to 0. OncerainTimereaches 0 whilerainingis 0 (that is, it is switching to rainy weather), thenrainTimeis set to a random value between 12,000 and 24,000, andrainingis set to 1.Thunderstorms run on a separate timer, and the in-game weather will only be stormy if both
rainingandthunderingare 1 at the same time. IfthunderTimereaches 0 whilethunderingis 0 (i.e. becoming stormy weather), thenthunderTimeis set to a random value between 3,600 and 15,600 andthunderingis set to 1. WhenthunderTimereaches 0 whilethunderingis 1 (i.e. becoming non-stormy weather), thenthunderTimeis set to a random value between 12,000 and 180,000.The
clearWeatherTimeis specifically used by the/weather clearcommand and is not part of the natural weather cycle (whererainTimeandthunderTimeare locked at 1 so long asclearWeatherTimeis 1+).Using
/weather rain 1setsrainTime,thunderTime, andrainingto 1, while settingthunderingto 0. This means that after 1 tick, the values are randomized according to therainingandthunderingstate.Using
/weather thunder 1setsrainTime,thunderTime,raining, andthunderingto 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.