Class SetTemperatureFromPressureProvider
java.lang.Object
com.github.thedeathlycow.thermoo.api.environment.v2.provider.SetTemperatureFromPressureProvider
- All Implemented Interfaces:
EnvironmentProvider
An environment provider that applies the Ideal Gas Law to
set the current temperature based on atmospheric pressure, using an assumed baseline pressure. If no baseline
pressure is provided, then it will use
ThermooEnvironmentAttributes.ATMOSPHERIC_PRESSURE to get a baseline.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SetTemperatureFromPressureProvider> Fields inherited from interface EnvironmentProvider
ELEMENT_CODEC, HOLDER_CODEC -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildCurrentComponents(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome, net.minecraft.core.component.DataComponentMap.Builder builder) Applying the Ideal Gas Law, sets the temperature component totemperature := (pressure * temperature) / basePressure.com.mojang.serialization.MapCodec<SetTemperatureFromPressureProvider> codec()create()Creates a new instance of this component which uses environment attributes to get the baseline pressure.create(double basePressure) Creates a new instance of this component using a given base pressure.
-
Field Details
-
CODEC
-
-
Method Details
-
create
Creates a new instance of this component which uses environment attributes to get the baseline pressure. -
create
Creates a new instance of this component using a given base pressure.- Parameters:
basePressure- The base pressure, in millibars. May not be negative.
-
buildCurrentComponents
public void buildCurrentComponents(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome, net.minecraft.core.component.DataComponentMap.Builder builder) Applying the Ideal Gas Law, sets the temperature component totemperature := (pressure * temperature) / basePressure.This is based on the assumption that the temperature set in the map currently is derived based on the atmospheric pressure being equal to its default value.
- Specified by:
buildCurrentComponentsin interfaceEnvironmentProvider- Parameters:
level- The world/level being queriedpos- The position in the world to querybiome- The biome at the position in the worldbuilder- A component map builder to append to
-
codec
- Specified by:
codecin interfaceEnvironmentProvider- Returns:
- Returns the codec of the provider.
-
basePressure
-