Class ConstantProvider

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

public final class ConstantProvider extends Object implements EnvironmentProvider
Provides constant component values
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<ConstantProvider>
     

    Fields inherited from interface EnvironmentProvider

    ELEMENT_CODEC, HOLDER_CODEC
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    Adds the component map stored in this provider's components to the builder.
    com.mojang.serialization.MapCodec<ConstantProvider>
     
    net.minecraft.core.component.DataComponentMap
    Gets the component map stored in this provider.
    create(net.minecraft.core.component.DataComponentMap.Builder builder)
    Creates a constant environment provider from a component map builder.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<ConstantProvider> CODEC
  • Method Details

    • create

      @Contract("_->new") public static ConstantProvider create(net.minecraft.core.component.DataComponentMap.Builder builder)
      Creates a constant environment provider from a component map builder. The builder is built into a new component map with this method, so modifying the builder after creating the provider will not affect the returned provider.
      Parameters:
      builder - The builder to create the provider from
      Returns:
      Returns a new replacement environment provider
    • 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)
      Adds the component map stored in this provider's components to the builder. The components supplied by this provider are immutable and never change. If a component type is mapped to a value in the builder and NOT mapped to a value in this provider, then it will be unaffected.
      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
    • codec

      public com.mojang.serialization.MapCodec<ConstantProvider> codec()
      Specified by:
      codec in interface EnvironmentProvider
      Returns:
      Returns the codec of the provider.
    • components

      public net.minecraft.core.component.DataComponentMap components()
      Gets the component map stored in this provider. This is an [EnvironmentComponentTypes environment component].