Class LightThresholdLightProvider

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

public class LightThresholdLightProvider extends Object implements EnvironmentProvider
Used to pick between two child providers based on a light level threshold. Can filter for LightLayer and apply or ignore ambient darkness to sky light.
  • Field Details

  • Method Details

    • builder

      @Contract("_,_,_->new") public static LightThresholdLightProvider.Builder builder(int threshold, @NotNull @NotNull net.minecraft.core.Holder<EnvironmentProvider> above, @NotNull @NotNull net.minecraft.core.Holder<EnvironmentProvider> below)
      Creates a new builder with the mandatory threshold, above, and below fields
      Parameters:
      threshold - The light level threshold - must be between 0 and 15 (inclusive)
      above - The provider to use when a positions light level is at or above the threshold. Must not be null.
      below - The provider to use when a positions light level is below the threshold. Must not be null.
      Returns:
      Returns a new builder instance
    • 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)
      Builds the current components of the world position based on light level. If the light level of the position is at or above the threshold then uses the above() provider. Otherwise, uses the below() provider.

      Filters for sky/block light and ambient darkness if requested.

      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 - Component map builder to append to
    • getType

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

      @Deprecated(since="8.1.0", forRemoval=true) public Optional<net.minecraft.world.level.LightLayer> lightType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is named based on Yarn, use lightLayer() to better conform to official mappings.
      The optional light layer of this provider. If not specified, uses LevelReader.getMaxLocalRawBrightness(BlockPos) to determine light level.
      Returns:
      Returns the light layer of this provider.
    • lightLayer

      public Optional<net.minecraft.world.level.LightLayer> lightLayer()
      The optional light layer of this provider. If not specified, uses LevelReader.getMaxLocalRawBrightness(BlockPos) to determine light level.
      Returns:
      Returns the light layer of this provider.
    • applyAmbientDarkness

      public boolean applyAmbientDarkness()
      Whether ambient darkness should be applied when using the skylight light type (default: true)
    • threshold

      public int threshold()
      Light level threshold that determines whether to use above() or below() when finding the environment components. Must be between 0 and 15 (inclusive).
    • above

      public net.minecraft.core.Holder<EnvironmentProvider> above()
      The provider to use when the light level is at or above the threshold()
    • below

      public net.minecraft.core.Holder<EnvironmentProvider> below()
      The provider to use when the light level is below the threshold()