Enum Class TimeCommon

java.lang.Object
java.lang.Enum<TimeCommon>
net.pottercraft.ollivanders2.common.TimeCommon
All Implemented Interfaces:
Serializable, Comparable<TimeCommon>, Constable

public enum TimeCommon extends Enum<TimeCommon>
Enumeration of standard times of day in Minecraft, based on day-relative ticks.

Minecraft days cycle through 24000 ticks (20 ticks per second = 20 minutes per full day). Day-relative ticks are the tick value modulo 24000, ranging from 0 to 23999, where:

  • 0 = Midnight (start of day)
  • 6000 = Midday (noon)
  • 12000 = Sunset
  • 18000 = Midnight (end of day)

These constants represent the standard times of day and can be used with commands like `/time set`.

See Also:
  • 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
    Dawn (23000 ticks) - early morning when the sun is just beginning to rise.
    Midday (6000 ticks) - noon, when the sun is at its highest point and brightness is maximum.
    Midnight (18000 ticks) - the start of the night cycle, when darkness is complete.
    Moonrise (13000 ticks)
    Sunset (12000 ticks) - evening when the sun begins to set and darkness is approaching.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull String
    Get the current system date and time as a formatted string.
    static long
    Get the full time (cumulative ticks) for the default world.
    int
    Get the day-relative tick value for this enumerated time of day
    static TimeCommon
    Returns the enum constant of this class with the specified name.
    static TimeCommon[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

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

    • MIDNIGHT

      public static final TimeCommon MIDNIGHT
      Midnight (18000 ticks) - the start of the night cycle, when darkness is complete.
    • DAWN

      public static final TimeCommon DAWN
      Dawn (23000 ticks) - early morning when the sun is just beginning to rise.
    • MIDDAY

      public static final TimeCommon MIDDAY
      Midday (6000 ticks) - noon, when the sun is at its highest point and brightness is maximum.
    • SUNSET

      public static final TimeCommon SUNSET
      Sunset (12000 ticks) - evening when the sun begins to set and darkness is approaching.
    • MOONRISE

      public static final TimeCommon MOONRISE
      Moonrise (13000 ticks)
  • Method Details

    • values

      public static TimeCommon[] 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 TimeCommon 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
    • getTick

      public int getTick()
      Get the day-relative tick value for this enumerated time of day
      Returns:
      the day-relative tick for this time of day
    • getDefaultWorldTime

      public static long getDefaultWorldTime()
      Get the full time (cumulative ticks) for the default world.

      Returns the full time in ticks since the world was created, not the day-relative time (0-23999). To get the day-relative time, use: getDefaultWorldTime() % 24000

      Returns:
      the full time in ticks for the default world
    • getCurrentTimestamp

      @NotNull public static @NotNull String getCurrentTimestamp()
      Get the current system date and time as a formatted string.

      Returns the system date/time (not Minecraft game time). This is typically used for logging, file naming, or other real-world timestamp purposes.

      Returns:
      the current system timestamp in the format yyyy-MM-dd-HH-mm-ss (e.g., "2018-09-30-12-15-30")