- Java 100%
| src | ||
| .gitignore | ||
| build.gradle | ||
| gradle.properties | ||
| LICENSE | ||
| README.md | ||
| settings.gradle | ||
PMWeather Optimizations
A server-side performance add-on for ProtoManly's Weather 0.16.4 on NeoForge 1.21.1.
PMWeather Optimizations reduces several expensive weather, precipitation, wind, chunk, and networking operations while keeping all live Minecraft world access on the server thread.
The mod is installed only on the server. ProtoManly's Weather is still required.
Main Optimizations
Surface and Wildfire Processing
PMWeather's original surface processing scans every vertical section of each ticking chunk.
This add-on replaces that pass with a four-phase surface sampler that uses the heightmap from the chunk already being ticked. Selected chunks receive additional samples every fourth tick to preserve roughly the same overall sampling rate.
The sampler covers WORLD_SURFACE through 15 blocks below it. Normal Minecraft random ticks still handle PMWeather fire and burning blocks.
Modified Precipitation Budget
Modified precipitation work is limited by a configurable per-level budget.
The default is:
precipitationAttemptsPerLevelTick = 256
Accepted attempts rotate between chunks so the same areas are not always prioritized. Work above the limit is skipped instead of being placed into a growing queue.
Lower values provide more server headroom at the cost of less frequent optional precipitation processing.
Precipitation Calculation Reuse
Repeated values are reused within the same precipitation column, including:
- Height and chunk lookups
- Biome and seasonal data
- Fire and time values
- Noise samples
- Atmospheric calculations
The precipitation-only atmospheric path also stops once PMWeather's final temperature value has been calculated. Pressure, dewpoint, and virtual-temperature calculations are skipped when they are not used.
Radar and general atmospheric queries are not changed by this shortcut.
Rain Query Cache
Identical isRainingAt checks can reuse their result during the same server tick.
The cache is cleared every tick and has a fixed maximum size. Cache statistics are shown through:
/pmw-optimizations status
Chunk-Loading Protection
Climate and wind calculations use already-loaded chunk data wherever possible.
Unloaded non-radar cardinal climate samples fall back to the loaded center biome instead of loading or generating a neighboring chunk. Exact radar queries continue using PMWeather's normal biome sampling.
Fire-intensity lookups also return zero for unloaded chunks rather than forcing them to load.
Wind Processing
Several smaller wind optimizations are included:
- Cyclone wind calculations are skipped outside the cyclone's maximum reach.
- Environmental damage reuses the surface height PMWeather already calculated.
- Fire-intensity values use a bounded, per-level primitive cache.
- Windmeter graph refreshes are staggered and limited per level tick.
- Duplicate same-level EAS refreshes are combined within the current tick.
- Storm type identifiers are created once and reused.
The previously tested final-result wind cache was removed after profiling showed only a 1.18% hit rate.
Moisture and Fire Networking
Chunk moisture and fire updates are sent only to players already tracking the affected chunk.
PMWeather originally searched nearby players each time this data changed. Using the chunk-tracking list avoids repeating that proximity scan.
Server-Thread Safety
All chunk, block, entity, storm, networking, and saved-data access remains on Minecraft's server thread.
The add-on does not asynchronously tick entities or access live world objects from worker threads.
Tornadoes, cyclones, and fire whirls retain PMWeather's normal terrain-damage rates and limits.
Runtime Commands
Optimizations are enabled after each server restart.
Permission-level-2 operators can control the add-on without restarting the server:
/pmw-optimizations on
/pmw-optimizations off
/pmw-optimizations status
Turning the master switch off restores PMWeather's original code paths for controlled A/B performance testing.
The runtime state is not saved between restarts.
Experimental Thermodynamic Optimization
Thermodynamic caching is included for testing but is disabled by default.
/pmw-optimizations thermodynamic on
/pmw-optimizations thermodynamic off
/pmw-optimizations thermodynamic status
This feature reuses atmospheric results inside small same-tick spatial cells.
Thermodynamic optimization is currently experimental and has shown a TPS regression during testing. It is not recommended for normal servers and should remain disabled unless you are specifically profiling it.
Radar requests and calculations with an explicit ground height bypass the thermodynamic cache.
Experimental Multithreading
Experimental multithreading is also disabled by default.
/pmw-optimizations multithread on
/pmw-optimizations multithread off
/pmw-optimizations multithread status
Multithreading only applies to PMWeather's pure thermodynamic mathematics. The server thread first captures an immutable numeric snapshot, which can then be processed by one or two daemon workers.
Workers never access live:
- Chunks
- Blocks
- Entities
- Storms
- Networking
- Saved data
The server thread never waits for a worker result. Missing, stale, failed, or dropped work immediately falls back to PMWeather's normal synchronous calculation.
Only results from the current or previous server tick are accepted.
Because multithreading depends on the experimental thermodynamic system, it is also not recommended for normal server use at this time.
The operating system decides which physical CPU cores run the worker threads.
Requirements
- Minecraft 1.21.1
- NeoForge 21.1.228 or newer in the 21.1 release line
- ProtoManly's Weather 0.16.4 exactly
- Java 21
Install the built add-on jar only on the server.
Do not remove ProtoManly's Weather.
Configuration
The server creates:
pmweather-optimizations-server.toml
Default settings:
surfacePhasesEnabled = true
surfaceSamplesPerChunk = 2
centerBiomeFallbackEnabled = true
precipitationBudgetEnabled = true
precipitationAttemptsPerLevelTick = 256
precipitationSampleReuseEnabled = true
precipitationTemperaturePathEnabled = true
rainQueryCacheEnabled = true
damageWindHeightReuseEnabled = true
windLoggerRefreshesPerLevelTick = 4
fireIntensityCacheEnabled = true
fireIntensityCacheMaximumSize = 4096
trackedMoistureSyncEnabled = true
atmosphereCacheCellSize = 8
thermodynamicOptimizationEnabled = false
experimentalMultithreadingEnabled = false
experimentalWorkerThreads = 1
experimentalWorkerThreads supports values from 1 to 2.
NeoForge preserves values already stored in the TOML. Updating the mod will not overwrite an operator-selected value.
Some earlier test builds generated:
precipitationAttemptsPerLevelTick = 128
Change that value to 256, or delete the configuration file once to regenerate the current defaults.
Wind Logger Behavior
Bound Wind Loggers normally sample wind and update graph history every 10 ticks when refresh capacity is available.
The default refresh budget is:
windLoggerRefreshesPerLevelTick = 4
With 40 bound loggers, this provides approximately one refresh per logger every 10 ticks.
During overload, samples are delayed instead of stalling the server. Short gusts may therefore be missed by WindMax.
Increasing the refresh budget provides fresher logger data but uses more server time.
Building
Place the following PMWeather jar in the project root:
pmweather-0.16.4-1.21.1-alpha.jar
Run Gradle using Java 21:
$env:JAVA_HOME = 'C:\Program Files\Eclipse Adoptium\jdk-21.0.9.10-hotspot'
gradle build --no-configuration-cache
The compiled add-on jar will be written to:
build/libs/
PMWeather is used as a development and runtime dependency. It is not included inside the add-on jar.
Performance Testing
For meaningful comparisons, capture Spark profiles with the same:
- World
- Player count
- Simulation distance
- Weather conditions
- Storm activity
- Test duration
Profiles of around 120 seconds are recommended.
Compare the master optimization switch both off and on, and record:
- Mean and p95 MSPT
- TPS
- Modified precipitation time
- Surface processing
- Level updates
- Entity wind
- Storm ticking
- Multithreading telemetry
Also verify normal behavior for rain and snow boundaries, wildfire spread, seasonal changes, radar, forecasts, tornadoes, cyclones, and fire whirls.
Experimental thermodynamic caching and multithreading should be tested separately from the default optimization set.