Temperature - MCreator-Examples/Tale-of-Biomes GitHub Wiki

[!IMPORTANT] The temperature system still needs balancing as temperatures are not reliable.
This will take time to work on and needs to be done before rice crops can be continued.

OVERVIEW

As of 0.10.0-Indev, the temperature system has been redesigned completely. Two layers make up the temperature, mainly because some things need to be in a local layer of the game. I will do my best to explain the system below.

MOD SUPPORT

GLOBAL TEMPERATURE

The global layer controls four modifiers of the temperature system:

  • Season
  • Time
  • Weather
  • Wind

SEASON

The season modifier is based on the four seasons (Winter, Spring, Summer and Autumn). Each season has a set temperature value which controls the base temperature value for the rest of the modifiers. The temperature takes the base temperature and then changes the range randomly by adding a value between the dynamic min and max ranges. Also, the dynamic min and max ranges are integers. The dynamic range will update every hour (1000 ticks) in-game.

Season Temperature
Winter -5
Spring 10
Summer 20
Autumn 10

TIME

Time is the second modifier for the temperature, this is added to the temperature for seasons with the other two modifiers. The time-temperature changes the temperature based on 8 time periods in the game time. Time updates every tick and has specific conditions to keep it on track so it does not get out of sync with the game time. So that you know, the times below are based on game tick time. When temperature increases or decreases it does so based on the time between the start and end ticks.

Start Tick IRL Time End Tick IRL Time Target Temperature Direction Notes
18000 12 AM 20999 3 AM -10 Static Temperature does not change.
21000 3 AM 22999 5 AM -5 Add Will increase each tick by 0.0125
23000 & 0 5 AM & 6 AM 23999 & 1999 6 AM & 8 AM 0 Add Will increase each tick by 0.00834
2000 8 AM 5999 12 PM 5 Add Will increase each tick by 0.00625
6000 12 PM 11999 6 PM 5 Static Temperature does not change.
12000 6 PM 13999 8 PM 0 Subract Will decrease each tick by 0.0125
14000 8 PM 15999 10 PM -5 Subract Will decrease each tick by 0.0125
16000 10 PM 17999 12 AM -10 Subract Will decrease each tick by 0.0125

WIND

The wind modifier is the third part that makes up the world temperature. The wind can change every hour in-game. The temperature is based on wind speed which has a cooling effect on the temperature. Wind speed can change a total of -2 to +2 from the current speed from the last hour. By default, the starting speed is located at 25 km/h. The maximum wind speed can reach 50 km/h. The lowest wind speed can be as low as 0 km/h. If the temperature exceeds the min or max values it will set the temperature to the nearest correct value. Lastly, the speed is converted using the following math.

worldWindTemperature = (0 - ((worldWindSpeed / worldMaxWindSpeed) * 5))
Min Temperature Max Temperature
0 -5

WEATHER

The final global modifier is based on weather. This has three conditions which is a static temperature drop which has a cooling effect on the environment. Now in some cases, the weather can be thundering but not producing rain this is normally found in warm climates like deserts. Snow can also happen at higher altitudes or in cold biomes. Sadly there is no direct way to test for snow but I have added a workaround which can be found under the LOCAL section. For the base temperature though for the world, it only takes into account thunder, rain or clear weather.

Thundering Raining Temperature
true true -2
true false -2
false true -1
false false 0

FINAL WORLD TEMPERATURE

So once this is all calculated the final math is run to calculate the world temperature. It also saves the temperature to both Celcius and Fahrenheit formats.

Local:temperature = (((worldSeasonTemperature + worldWindTemperature) + worldTimeTemperature) + worldWeatherTemperature)
worldTemperatureC = local:temperature
worldTemperatureF = ((local:temperature * 1.8) + 32)

LOCAL TEMPERATURE

Local temperature happens locally in the world. In some cases like biomes, it was not possible to pass over to world variables because it's not a server-side feature. Other factors are things that are affected locally like the height of the player. To allow support for players, entities and blocks I needed to combine a new local system with the worldTemperatureC variable saved in the prior section.

The local temperature system is based on two modifiers.

  • Biome
  • Height

BIOME

