Class EnvironmentalAffinity

java.lang.Object
etithespirit.orimod.api.environment.EnvironmentalAffinity
Direct Known Subclasses:
AffinityWithFX, PurposelyBrokenEnv

public abstract class EnvironmentalAffinity extends Object
This class stores data about a biome's environmental affinity. You can create instances for your mod as needed.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.resources.ResourceLocation
    The ID of the biome that this affinity object applies to.
    An object describing the efficiency of Light-based devices.
    final double
    A double representing the constant efficiency of Light-based devices.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, double efficiencyPercentage)
    Create a new affinity object for the given biome using the given flux and static efficiency percentage.
    EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, NumberRange efficiencyPercentage)
    Create a new affinity object for the given biome using the given flux and static efficiency percentage.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the next randomized efficiency multiplier for all light tech in the area.
    abstract void
    onPlayerTick(net.minecraft.world.entity.player.Player player)
    This method executes every forge Player tick (post phase, both sides) where the player is in the biome associated with this affinity.
    abstract void
    onWorldTick(net.minecraft.world.level.Level world)
    This method executes every forge World tick (post phase, both sides).
    static void
    sendPlayerTickToAll(net.minecraft.world.entity.player.Player player)
    Sends a tick to all instances of EnvironmentalAffinity for the given player.
    static void
    sendWorldTickToAll(net.minecraft.world.level.Level world)
    Sends a tick to all instances of EnvironmentalAffinity in the given level.

    Methods inherited from class java.lang.Object

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

    • biome

      public final net.minecraft.resources.ResourceLocation biome
      The ID of the biome that this affinity object applies to.
    • efficiency

      @Nullable public final NumberRange efficiency
      An object describing the efficiency of Light-based devices. This should return a value centered around 1 (where 1 means "no change"). It allows randomized interactions. This will be null if efficiencySingular is in use instead.
    • efficiencySingular

      public final double efficiencySingular
      A double representing the constant efficiency of Light-based devices. This can be used if there is no randomization per tick, in order to save computational power when ticking Light tech. This will be Double.NaN if this value is not in use.
  • Constructor Details

    • EnvironmentalAffinity

      public EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, NumberRange efficiencyPercentage)
      Create a new affinity object for the given biome using the given flux and static efficiency percentage.
      Parameters:
      biome - The biome that this exists for.
      efficiencyPercentage - The efficiency boost (or reduction) for all devices as a range of possible values. Note: If this is an immutable number range and it is singular (min == max), then efficiencySingular will be set to that value and efficiency will be null.
    • EnvironmentalAffinity

      public EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, double efficiencyPercentage)
      Create a new affinity object for the given biome using the given flux and static efficiency percentage.
      Parameters:
      biome - The biome that this exists for.
      efficiencyPercentage - The efficiency boost (or reduction) for all devices as a singular value.
  • Method Details

    • onPlayerTick

      public abstract void onPlayerTick(net.minecraft.world.entity.player.Player player)
      This method executes every forge Player tick (post phase, both sides) where the player is in the biome associated with this affinity.
      Parameters:
      player - The player to tick for.
    • onWorldTick

      public abstract void onWorldTick(net.minecraft.world.level.Level world)
      This method executes every forge World tick (post phase, both sides).
      Parameters:
      world - The level to tick in.
    • getNextEfficiencyMultiplier

      public double getNextEfficiencyMultiplier()
      Returns the next randomized efficiency multiplier for all light tech in the area.
      Returns:
      The next randomized efficiency multiplier for all light tech in the area.
    • sendPlayerTickToAll

      public static void sendPlayerTickToAll(net.minecraft.world.entity.player.Player player)
      Sends a tick to all instances of EnvironmentalAffinity for the given player.
      Parameters:
      player - The player to apply to.
    • sendWorldTickToAll

      public static void sendWorldTickToAll(net.minecraft.world.level.Level world)
      Sends a tick to all instances of EnvironmentalAffinity in the given level.
      Parameters:
      world - The level to send in.