Class LightThresholdLightProvider
java.lang.Object
com.github.thedeathlycow.thermoo.api.environment.provider.LightThresholdLightProvider
- All Implemented Interfaces:
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder class for light threshold providers -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<LightThresholdLightProvider> Fields inherited from interface com.github.thedeathlycow.thermoo.api.environment.provider.EnvironmentProvider
ELEMENT_CODEC, ENTRY_CODEC, HOLDER_CODEC -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.Holder<EnvironmentProvider> above()The provider to use when the light level is at or above thethreshold()booleanWhether ambient darkness should be applied when using the skylight light type (default: true)net.minecraft.core.Holder<EnvironmentProvider> below()The provider to use when the light level is below thethreshold()voidbuildCurrentComponents(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.builder(int threshold, @NotNull net.minecraft.core.Holder<EnvironmentProvider> above, @NotNull net.minecraft.core.Holder<EnvironmentProvider> below) Creates a new builder with the mandatory threshold, above, and below fieldsgetType()Optional<net.minecraft.world.level.LightLayer> The optional light layer of this provider.Optional<net.minecraft.world.level.LightLayer> Deprecated, for removal: This API element is subject to removal in a future version.int
-
Field Details
-
CODEC
-
-
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 thethreshold. Must not be null.below- The provider to use when a positions light level is below thethreshold. 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 theabove()provider. Otherwise, uses thebelow()provider.Filters for sky/block light and ambient darkness if requested.
- 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- Component map builder to append to
-
getType
- Specified by:
getTypein interfaceEnvironmentProvider- 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, uselightLayer()to better conform to official mappings.The optional light type of this provider. If not specified, usesLevelReader.getMaxLocalRawBrightness(BlockPos)to determine light level.- Returns:
- Returns the light layer of this provider.
-
lightLayer
The optional light layer of this provider. If not specified, usesLevelReader.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() -
above
The provider to use when the light level is at or above thethreshold() -
below
The provider to use when the light level is below thethreshold()
-
lightLayer()to better conform to official mappings.