Package dev.sefiraat.sefilib.world
Enum Class TimePeriod
- All Implemented Interfaces:
Serializable,Comparable<TimePeriod>,Constable
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 ConstantsEnum ConstantDescriptionWhen the player can go to bed during clear weatherWhen the player can go to bed during rainWhen the sun is outThe time period in which mobs COULD spawn in the overworld during clear weatherThe time period in which mobs COULD spawn in the overworld during rainWhen the moon hides past the horizonWhen the moon is visible in the skyWhen the sun isn't outWhen the light level begins to decrease in clear weatherWhen the light level begins to decrease in rainWhen the light level begins to increase in clear weatherWhen the light level begins to increase in rainWhen the sun is risingWhen the sun is settingWhen villagers path find to their beds and/or sleepWhen villagers can socialise (specifically cannot work)When villagers can work during a dayWhen the player and villagers will get out of their bed -
Method Summary
Modifier and TypeMethodDescriptionlonggetEnd()Gets the end time of this time periodlonggetStart()Gets the start time of this time periodstatic booleanisActive(Long time, TimePeriod timePeriod) Checks if the given time period would be active during the given timestatic booleanisActive(World world, TimePeriod timePeriod) Checks if the given time period would be active during current world timestatic booleanReturns if the given world is dark.static booleanChecks if the time would be day in a 'normal' worldstatic booleanChecks if the time would be day in a 'normal' worldstatic booleanReturns if the given world is light.static booleanChecks if the time would be night in a 'normal' worldstatic booleanChecks if the time would be night in a 'normal' worldstatic booleanReturns if the moon is still visible in the Sky during the specified time.static booleanReturns if the moon is still visible in the Sky.static booleannaturalMobsCanSpawn(long time, boolean rain) Returns if natural mobs would spawn at the given time and weather.static booleannaturalMobsCanSpawn(World world) Returns if the world can CURRENTLY spawn mobs naturally using time.static TimePeriodReturns the enum constant of this class with the specified name.static TimePeriod[]values()Returns an array containing the constants of this enum class, in the order they are declared.static booleanvillagersAwake(Long time) Checks if villagers would be awake during the provided time.static booleanvillagersAwake(World world) Checks if villagers would be awake during the provided time.
-
Enum Constant Details
-
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
-
-
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
-
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
Checks if the time would be day in a 'normal' world- Parameters:
world- TheWorldto get the time from to check against- Returns:
- true if the given time would be day in the overworld.
-
isDay
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
Checks if the time would be night in a 'normal' world- Parameters:
world- TheWorldto get the time from to check against- Returns:
- true if the given time would be night in the overworld.
-
isNight
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
Checks if the given time period would be active during current world time- Parameters:
world- TheWorldto get the time fromtimePeriod- TheTimePeriodto check against- Returns:
- true if the TimePeriod is active during the world's time
-
isActive
Checks if the given time period would be active during the given time- Parameters:
time- The long value denoting the chosen timetimePeriod- TheTimePeriodto check against- Returns:
- true if the TimePeriod is active
-
villagersAwake
Checks if villagers would be awake during the provided time.- Parameters:
world- TheWorldto get the time from to check against.- Returns:
- true if villagers can be awake during the world's time
-
villagersAwake
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
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
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
Returns if the world can CURRENTLY spawn mobs naturally using time. Does not check world, difficulty, region or environment.- Parameters:
world- TheWorldto 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 againstrain- The weather to check against- Returns:
- Returns true if mobs can spawn naturally during the given time and weather
-
isLight
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
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.
-