Class SetTemperatureFromPressure

java.lang.Object
com.github.thedeathlycow.thermoo.api.environment.provider.SetTemperatureFromPressure
All Implemented Interfaces:
EnvironmentProvider

public final class SetTemperatureFromPressure extends Object implements 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 Details

  • Method Details

    • create

      public static SetTemperatureFromPressure create()
      Creates a new instance of this component which uses environment attributes to get the baseline pressure.
    • create

      public static SetTemperatureFromPressure create(double basePressure)
      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 to temperature := (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:
      buildCurrentComponents in interface EnvironmentProvider
      Parameters:
      level - The world/level being queried
      pos - The position in the world to query
      biome - The biome at the position in the world
      builder - A component map builder to append to
    • getType

      Specified by:
      getType in interface EnvironmentProvider
      Returns:
      Returns the type of this provider for dispatch
    • basePressure

      public Optional<Double> basePressure()
      Returns:
      The base pressure in millibars.