Enum Class TimePeriod

java.lang.Object
java.lang.Enum<TimePeriod>
dev.sefiraat.sefilib.world.TimePeriod
All Implemented Interfaces:
Serializable, Comparable<TimePeriod>, Constable

public enum TimePeriod extends Enum<TimePeriod>
Time Periods that occur in the minecraft day with their start and end times SUNRISE When the sun is rising DAY When the sun is out SUNSET When the sun is setting NIGHT When the sun isn't out WAKE_UP When the player and villagers will get out of their bed BED_TIME_RAIN When the player can go to bed during rain BED_TIME_CLEAR When the player can go to bed during clear weather MOON_HIDDEN When the moon hides past the horizon MOON_VISIBLE When the moon is visible in the sky VILLAGER_WORK When villagers can work during a day VILLAGER_SOCIALISE When villagers can socialise (specifically cannot work) VILLAGER_BED_TIME When villagers path find to their beds and/or sleep SKY_LIGHT_WAX_CLEAR When the light level begins to increase in clear weather SKY_LIGHT_WAX_RAIN When the light level begins to increase in rain SKY_LIGHT_WANE_CLEAR When the light level begins to decrease in clear weather SKY_LIGHT_WANE_RAIN When the light level begins to decrease in rain MOB_SPAWN_CLEAR The time period in which mobs COULD spawn in the overworld during clear weather MOB_SPAWN_RAIN The time period in which mobs COULD spawn in the overworld during rain
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    When the player can go to bed during clear weather
    When the player can go to bed during rain
    When the sun is out
    The time period in which mobs COULD spawn in the overworld during clear weather
    The time period in which mobs COULD spawn in the overworld during rain
    When the moon hides past the horizon
    When the moon is visible in the sky
    When the sun isn't out
    When the light level begins to decrease in clear weather
    When the light level begins to decrease in rain
    When the light level begins to increase in clear weather
    When the light level begins to increase in rain
    When the sun is rising
    When the sun is setting
    When villagers path find to their beds and/or sleep
    When villagers can socialise (specifically cannot work)
    When villagers can work during a day
    When the player and villagers will get out of their bed
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Gets the end time of this time period
    long
    Gets the start time of this time period
    static boolean
    isActive(Long time, TimePeriod timePeriod)
    Checks if the given time period would be active during the given time
    static boolean
    isActive(World world, TimePeriod timePeriod)
    Checks if the given time period would be active during current world time
    static boolean
    isDark(World world)
    Returns if the given world is dark.
    static boolean
    isDay(Long time)
    Checks if the time would be day in a 'normal' world
    static boolean
    isDay(World world)
    Checks if the time would be day in a 'normal' world
    static boolean
    isLight(World world)
    Returns if the given world is light.
    static boolean
    isNight(Long time)
    Checks if the time would be night in a 'normal' world
    static boolean
    isNight(World world)
    Checks if the time would be night in a 'normal' world
    static boolean
    moonOut(Long time)
    Returns if the moon is still visible in the Sky during the specified time.
    static boolean
    moonOut(World world)
    Returns if the moon is still visible in the Sky.
    static boolean
    naturalMobsCanSpawn(long time, boolean rain)
    Returns if natural mobs would spawn at the given time and weather.
    static boolean
    Returns if the world can CURRENTLY spawn mobs naturally using time.
    static TimePeriod
    Returns the enum constant of this class with the specified name.
    static TimePeriod[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    static boolean
    Checks if villagers would be awake during the provided time.
    static boolean
    Checks if villagers would be awake during the provided time.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • SUNRISE

      public static final TimePeriod SUNRISE
      When the sun is rising
    • DAY

      public static final TimePeriod DAY
      When the sun is out
    • SUNSET

      public static final TimePeriod SUNSET
      When the sun is setting
    • NIGHT

      public static final TimePeriod NIGHT
      When the sun isn't out
    • WAKE_UP

      public static final TimePeriod WAKE_UP
      When the player and villagers will get out of their bed
    • BED_TIME_RAIN

      public static final TimePeriod BED_TIME_RAIN
      When the player can go to bed during rain
    • BED_TIME_CLEAR

      public static final TimePeriod BED_TIME_CLEAR
      When the player can go to bed during clear weather
    • MOON_HIDDEN

      public static final TimePeriod MOON_HIDDEN
      When the moon hides past the horizon
    • MOON_VISIBLE

      public static final TimePeriod MOON_VISIBLE
      When the moon is visible in the sky
    • VILLAGER_WORK

      public static final TimePeriod VILLAGER_WORK
      When villagers can work during a day
    • VILLAGER_SOCIALISE

      public static final TimePeriod VILLAGER_SOCIALISE
      When villagers can socialise (specifically cannot work)
    • VILLAGER_BED_TIME

      public static final TimePeriod VILLAGER_BED_TIME
      When villagers path find to their beds and/or sleep
    • SKY_LIGHT_WAX_CLEAR

      public static final TimePeriod SKY_LIGHT_WAX_CLEAR
      When the light level begins to increase in clear weather
    • SKY_LIGHT_WAX_RAIN

      public static final TimePeriod SKY_LIGHT_WAX_RAIN
      When the light level begins to increase in rain
    • SKY_LIGHT_WANE_CLEAR

      public static final TimePeriod SKY_LIGHT_WANE_CLEAR
      When the light level begins to decrease in clear weather
    • SKY_LIGHT_WANE_RAIN

      public static final TimePeriod SKY_LIGHT_WANE_RAIN
      When the light level begins to decrease in rain
    • MOB_SPAWN_CLEAR

      public static final TimePeriod MOB_SPAWN_CLEAR
      The time period in which mobs COULD spawn in the overworld during clear weather
    • MOB_SPAWN_RAIN

      public static final TimePeriod MOB_SPAWN_RAIN
      The time period in which mobs COULD spawn in the overworld during rain
  • Method Details

    • values

      public static TimePeriod[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TimePeriod valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getStart

      public long getStart()
      Gets the start time of this time period
      Returns:
      The start time of this time period
    • getEnd

      public long getEnd()
      Gets the end time of this time period
      Returns:
      The end time of this time period
    • isDay

      public static boolean isDay(@Nonnull World world)
      Checks if the time would be day in a 'normal' world
      Parameters:
      world - The World to get the time from to check against
      Returns:
      true if the given time would be day in the overworld.
    • isDay

      public static boolean isDay(Long time)
      Checks if the time would be day in a 'normal' world
      Parameters:
      time - The time to check against
      Returns:
      true if the given time would be day in the overworld.
    • isNight

      public static boolean isNight(@Nonnull World world)
      Checks if the time would be night in a 'normal' world
      Parameters:
      world - The World to get the time from to check against
      Returns:
      true if the given time would be night in the overworld.
    • isNight

      public static boolean isNight(@Nonnull Long time)
      Checks if the time would be night in a 'normal' world
      Parameters:
      time - The time to check against
      Returns:
      true if the given time would be night in the overworld.
    • isActive

      public static boolean isActive(@Nonnull World world, @Nonnull TimePeriod timePeriod)
      Checks if the given time period would be active during current world time
      Parameters:
      world - The World to get the time from
      timePeriod - The TimePeriod to check against
      Returns:
      true if the TimePeriod is active during the world's time
    • isActive

      public static boolean isActive(@Nonnull Long time, @Nonnull TimePeriod timePeriod)
      Checks if the given time period would be active during the given time
      Parameters:
      time - The long value denoting the chosen time
      timePeriod - The TimePeriod to check against
      Returns:
      true if the TimePeriod is active
    • villagersAwake

      public static boolean villagersAwake(@Nonnull World world)
      Checks if villagers would be awake during the provided time.
      Parameters:
      world - The World to get the time from to check against.
      Returns:
      true if villagers can be awake during the world's time
    • villagersAwake

      public static boolean villagersAwake(@Nonnull Long time)
      Checks if villagers would be awake during the provided time.
      Parameters:
      time - The long value describing the time to check
      Returns:
      true if villagers can be awake during the given time
    • moonOut

      public static boolean moonOut(@Nonnull World world)
      Returns if the moon is still visible in the Sky.
      Parameters:
      world - The world to check.
      Returns:
      True if the moon is/would be out, false if not or wrong world type.
    • moonOut

      public static boolean moonOut(@Nonnull Long time)
      Returns if the moon is still visible in the Sky during the specified time. This method assumes the world is Overworld.
      Parameters:
      time - The time to check.
      Returns:
      True if the moon is/would be out
    • naturalMobsCanSpawn

      public static boolean naturalMobsCanSpawn(World world)
      Returns if the world can CURRENTLY spawn mobs naturally using time. Does not check world, difficulty, region or environment.
      Parameters:
      world - The World to get the time and weather from
      Returns:
      Returns true if mobs can spawn naturally at the current point in time
    • naturalMobsCanSpawn

      public static boolean naturalMobsCanSpawn(long time, boolean rain)
      Returns if natural mobs would spawn at the given time and weather.
      Parameters:
      time - The time to check against
      rain - The weather to check against
      Returns:
      Returns true if mobs can spawn naturally during the given time and weather
    • isLight

      public static boolean isLight(@Nonnull World world)
      Returns if the given world is light.
      Parameters:
      world - The world to check.
      Returns:
      True if past sunrise/before sunset or in a different world.
    • isDark

      public static boolean isDark(@Nonnull World world)
      Returns if the given world is dark.
      Parameters:
      world - The world to check.
      Returns:
      True if past sunset/before sunrise or in a different world.