Skip to main content
The Weather surface provides methods for reading and setting the current weather in a world, along with assertions to verify weather state. Use WeatherTestAdapter to control weather and WeatherAssert to check it. Weather testing is important when your mod has weather-dependent logic - damage modifiers during storms, visibility changes in fog, or mob spawning rules that differ by weather type. Automated tests verify these weather-dependent behaviors without waiting for natural weather cycles.

Complete Example Suite

Adapter Methods

Assertion Methods

Key Details

  • Weather changes may take one tick to propagate - always call ctx.waitTicks(1) after setWeather before asserting.
  • Use IsolationStrategy.DEDICATED_WORLD to avoid changing weather on the live server during tests.
  • Weather type strings are server-defined. Common values include "clear", "rain", and "snow".

Next Steps