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.
-
Field Summary
Fields inherited from interface com.github.thedeathlycow.thermoo.api.environment.provider.EnvironmentProvider
ELEMENT_CODEC, ENTRY_CODEC, HOLDER_CODEC -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSeasonalEnvironmentProvider(Optional<ThermooSeason> fallbackSeason, Map<ThermooSeason, net.minecraft.core.Holder<EnvironmentProvider>> seasons) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidbuildCurrentComponents(net.minecraft.world.level.Level world, 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 environment components based on the world's current season state, generally using theseason API.protected static com.mojang.serialization.MapCodec<Map<ThermooSeason, net.minecraft.core.Holder<EnvironmentProvider>>> final Optional<ThermooSeason> The fallback season to use if no season mod is installed.protected abstract Optional<ThermooSeason> getCurrentSeason(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Gets the current season state of the world at a position (usually by delegating to a season event.final Map<ThermooSeason, net.minecraft.core.Holder<EnvironmentProvider>> seasons()The season-to-provider lookup back.protected static <T extends SeasonalEnvironmentProvider>
com.mojang.serialization.MapCodec<T> validate(com.mojang.serialization.MapCodec<T> codec) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.thedeathlycow.thermoo.api.environment.provider.EnvironmentProvider
getType
-
Constructor Details
-
SeasonalEnvironmentProvider
protected SeasonalEnvironmentProvider(Optional<ThermooSeason> fallbackSeason, Map<ThermooSeason, net.minecraft.core.Holder<EnvironmentProvider>> seasons)
-
-
Method Details
-
buildCurrentComponents
public final void buildCurrentComponents(net.minecraft.world.level.Level world, 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 environment components based on the world's current season state, generally using theseason 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 thefallback season. If there is no fallback season, then this does nothing.- Specified by:
buildCurrentComponentsin interfaceEnvironmentProvider- Parameters:
world- 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
-
fallbackSeason
The fallback season to use if no season mod is installed. If specified, the fallback season must be a key in theseasons()map. If no fallback season is provided, and there is no season mod installed, then this provider will return nothing.- Returns:
- Returns
fallbackSeason
-
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.level.Level world, net.minecraft.core.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 ofpos- 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.core.Holder<EnvironmentProvider>>> createSeasonMapCodec() -
validate
protected static <T extends SeasonalEnvironmentProvider> com.mojang.serialization.MapCodec<T> validate(com.mojang.serialization.MapCodec<T> codec)
-