Package etithespirit.orimod.apiimpl
Class EnvironmentalAffinityAPI
java.lang.Object
etithespirit.orimod.apiimpl.EnvironmentalAffinityAPI
- All Implemented Interfaces:
IEnvironmentalAffinityAPI
An implementation of the environmental affinity API.
-
Constructor Summary
ConstructorsConstructorDescriptionThis is declared so that the API can be constructed via reflection. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableMap<net.minecraft.resources.ResourceLocation,
EnvironmentalAffinity> Returns all bindings from biome to their environmental affinity.@Nullable EnvironmentalAffinity
getBiomeEnvEffects
(net.minecraft.resources.ResourceLocation biome) Returns the environmental affinity of this biome with respect to Decay vs Light.boolean
MUST BE CHECKED BEFORE OTHER METHODS ARE USED.static void
onPlayerTickEvent
(net.minecraftforge.event.TickEvent.PlayerTickEvent evt) Called when Forge's player tick event executes.static void
onWorldTickEvent
(net.minecraftforge.event.TickEvent.LevelTickEvent evt) Called when Forge's world tick event executes.void
setBiomeEnvEffects
(net.minecraft.resources.ResourceLocation biome, @Nullable EnvironmentalAffinity affinity) Sets the environmental affinity of the given biome.static void
validate()
Iterates over all affinity bindings and ensures that the biome they were bound to is identical to the biome they were constructed with.
-
Constructor Details
-
EnvironmentalAffinityAPI
public EnvironmentalAffinityAPI()This is declared so that the API can be constructed via reflection.
-
-
Method Details
-
isInstalled
public boolean isInstalled()Description copied from interface:IEnvironmentalAffinityAPI
MUST BE CHECKED BEFORE OTHER METHODS ARE USED.- Specified by:
isInstalled
in interfaceIEnvironmentalAffinityAPI
- Returns:
- Whether or not the API is installed.
-
getBiomeEnvEffects
@Nullable public @Nullable EnvironmentalAffinity getBiomeEnvEffects(net.minecraft.resources.ResourceLocation biome) throws ArgumentNullException, IllegalStateException Description copied from interface:IEnvironmentalAffinityAPI
Returns the environmental affinity of this biome with respect to Decay vs Light.- Specified by:
getBiomeEnvEffects
in interfaceIEnvironmentalAffinityAPI
- Parameters:
biome
- The biome's registry name.- Returns:
- The environmental affinity of this biome, or null if no affinity was registered.
- Throws:
ArgumentNullException
- If the biome parameter is null.IllegalStateException
- If the mod is not installed.
-
setBiomeEnvEffects
public void setBiomeEnvEffects(net.minecraft.resources.ResourceLocation biome, @Nullable @Nullable EnvironmentalAffinity affinity) throws ArgumentNullException, IllegalStateException Description copied from interface:IEnvironmentalAffinityAPI
Sets the environmental affinity of the given biome. If this biome has already been registered, it will overwrite the previous registered setting.- Specified by:
setBiomeEnvEffects
in interfaceIEnvironmentalAffinityAPI
- Parameters:
biome
- The biome to associate with, by registry name.affinity
- The affinity to use for this biome. This can be null to remove the affinity.- Throws:
ArgumentNullException
- If the biome parameter is null.IllegalStateException
- If the mod is not installed, or if this is called after the Forge load cycle has completed.
-
getAllBindings
public com.google.common.collect.ImmutableMap<net.minecraft.resources.ResourceLocation,EnvironmentalAffinity> getAllBindings() throws IllegalStateExceptionDescription copied from interface:IEnvironmentalAffinityAPI
Returns all bindings from biome to their environmental affinity.- Specified by:
getAllBindings
in interfaceIEnvironmentalAffinityAPI
- Returns:
- All bindings from biome to their environmental affinity.
- Throws:
IllegalStateException
-
validate
public static void validate()Iterates over all affinity bindings and ensures that the biome they were bound to is identical to the biome they were constructed with. -
onPlayerTickEvent
public static void onPlayerTickEvent(net.minecraftforge.event.TickEvent.PlayerTickEvent evt) Called when Forge's player tick event executes.- Parameters:
evt
- The tick event.
-
onWorldTickEvent
public static void onWorldTickEvent(net.minecraftforge.event.TickEvent.LevelTickEvent evt) Called when Forge's world tick event executes.- Parameters:
evt
- The tick event.
-