Biomes are grouped under five tags which control the local biome temperature for the blocks, entities and players. Each local type is saved a bit differently. I won't go into too much detail but I will cover the basics. The values are the same for all forms of local biome temperature the only difference is the way it's stored. You can find a full list of all the biomes with temperatures in the base game and Tale of Biomes on this page.

  • For entities NeoForge NBT is saved to the entity.
  • For blocks, NeoForge NBT is saved to the block.
  • For players player lifetime variables are saved to the client.

BIOME BLOCKS

Blocks are assigned a single NBT variable called tobBiomeTemperature. Blocks test for the biome at the current block location using the assigned biome tags.

It will be possible to run the /toba command to apply the data to your custom block tile entities.

BIOME ENTITIES

Entities are assigned a single NBT variable called tobBiomeTemperature. Entities test for the biome at the current entities using additional commands.

It will be possible to run the /toba command to apply the data to your custom block tile entities.

BIOME PLAYERS

Players are assigned a global lifetime variable playerBiomeTemperature which is used later on when combining the final temperature.

BIOME TEMPERATURE VALUES.

Biome temperature relates to the 5 tags which are listed below with the assigned temperature values.

Temperature Biome Tag
15 tale_of_biomes:temperature/hot
10 tale_of_biomes:temperature/toasty
5 tale_of_biomes:temperature/warm
0 tale_of_biomes:temperature/chilly
-5 tale_of_biomes:temperature/cold

HEIGHT

TEMPERATURE

Height temperature changes 1 value every 10 blocks and is based on three parts.

  • Above sea level
  • Between Y=62 and Y=2
  • And below Y=1
Part Change Notes
Above Y=63 -1 per 30 blocks Temperature colder the higher the player is
Between Y=62 and Y=2 -1 per 30 blocks Temperature gets colder the deeper you go down.
Below Y=1 +1 per 30 blocks The temperature gets hotter the deeper you go down.

As of 0.10.0-Indev height temperature is also capped between ranges before the snow script is run.

Minimum Cap Maximum Cap
10 -10

SNOWING WEATHER

As mentioned above I added a script to take care of biomes that snow at specific layers in the world when it rains. The base game is already broken up into five groups for biome temperature for the core game. So I just needed to apply my tags to every biome to add full support for vanilla biomes. The temperature is applied to the height value directly which is then combined with the world value. The total difference with the temperature is only -3C which is not much but enough to keep to the pattern of the weather temperature. Below is a quick chart based on this wiki page for snowfall.

Min Y Level Condition Temperature Biome Tag
320 Raining -1 tale_of_biomes:temperature/hot
193 Raining -1 tale_of_biomes:temperature/toasty
153 Raining -1 tale_of_biomes:temperature/warm
113 Raining -1 tale_of_biomes:temperature/chilly
-64 Raining -1 tale_of_biomes:temperature/cold

If the biome is not in any of the tags listed above biomes are then categorized under Minecraft's biome temperature.

Min Y Level Condition ToB Temperature Min Temperature Max Temperature
320 Raining -1 > 1.6 ≤ 2.0
193 Raining -1 > 0.8 ≤ 1.6
153 Raining -1 ≥ -0.8 ≤ 0.8
113 Raining -1 ≥ -1.6 < -0.8
-64 Raining -1 ≥ -2 < -1.6

MOD SUPPORT

Mod support is made easy! Three types of things are supported. Blocks, Entities and Players.

BLOCKS

To give a block the NeoForge NBT block tags. You can run the following command using block tick update.

Minecraft Command:

toba run temperature block

This will then assign four block NBT math variables to the block.
Your mod can then test for both Celcius and Fahrenheit.

[!IMPORTANT] Please note that these variables are on the server side only.

  • tobBiomeTemperature
  • tobHeightTemperature
  • tobTemperatureC
  • tobTemperatureF

ENTITIES

To give an entity the NeoForge NBT block tags. You can run the following command using entity tick update.

Minecraft Command:

toba run temperature mob

This will then assign four entity NBT math variables to the entity.
Your mod can then test for both Celcius and Fahrenheit.

[!IMPORTANT] Please note that these variables are on the server side only.

  • tobBiomeTemperature
  • tobHeightTemperature
  • tobTemperatureC
  • tobTemperatureF

PLAYERS

Players are assigned two entity NBT math variables.
Your mod can then test for both Celcius and Fahrenheit.

[!IMPORTANT] Depending on the trigger you are running you may be able to use these both on the server and client side.

  • tobTemperatureC
  • tobTemperatureF