Enum Class TimeCommon
- All Implemented Interfaces:
Serializable,Comparable<TimeCommon>,Constable
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 ConstantsEnum ConstantDescriptionDawn (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 TypeMethodDescriptionstatic @NotNull StringGet the current system date and time as a formatted string.static longGet the full time (cumulative ticks) for the default world.intgetTick()Get the day-relative tick value for this enumerated time of daystatic TimeCommonReturns the enum constant of this class with the specified name.static TimeCommon[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MIDNIGHT
Midnight (18000 ticks) - the start of the night cycle, when darkness is complete. -
DAWN
Dawn (23000 ticks) - early morning when the sun is just beginning to rise. -
MIDDAY
Midday (6000 ticks) - noon, when the sun is at its highest point and brightness is maximum. -
SUNSET
Sunset (12000 ticks) - evening when the sun begins to set and darkness is approaching. -
MOONRISE
Moonrise (13000 ticks)
-
-
Method Details
-
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
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 nameNullPointerException- 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
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")
-