Class SeasonalEnvironmentProvider

java.lang.Object
com.github.thedeathlycow.thermoo.api.environment.provider.SeasonalEnvironmentProvider
All Implemented Interfaces:
EnvironmentProvider
Direct Known Subclasses:
TemperateSeasonEnvironmentProvider, TropicalSeasonEnvironmentProvider

public abstract sealed class SeasonalEnvironmentProvider extends Object implements EnvironmentProvider permits TemperateSeasonEnvironmentProvider, TropicalSeasonEnvironmentProvider
An environment provider that dispatches to another provider based on the current season state of a world.
  • Constructor Details

  • Method Details

    • buildCurrentComponents

      public final void buildCurrentComponents(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.registry.entry.RegistryEntry<net.minecraft.world.biome.Biome> biome, net.minecraft.component.ComponentMap.Builder builder)
      Builds the environment components based on the world's current season state, generally using the season API. If no seasons mod is installed, or if the tropical/temperate season state does not exist at this world position, then this will use the components provided by the fallback season. If there is no fallback season, then this does nothing.
      Specified by:
      buildCurrentComponents in interface EnvironmentProvider
      Parameters:
      world - 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
    • fallbackSeason

      public final Optional<ThermooSeason> fallbackSeason()
      The fallback season to use if no season mod is installed. If specified, the fallback season must be a key in the seasons() map. If no fallback season is provided, and there is no season mod installed, then this provider will return nothing.
      Returns:
      Returns fallbackSeason
    • seasons

      public final Map<ThermooSeason,net.minecraft.registry.entry.RegistryEntry<EnvironmentProvider>> seasons()
      The season-to-provider lookup back. Used to dispatch this provider to another provider based on the current season of a world.
      Returns:
      Returns an unmodifiable map of seasons
    • getCurrentSeason

      protected abstract Optional<ThermooSeason> getCurrentSeason(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)
      Gets the current season state of the world at a position (usually by delegating to a season event.
      Parameters:
      world - The world to query the season state of
      pos - The position to query the season state at
      Returns:
      Returns the season state of a particular world position, or empty if no season state exists there or if a season mod is not loaded.
    • createSeasonMapCodec

      protected static com.mojang.serialization.MapCodec<Map<ThermooSeason,net.minecraft.registry.entry.RegistryEntry<EnvironmentProvider>>> createSeasonMapCodec()
    • validate

      protected static <T extends SeasonalEnvironmentProvider> com.mojang.serialization.MapCodec<T> validate(com.mojang.serialization.MapCodec<T> codec)