Dynamic Temperature in Minecraft

  • check_circle Advancements
  • check_circle Functions
  • 9
  • 8
  • 7
avatar JohnTempest
Level 21 : Expert Engineer
>>> Minecraft Forums Project Link: Click Here <<<

>>> Older Versions: Click Here <<<

Dynamic Temperature in Minecraft is a project inspired by the development of temperature mechanics for Vech's latest map Iceolation and is designed to add relatively unobtrusive content to the game. The way the system works is based on a variety of environmental factors which detects nearby blocks, the player's current biome, whether the player is swimming in water or lava, and more.

Your temperature can range between -1000 and 1000 heat units (HU) and will give the player debuffs if your temperature wanders toward the extremes (±600 HU). These debuffs include slowness, mining fatigue, blindness, hunger, weakness, and wither with the effects being mild around ±600 HU but deadly around ±900 HU.

Armor serves as insulation for the player, decreasing the effect environmental factors have on the player while equipped. Should the player need to warm up, they can stand by a fire, a torch, or a lit furnace; or if they should need to cool off, they can jump into water or curl up by some ice. When heating up or cooling down, changes to your temperature will occur every two seconds.

To start, I seriously need to thank TheRedEngineer for his work in creating a biome detection system. I cannot even begin to imagine the time and headache he saved me. If you want to check out any of his Minecraft commands you can visit his website at www.theredengineer.com or check out his YouTube Channel.

Each biome has a base temperature which serves as the largest contribution to calculating the ambient temperature of a biome. Although other factors like time of day, altitude [​upcoming], and the weather [​upcoming] can also affect the temperature of a biome, adjustments from those other environmental factors only serve to modify the base temperature of a biome. These values can be viewed in the spoiler below, and the effects of those temperature values will be explained in the Ambient Temperature description.

Biome Temperatures

Outdated Description for Version 1.0 - 1.1

As of Dynamic Temperature in Minecraft Version 2.0 air temperature has been implemented as a modifier for a biome's temperature. During the day, the air temperature of each biome is programmed to increase while the opposite is true for at night (exact values can be found in the spoiler below). Another feature of air temperature is that unlike biome temperature, the temperature of the air will not affect a player that is underwater or swimming in lava. If you would like to know how Minecraft represents time, you can either go to the Minecraft Wiki or type the command "/time query daytime" into chat to see check the current time of day in-game. Generally though, one can get by just with remembering that Time 0 is basically the start of daytime, Time 6000 is noon, Time 12000 is the start of the night, and Time 18000 is midnight.

Air Temperature Modifiers

As of Dynamic Temperature in Minecraft Version 2.0 ambient temperature has taken over the role of biome temperature as a way to integrate the new air temperature mechanic. The ambient temperature will attempt to drag the player's temperature down if it is above the ambient temperature and pull it up if the player's temperature is lower than the ambient temperature. This effect will become more drastic if the difference between the player's temperate and the ambient temperature is greater than ±200 HU. For instance, if the ambient temperature is 400 HU and the player's temperature is -200 HU, the player will have 10 HU added to their temperature; but when the player's temperature reaches 200 HU, the biome will only add 5 HU. As such, the effect of ambient temperature on the player will disappear if the ambient temperature and the player's temperature is the same.

As opposed to ambient temperature, blocks and fluids require close proximity to the player to have an effect. As a general rule, if a block is solid (e.g. magma blocks and lit furnaces), then it will only affect players immediately next to it. However, if the player can occupy the same space as the block (e.g. torches, and snow layers) then the player must occupy the space of the block. The one exception to this rule is fire. If the player is standing in fire, they will gain heat faster than if they stand adjacent to it, however, the player is not required to occupy the same space to get an effect.

Block/Fluid Temperatures

Installing a datapack is very similar to downloading a Minecraft world. The only difference is that instead of pasting the datapack into Minecraft's 'save' folder you have to place the extracted datapack into the save's 'datapack' folder. For a more detailed walkthrough, please reference the spoiler below:

Installing a Datapack

Change Temperature Based on Time of Day:
- Have ambient biome temperatures increase in the morning and decrease at night
- Increase heating effect during the day for deserts and other hot biomes (e.g. mesa and savannah)
- Increase cooling effect at night for deserts and cool biomes

Change Temperature Based on Weather:
- Increase temperature in Jungle when raining
- Decrease temperature in warm biomes slightly when raining
- Decrease temperature in hot biomes significantly when raining
- Decrease temperature in cool biomes slightly when raining
- Decrease temperature in cool biomes significantly when raining
- Decrease temperature in cold biomes drastically when snowing

Change Temperature Based on Player Y-Level:
- Decrease temperature as altitude increases from sea-level
- Increase temperature as altitude decreases from sea-level

Change Temperature Based on Player Movement:
- Increase temperature if the player is running
- Decrease temperature if the player is flying (using elytra) or falling

Changes From Suggestions:
- Comment below if you have any thoughts on what else should be added

CreditTheRedEngineer - Biome Detection
CompatibilityMinecraft 1.13

1 Update Logs

Air Temperature Update : 01/17/2019 2:53:06 pmJan 17th, 2019

Dynamic Temperature in Minecraft Version 2.0
- Added Air Temperature Mechanic
  - Air Temperature fluctuates according to the time of day
  - Air Temperature does not affect players below y-level 62 or players swimming in water or lava
- Added Ambient Temperature to merge Biome Temperature with Air Temperature

