-
-
Notifications
You must be signed in to change notification settings - Fork 4
Temperature Calculations
Temperature calculations are complex and require a deep understanding of how the human body maintains temperature. The following is an overview of the basic concepts.
Current environment temperature (Where player is located) has many factors, not just raw biome temperature. When calculating environment information, several pieces of information are gathered to determine environment temperature.
- Check if player is underground or sheltered
- Underground
- Checks if player has at least three blocks above them for the surrounding 12 blocks in each direction.
- Only valid if in Overworld biome -- TODO: Add dimentions to a registry that check underground. This is hardcoded now to not be calculated in Nether and The End
- Sheltered
- Checks block above and the surrounding two blocks in each direction.
- If player is underground or sheltered, consider the area around the player an "underground" biome and add it in for smoothing
- Underground
- Biome Temperature Calculated
- If player is underground, only set biome temperature to current underground biome (no smoothing)
- Smooth biome data from surrounding biomes
- Gather biome average temperature in the surrounding 3 chunk range. (Biome Smoothing)
- Uses height adjusted temperature. (Colder above level 80)
- Apply season adjusted temperature if using a seasons mod
- Gather average humidity in the surrounding 3 chunk range. (Biome Smoothing)
- Only enabled if RULE_WEATHER_CYCLE is true.
- Humidity is affected by how close the next/last rain is/was, or if it is actively raining.
- Gather biome average temperature in the surrounding 3 chunk range. (Biome Smoothing)
- Calculate Radiation
- Block Radiation
- Checks all blocks in the surrounding 12 block radius for radiation.
- Reduces radiation if source is obscured by blocks.
- Values are reduced based on distance.
- Heat rises, so heat sources above player are only calculated for three blocks above.
- Radiation is reduced based on the amount of liquid a player is currently immersed in.
- Sun Radiation
- Calculated by sun angle in sky and current player position
- Block Radiation
- Calculate temperature surrounding player
- If player not submerged (not under water)
- If player is sheltered or underground
- Calculation is (Heat Index * 0.7) + (Black Globe Temperature * 0.3)
- Normal air temperature conditions
- Calculation is (Heat Index * 0.7) + (Black Globe Temperature * 0.3) + (Dry Temperature * 0.1)
- If player is sheltered or underground
- If player is submerged or partially submerged in water
- If submerged uses Water Temperature
- If partially submerged uses (Water Temperature * 0.7) + ({Normal Air Temperature} * 0.3)
- If player not submerged (not under water)
Heat Index is a complex calculation that combines air temperature and relative humidity to produce a "Feels Like" temperature. This was done extracting the calculation from the Heat Index Calculator provided by the National Weather Service.
Since there isn't real weather in Minecraft (stuff like wind) we use a simulated model for estimating the Black Globe temperature. This is based on the excellent research published in https://rmets.onlinelibrary.wiley.com/doi/full/10.1002/met.1631
The math is (0.01498 * radiation) + (1.184 * Dry Temperature Celcius) - (0.0789 * ({Relative Humidity} / 100)) - 2.739;
Dry temperature is the average of all smoothed biome temperatures multiplied by a day / night offset. Day/night offset is part of the biome category data, and sets the temperature differences between day and night in different biome types. Day/night offsets are important to simulate radiation loss from sun exposure during the day.
Base water temperature is set to 55°F or 13°C.
- If Dry Temperature is at or above Parity (75°F or 24°C) a water temperature increase is applied
- Increase calculation is 0.1 + ((1 - {Water Volume} * 0.35)
- Water temperature is {base water temperature} + (({Dry Temperature} - {Parity}) * {increase}
- If Dry Temperature is below Parity
- Water temperature is the minimum of ({Parity} - {Dry Temperature}) * 0.5 OR 28.5°F/-2°C
Body temperature mechanic is an attempt to emulate Homeostasis.
Body temperature has three core parts:
- Wetness
- Skin Temperature
- Core Temperature
As environment variables change, core temperature (Shown in HUD) is updated.
TODO: Add math and change characteristics for calculating body temperature