Class EnvironmentalAffinityAPI

java.lang.Object
etithespirit.orimod.apiimpl.EnvironmentalAffinityAPI
All Implemented Interfaces:
IEnvironmentalAffinityAPI

public class EnvironmentalAffinityAPI extends Object implements IEnvironmentalAffinityAPI
An implementation of the environmental affinity API.
  • Constructor Summary

    Constructors
    Constructor
    Description
    This is declared so that the API can be constructed via reflection.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.common.collect.ImmutableMap<net.minecraft.resources.ResourceLocation,EnvironmentalAffinity>
    Returns all bindings from biome to their environmental affinity.
    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
    Iterates over all affinity bindings and ensures that the biome they were bound to is identical to the biome they were constructed with.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface IEnvironmentalAffinityAPI
      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 interface IEnvironmentalAffinityAPI
      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 interface IEnvironmentalAffinityAPI
      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 IllegalStateException
      Description copied from interface: IEnvironmentalAffinityAPI
      Returns all bindings from biome to their environmental affinity.
      Specified by:
      getAllBindings in interface IEnvironmentalAffinityAPI
      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.