Interface IActivityType

All Superinterfaces:
IRegistryAlleleValue

public interface IActivityType extends IRegistryAlleleValue
Used to define the active hours of a bee.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    getBeeDayTime(net.minecraft.world.level.LevelAccessor level)
    Used to determine the time of day for a beehive.
    getInactiveError(long gameTime, long dayTime, net.minecraft.core.BlockPos pos)
    Gets the error to display in GUIs for when this bee is inactive.
    Whether a bee only works above light level 11, less than or equal to that, or doesn't care.
    boolean
    isActive(long gameTime, long dayTime, net.minecraft.core.BlockPos pos)
    Determines whether this bee can be active and work at the current time of day.

    Methods inherited from interface forestry.api.genetics.alleles.IRegistryAlleleValue

    isDominant
  • Field Details

    • NIGHT_TIME

      static final long NIGHT_TIME
      Since:
      2.6.1 The hardcoded time used to represent night time.
      See Also:
  • Method Details

    • isActive

      boolean isActive(long gameTime, long dayTime, net.minecraft.core.BlockPos pos)
      Determines whether this bee can be active and work at the current time of day.
      Parameters:
      gameTime - The number of ticks spent in the current level. See LevelData.getGameTime().
      dayTime - The time of day of the current level, can be above 24000. See getBeeDayTime(net.minecraft.world.level.LevelAccessor).
      pos - The hive position. It can be used for randomness, like how flowers are offset based on position.
      Returns:
      true if this bee should be able to work, false if this bee should be asleep.
      See Also:
    • getInactiveError

      IError getInactiveError(long gameTime, long dayTime, net.minecraft.core.BlockPos pos)
      Gets the error to display in GUIs for when this bee is inactive. This method is only called when isActive(long, long, net.minecraft.core.BlockPos) returns false for the given parameters, so no need to duplicate your time checks.
      Parameters:
      gameTime - The number of ticks spent in the current level. See LevelData.getGameTime().
      dayTime - The time of day of the current level, can be above 24000. See getBeeDayTime(net.minecraft.world.level.LevelAccessor).
      pos - The hive position. It can be used for randomness, like how flowers are offset based on position.
      Returns:
      A descriptive error indicating that the time of day is wrong for this bee.
    • getLightPreference

      LightPreference getLightPreference()
      Whether a bee only works above light level 11, less than or equal to that, or doesn't care. For example, Diurnal bees want to work when the hive is above light level 11, but nocturnal bees will only work when the light level is 11 or below.
      Returns:
      The preference of light level for this activity type.
    • getBeeDayTime

      static long getBeeDayTime(net.minecraft.world.level.LevelAccessor level)
      Used to determine the time of day for a beehive. This takes dimensions without time, such as the Nether, into account.
      Parameters:
      level - The level to query time for.
      Returns:
      The time, adjusted to NIGHT_TIME for dimensions without a daytime cycle.
      Since:
      2.6.1