Class WorldTimeResource
java.lang.Object
com.hypixel.hytale.server.core.modules.time.WorldTimeResource
- All Implemented Interfaces:
Resource<EntityStore>,Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LocalDateTimeprivate intprivate final UpdateTimeSettingsprivate final UpdateTimestatic final intstatic final floatstatic final intprivate Instantstatic final intstatic final Instantprivate intstatic final longstatic final intprivate doublestatic final intstatic final floatstatic final floatprivate doublestatic final intprivate final UpdateTimeSettingsstatic final booleanstatic final Instantstatic final ZoneOffsetFields inherited from interface com.hypixel.hytale.component.Resource
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastTimePacket(Store<EntityStore> store) clone()intfloatintstatic ResourceType<EntityStore, WorldTimeResource> static doublegetSecondsPerTick(World world) doublestatic InstantinstantDataToInstant(InstantData instantData) static InstantDatainstantToInstantData(Instant instant) booleanisDayTimeWithinRange(double minTime, double maxTime) booleanisMoonPhaseWithinRange(World world, int minMoonPhase, int maxMoonPhase) booleanisScaledDayTimeWithinRange(double minTime, double maxTime) booleanisYearWithinRange(double minTime, double maxTime) voidsendTimePackets(PlayerRef playerRef) voidsetDayTime(double dayTime, World world, Store<EntityStore> store) voidsetGameTime(Instant gameTime, World world, Store<EntityStore> store) voidsetGameTime0(Instant gameTime) voidsetMoonPhase(int moonPhase, ComponentAccessor<EntityStore> componentAccessor) voidtick(float dt, Store<EntityStore> store) toString()voidupdateMoonPhase(World world, ComponentAccessor<EntityStore> componentAccessor) private voidupdateScaledTime(float dayProgress, float dayDuration, float halfNight) private voidupdateSunlightFactor(int dayProgress, float halfNight) voidupdateTimePacket(UpdateTime currentTimePacket) static UpdateTimeSettingsupdateTimeSettingsPacket(UpdateTimeSettings settings, World world)
-
Field Details
-
NANOS_PER_DAY
public static final long NANOS_PER_DAY -
SECONDS_PER_DAY
public static final int SECONDS_PER_DAY -
HOURS_PER_DAY
public static final int HOURS_PER_DAY -
DAYS_PER_YEAR
public static final int DAYS_PER_YEAR -
ZERO_YEAR
-
MAX_TIME
-
ZONE_OFFSET
-
SUN_HEIGHT
public static final float SUN_HEIGHT- See Also:
-
USE_SHADOW_MAPPING_SAFE_ANGLE
public static final boolean USE_SHADOW_MAPPING_SAFE_ANGLE- See Also:
-
DAYTIME_PORTION_PERCENTAGE
public static final float DAYTIME_PORTION_PERCENTAGE- See Also:
-
DAYTIME_SECONDS
public static final int DAYTIME_SECONDS -
NIGHTTIME_SECONDS
public static final int NIGHTTIME_SECONDS -
SUNRISE_SECONDS
public static final int SUNRISE_SECONDS -
SHADOW_MAPPING_SAFE_ANGLE_LERP
public static final float SHADOW_MAPPING_SAFE_ANGLE_LERP- See Also:
-
currentTimePacket
-
gameTime
-
_gameTimeLocalDateTime
-
currentHour
private int currentHour -
sunlightFactor
private double sunlightFactor -
scaledTime
private double scaledTime -
moonPhase
private int moonPhase -
currentSettings
-
tempSettings
-
-
Constructor Details
-
WorldTimeResource
public WorldTimeResource()
-
-
Method Details
-
getResourceType
-
getSecondsPerTick
-
tick
-
getMoonPhase
public int getMoonPhase() -
setMoonPhase
-
updateMoonPhase
public void updateMoonPhase(@Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
isMoonPhaseWithinRange
-
setGameTime0
-
updateSunlightFactor
private void updateSunlightFactor(int dayProgress, float halfNight) -
updateScaledTime
private void updateScaledTime(float dayProgress, float dayDuration, float halfNight) -
getGameTime
-
getGameDateTime
-
getSunlightFactor
public double getSunlightFactor() -
setGameTime
public void setGameTime(@Nonnull Instant gameTime, @Nonnull World world, @Nonnull Store<EntityStore> store) -
setDayTime
-
broadcastTimePacket
-
sendTimePackets
-
isDayTimeWithinRange
public boolean isDayTimeWithinRange(double minTime, double maxTime) -
updateTimePacket
-
updateTimeSettingsPacket
@Nonnull public static UpdateTimeSettings updateTimeSettingsPacket(@Nonnull UpdateTimeSettings settings, @Nonnull World world) -
isScaledDayTimeWithinRange
public boolean isScaledDayTimeWithinRange(double minTime, double maxTime) -
isYearWithinRange
public boolean isYearWithinRange(double minTime, double maxTime) -
getCurrentHour
public int getCurrentHour() -
getDayProgress
public float getDayProgress() -
getSunDirection
-
instantToInstantData
-
instantDataToInstant
-
clone
- Specified by:
clonein interfaceResource<EntityStore>- Overrides:
clonein classObject
-
toString
-