WorldTimeResource

public class WorldTimeResource implements Resource

Class WorldTimeResource. Provides worldtimeresource functionality for the Hytale server.

java.lang.Object > WorldTimeResource

Field Summary

gameTime

private Instant gameTime

Field gameTime.

_gameTimeLocalDateTime

private LocalDateTime _gameTimeLocalDateTime

Field _gameTimeLocalDateTime.

currentHour

private int currentHour

Field currentHour.

sunlightFactor

private double sunlightFactor

Field sunlightFactor.

scaledTime

private double scaledTime

Field scaledTime.

moonPhase

private int moonPhase

Field moonPhase.

daytimeDurationSeconds

final int daytimeDurationSeconds

Field daytimeDurationSeconds.

nighttimeDurationSeconds

final int nighttimeDurationSeconds

Field nighttimeDurationSeconds.

totalDurationSeconds

final int totalDurationSeconds

Field totalDurationSeconds.

world

final World world

Field world.

wasTimePausedChanged

final boolean wasTimePausedChanged

Field wasTimePausedChanged.

secondsOfDay

final int secondsOfDay

Field secondsOfDay.

daytimeRate

final double daytimeRate

Field daytimeRate.

nighttimeRate

final double nighttimeRate

Field nighttimeRate.

x2

final double x2

Field x2.

whole

final long whole

Field whole.

m0

final double m0

Field m0.

m2

final double m2

Field m2.

f0

final double f0

Field f0.

f2

final double f2

Field f2.

advance

final double advance

Field advance.

event

final MoonPhaseChangeEvent event

Field event.

worldGameplayConfig

final WorldConfig worldGameplayConfig

Field worldGameplayConfig.

totalMoonPhases

final int totalMoonPhases

Field totalMoonPhases.

dayProgress

final double dayProgress

Field dayProgress.

currentDay

final int currentDay

Field currentDay.

weekDay

final int weekDay

Field weekDay.

dayDuration

final float dayDuration

Field dayDuration.

nightDuration

final float nightDuration

Field nightDuration.

halfNight

final float halfNight

Field halfNight.

dawnRelativeProgress

final float dawnRelativeProgress

Field dawnRelativeProgress.

oldGameTime

final Instant oldGameTime

Field oldGameTime.

dayStart

final Instant dayStart

Field dayStart.

newGameTime

final Instant newGameTime

Field newGameTime.

dayTime

final float dayTime

Field dayTime.

daylightDuration

final float daylightDuration

Field daylightDuration.

halfNightDuration

final float halfNightDuration

Field halfNightDuration.

inverseAllNightDay

final float inverseAllNightDay

Field inverseAllNightDay.

halfDaylightDuration

final float halfDaylightDuration

Field halfDaylightDuration.

inverseAllDaylightDay

final float inverseAllDaylightDay

Field inverseAllDaylightDay.

sunPosition

final Vector3f sunPosition

Field sunPosition.

tweakedSunHeight

final float tweakedSunHeight

Field tweakedSunHeight.

worldTimeComponent

final WorldTimeResource worldTimeComponent

Field worldTimeComponent.

Method Detail

WorldTimeResource

public public WorldTimeResource ()

Method WorldTimeResource.

getResourceType

public WorldTimeResource> getResourceType ()

Method getResourceType.

getSecondsPerTick

static double getSecondsPerTick (final World world)

Method getSecondsPerTick.

Parameters:
final World world

tick

public void tick (final float dt, @Nonnull final Store store)

Method tick.

Parameters:
final float dt
@Nonnull final Store store

getMoonPhase

public int getMoonPhase ()

Method getMoonPhase.

setMoonPhase

public void setMoonPhase (final int moonPhase, @Nonnull final ComponentAccessor componentAccessor)

Method setMoonPhase.

Parameters:
final int moonPhase
@Nonnull final ComponentAccessor componentAccessor

updateMoonPhase

public void updateMoonPhase (@Nonnull final World world, @Nonnull final ComponentAccessor componentAccessor)

Method updateMoonPhase.

Parameters:
@Nonnull final World world
@Nonnull final ComponentAccessor componentAccessor

