-
Notifications
You must be signed in to change notification settings - Fork 3
Temperature Changes (Mods)
In most cases, interactions with temperature will occur through a change. A 'temperature change' in Thermoo is just a literal amount of temperature added or removed from the current temperature of a TemperatureAware
. However, whenever a change is applied it must be applied in one of three 'modes' of resistance - passive, active, and absolute. Each mode controls how and when resistances will be applied.
Before diving into when the different modes apply resistance, it's important to clarify exactly how resistance is applied. Resistance in Thermoo is implemented in a somewhat weird way, resistance is a percentage value between 0 and 10, where a value of 0 corresponds to 0% resistance and a value of 10 corresponds to 100% resistance. For living entities, the value of their cold/heat resistance is exactly the same as the value of the respective resistance attributes.
The resistance applied to a temperature change depends on the temperature change itself. If the temperature change is negative (decreasing), the change will be affected by cold resistance; and if the temperature change is positive (increasing), the change will be affected by heat resistance.
The three different moves of temperature change - passive, active, and absolute - affect when the respective resistance of the change is applied. These modes are contained in the API enum HeatingModes
and implement the HeatingMode
interface. The gist of these modes is that absolute temperature changes are for debugging or commands; active temperature changes are from well defined sources like Powder Snow, Freezing Arrows, or fire balls; and passive changes are from exposure to the environment around you.
Absolute temperature changes are the most simple - they do not apply any resistance at all, ever. This is actually the default mode of temperature change. For example, if you call entity.thermoo$addTemperature(10)
that change will be applied with the absolute heating mode. This is mostly useful in the context of commands or debugging, where you want to apply an absolute change and probably not very useful for most gameplay usages.
Active temperature changes always apply the respective resistance. That is, if the incoming change is negative, cold resistance will be applied. If the incoming change is positive, heat resistance will be applied. This is often used for "active" effects that are deliberately hostile to the player, such as the freezing of the Frost Arrow in Frostiful.
Passive temperature changes only sometimes apply resistance. Passive changes will only apply the thermal resistance if the current temperature of the Temperature Aware entity is within the 'zone' of the change. For example, a change like entity.thermoo$addTemperature(-10, HeatingModes.PASSIVE)
will only apply cold resistance to that change if the entity
is cold (has a temperature less than or equal to 0). This would typically be used for changes that come from the environment, such as block heat sources, where it would be more desirable to not be affected by their heat resistance when they are cold and trying to warm up.
LivingEntity entity;
entity.thermoo$addTemperature(-10); // decreases temperature by 10, ignoring all resistance
LivingEntity entity;
entity.thermoo$addTemperature(10, HeatingModes.ACTIVE); // increases temperature by 10, but applies resistance
➡️ Next: Soaking