Class WorldTimeResource

java.lang.Object
com.hypixel.hytale.server.core.modules.time.WorldTimeResource
All Implemented Interfaces:
Resource<EntityStore>, Cloneable

public class WorldTimeResource extends Object implements Resource<EntityStore>
  • 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

      public static final Instant ZERO_YEAR
    • MAX_TIME

      public static final Instant MAX_TIME
    • ZONE_OFFSET

      public static final ZoneOffset 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

      @Nonnull private final UpdateTime currentTimePacket
    • gameTime

      private Instant gameTime
    • _gameTimeLocalDateTime

      private LocalDateTime _gameTimeLocalDateTime
    • currentHour

      private int currentHour
    • sunlightFactor

      private double sunlightFactor
    • scaledTime

      private double scaledTime
    • moonPhase

      private int moonPhase
    • currentSettings

      @Nonnull private final UpdateTimeSettings currentSettings
    • tempSettings

      @Nonnull private final UpdateTimeSettings tempSettings
  • Constructor Details

    • WorldTimeResource

      public WorldTimeResource()
  • Method Details

    • getResourceType

      @Nonnull public static ResourceType<EntityStore,WorldTimeResource> getResourceType()
    • getSecondsPerTick

      public static double getSecondsPerTick(World world)
    • tick

      public void tick(float dt, @Nonnull Store<EntityStore> store)
    • getMoonPhase

      public int getMoonPhase()
    • setMoonPhase

      public void setMoonPhase(int moonPhase, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • updateMoonPhase

      public void updateMoonPhase(@Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • isMoonPhaseWithinRange

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

      public void setGameTime0(@Nonnull Instant gameTime)
    • updateSunlightFactor

      private void updateSunlightFactor(int dayProgress, float halfNight)
    • updateScaledTime

      private void updateScaledTime(float dayProgress, float dayDuration, float halfNight)
    • getGameTime

      public Instant getGameTime()
    • getGameDateTime

      public LocalDateTime getGameDateTime()
    • getSunlightFactor

      public double getSunlightFactor()
    • setGameTime

      public void setGameTime(@Nonnull Instant gameTime, @Nonnull World world, @Nonnull Store<EntityStore> store)
    • setDayTime

      public void setDayTime(double dayTime, @Nonnull World world, @Nonnull Store<EntityStore> store)
    • broadcastTimePacket

      public void broadcastTimePacket(@Nonnull Store<EntityStore> store)
    • sendTimePackets

      public void sendTimePackets(@Nonnull PlayerRef playerRef)
    • isDayTimeWithinRange

      public boolean isDayTimeWithinRange(double minTime, double maxTime)
    • updateTimePacket

      public void updateTimePacket(@Nonnull UpdateTime currentTimePacket)
    • 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

      @Nonnull public Vector3f getSunDirection()
    • instantToInstantData

      @Nonnull public static InstantData instantToInstantData(@Nonnull Instant instant)
    • instantDataToInstant

      @Nonnull public static Instant instantDataToInstant(@Nonnull InstantData instantData)
    • clone

      @Nonnull public Resource<EntityStore> clone()
      Specified by:
      clone in interface Resource<EntityStore>
      Overrides:
      clone in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object