isMoonPhaseWithinRange

public boolean isMoonPhaseWithinRange (@Nonnull final World world, final int minMoonPhase, final int maxMoonPhase)

Method isMoonPhaseWithinRange.

Parameters:
@Nonnull final World world
final int minMoonPhase
final int maxMoonPhase

setGameTime0

public void setGameTime0 (@Nonnull final Instant gameTime)

Method setGameTime0.

Parameters:
@Nonnull final Instant gameTime

updateSunlightFactor

private void updateSunlightFactor (final int dayProgress, final float halfNight)

Method updateSunlightFactor.

Parameters:
final int dayProgress
final float halfNight

updateScaledTime

private void updateScaledTime (float dayProgress, final float dayDuration, final float halfNight)

Method updateScaledTime.

Parameters:
float dayProgress
final float dayDuration
final float halfNight

getGameTime

public Instant getGameTime ()

Method getGameTime.

getGameDateTime

public LocalDateTime getGameDateTime ()

Method getGameDateTime.

getSunlightFactor

public double getSunlightFactor ()

Method getSunlightFactor.

setGameTime

public void setGameTime (@Nonnull final Instant gameTime, @Nonnull final World world, @Nonnull final Store store)

Method setGameTime.

Parameters:
@Nonnull final Instant gameTime
@Nonnull final World world
@Nonnull final Store store

setDayTime

public void setDayTime (final double dayTime, @Nonnull final World world, @Nonnull final Store store)

Method setDayTime.

Parameters:
final double dayTime
@Nonnull final World world
@Nonnull final Store store

broadcastTimePacket

public void broadcastTimePacket (@Nonnull final Store store)

Method broadcastTimePacket.

Parameters:
@Nonnull final Store store

sendTimePackets

public void sendTimePackets (@Nonnull final PlayerRef playerRef)

Method sendTimePackets.

Parameters:
@Nonnull final PlayerRef playerRef

isDayTimeWithinRange

public boolean isDayTimeWithinRange (final double minTime, final double maxTime)

Method isDayTimeWithinRange.

Parameters:
final double minTime
final double maxTime

updateTimePacket

public void updateTimePacket (@Nonnull final UpdateTime currentTimePacket)

Method updateTimePacket.

Parameters:
@Nonnull final UpdateTime currentTimePacket

updateTimeSettingsPacket

static UpdateTimeSettings updateTimeSettingsPacket (@Nonnull final UpdateTimeSettings settings, @Nonnull final World world)

Method updateTimeSettingsPacket.

Parameters:
@Nonnull final UpdateTimeSettings settings
@Nonnull final World world

isScaledDayTimeWithinRange

public boolean isScaledDayTimeWithinRange (final double minTime, final double maxTime)

Method isScaledDayTimeWithinRange.

Parameters:
final double minTime
final double maxTime

isYearWithinRange

public boolean isYearWithinRange (final double minTime, final double maxTime)

Method isYearWithinRange.

Parameters:
final double minTime
final double maxTime

getCurrentHour

public int getCurrentHour ()

Method getCurrentHour.

getDayProgress

public float getDayProgress ()

Method getDayProgress.

getSunDirection

public Vector3f getSunDirection ()

Method getSunDirection.

if

public else if (dayTime > WorldTimeResource.HOURS_PER_DAY - halfNightDuration)

Method if.

Parameters:
dayTime > WorldTimeResource.HOURS_PER_DAY - halfNightDuration

Vector3f

public new Vector3f (TrigMathUtil.cos(sunAngle)

Method Vector3f.

Parameters:
TrigMathUtil.cos(sunAngle TrigMathUtil.cos(sunAngle

instantToInstantData

static InstantData instantToInstantData (@Nonnull final Instant instant)

Method instantToInstantData.

Parameters:
@Nonnull final Instant instant

instantDataToInstant

static Instant instantDataToInstant (@Nonnull final InstantData instantData)

Method instantDataToInstant.

Parameters:
@Nonnull final InstantData instantData

clone

public Resource clone ()

Method clone.

toString

public String toString ()

Method toString.