03/04/2020 4:45 amhistory
Level 1 : New Crafter
Here are some thoughts. I tried my best to be practical about what could be reasonably implemented. I'd be curious to hear feedback if at any point you think there's a disconnect between the reality of what can be coded and what I'm suggesting. I am fairly well versed on the subject, but I'm sure there are gaps in my understanding I've missed along the way.

It would be interesting if the nether portal blocks counted as heat sources similar to what you've already implemented. It would be almost as if the heat of the nether was bleeding through.

Block checking can be resource-intensive, but since lakes are a biome that can be tested for, it would be interesting if while in this biome it checks if you are standing on an ice block. If so, there is a chance that the ice block will be replaced with frosted ice. The normal mechanic of frosted ice is already to crack and disappear. Since your already planning on testing for y levels, checking if the player is at sea level is another way to reduce block checking for this. The danger of falling into the freezing water would certainly be interesting addition. In order to reduce block checking, this does mean it would not work for other types of bodies of water which can't be tested for in this way.

In real life, right before someone freezes to death, the body generates a large amount of heat; so large, that people who have frozen to death are often found buried in the snow because they were trying to cool themselves down. Heating up by an extreme amount before then experiencing even worse effects from the cold could be an interesting phenomenon to add for when the player experiences cold temperatures for extended periods of time. Not sure if the fact is to obscure to be intuitive, but interesting none the less.

The use statistic can be used to check when the player 'uses' a bucket. If the player is in the desert and this statistic increments, check the main hand to see if it is a water bucket or a bucket. If its a water bucket, there's a chance of it evaporating. You wouldn't want players to just be able to carry around a portable source of cooling down.

Lastly, in real life, cacti are able to store more water in themselves than normal plants; thus one of the reasons they survive in the desert. It would make sense if the player could partially cooldown by collecting cactus water. Obviously, this needs to be balanced. The game depletes hunger points based on when the player does things such as breaking blocks, waling, sprinting, etc. You could make it so that the only way to collect a cactus as a block is to break it with shears. Any other method of breaking it would result in a loot table randomly choosing whether to simply place the cactus block back or drop nothing and cool down the player who broke it. A difference in the utilized tool is important because you wouldn't want it to drop the block creating an infinite loop. By making it so there's a chance for the block to simply reappear, you're increasing the number of blocks breaking; thus, causing your hunger to deplete faster. Considering that hunger is already a mechanic in deserts with husks, it makes sense to follow the theme. An alternative penalty could be the chance of taking a small amount of damage upon breaking it. A better system would need to be implemented considering that repeating the same task and expecting a different result isn't intuitive for players. Some sort of visual feedback or the previously stated alternative penalty could fix said issue.

Anything else I can think of would require more testing on my part to see if it can be done efficiently performance-wise. Regardless of whether any of this is considered, I'd just like to say well done. :D
03/28/2020 2:32 pm
Level 21 : Expert Engineer
Thank you for your interest in this project! I personally love the ideas you mentioned, specifically the idea of making freezing water more of a concern to the player. Unfortunately, I've been forced to put this project on hold indefinitely as a result of college, particularly since this was just a side project that was supposed to be a part of a much larger design. Perhaps in the coming days, I'll try to sneak in some new functionality, but I can't make any promises due to my schedule.
04/02/2020 12:33 am
Level 1 : New Crafter
:) Glad you liked it. I know what you mean about sidelining projects due to college. Can't spend much time on this stuff or I'll struggle not to think about it all week O_O.
02/04/2019 10:14 am
Level 6 : Apprentice Architect
could you please make it so tourches magma blocks and fire etc. emit heat further out frm the source. make it decrease the further away you are kind of like the light levels emitted by the blocks themselves

02/04/2019 9:15 pm
Level 21 : Expert Engineer
What you're asking for is possible, however, the issue is that for each additional block away from the heat source, the number of functions needed increases at an exponential rate. As of right now, each block that effects temperature has about 11 commands actively calculating temperature. If I want to increase the range by one block, I need to add probably 20 to 30 commands per block. If I want to increase the range by two blocks, I probably need an additional 30 commands on top of the existing ones. And this is just a rough estimation without doing any math so this might be a bit exaggerated, but I can only imagine computers crying over an additional thousand lines needing to be calculated per player.

So, is it possible, yes, but I think I'd need to create a separate single-player version, or simply label it as a more resource intensive option. If you think your computer can deal with the extra stress, I can probably develop a version along the lines of what you're suggesting, but it might take a while since I'm currently working on updating another project called "Super Hostile Online" to 1.13 for Vechs (if you're unfamiliar with his work, I'd recommend Googling Super Hostile CTM).
02/05/2019 5:41 am
Level 6 : Apprentice Architect
oh boi yikes. yeah if it is going to cause massive issues for computures i think i can live without. wish mojang would add something like this data pack to the base game. really cool thing you've got here

02/05/2019 2:06 pm
Level 21 : Expert Engineer
First off, thanks for supporting the project! I really do appreciate your interest.

To be fair, it really just depends on how much memory you can dedicate to your game. If I spent some time reworking and optimizing the code, it should be possible to do what you're asking. For instance, I believe that to some extent, my computer could handle a larger system, but that I wouldn't be able to manage a server with the same data requirements. It's up to your discretion to determine if your computer could handle a larger datapack and how long you'd be willing to wait for an upgraded version.
Planet Minecraft Logo


© 2010 - 2020