Class WeatherTracker

java.lang.Object
com.hypixel.hytale.builtin.weather.components.WeatherTracker
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class WeatherTracker extends Object implements Component<EntityStore>
  • Constructor Details

    • WeatherTracker

      public WeatherTracker()
  • Method Details

    • getComponentType

      public static ComponentType<EntityStore, WeatherTracker> getComponentType()
    • updateWeather

      public void updateWeather(@Nonnull PlayerRef playerRef, @Nonnull WeatherResource weatherComponent, @Nonnull TransformComponent transformComponent, float transitionSeconds, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • sendWeatherIndex

      public void sendWeatherIndex(@Nonnull PlayerRef playerRef, int weatherIndex, float transitionSeconds)
    • consumeFirstSendForWorld

      public boolean consumeFirstSendForWorld()
    • clear

      public void clear()
    • setOverrideWeatherIndex

      public void setOverrideWeatherIndex(int weatherIndex)
    • clearOverrideWeatherIndex

      public void clearOverrideWeatherIndex()
    • tryClaimOverride

      public boolean tryClaimOverride(@Nonnull Ref<EntityStore> owner, int weatherIndex)
      Claims the override for the given entity, or refreshes it if that entity already holds it. The claim fails while another live entity holds the override.
      Returns:
      true when the override now belongs to the given owner.
    • releaseOverride

      public boolean releaseOverride(@Nonnull Ref<EntityStore> owner)
      Drops the override if the given entity still holds it.
      Returns:
      true when the override was released, false when the caller had already lost it.
    • resolveUnoverriddenWeatherIndex

      public int resolveUnoverriddenWeatherIndex(@Nonnull WeatherResource weatherResource, @Nullable TransformComponent transformComponent, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Resolves what this player should see with no override active: the world's forced weather, otherwise the environment weather at their position. The environment is recomputed first because the override path skips updateEnvironment(TransformComponent, ComponentAccessor), so the cached environment can be stale.

      The result can be AssetMapWithIndexes.NOT_FOUND or Weather.UNKNOWN_ID, which callers must not send.

    • updateEnvironment

      public void updateEnvironment(@Nonnull TransformComponent transformComponent, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • getEnvironmentId

      public int getEnvironmentId()
    • getWeatherIndex

      public int getWeatherIndex()
    • setWeatherIndex

      public void setWeatherIndex(@Nonnull PlayerRef playerRef, int weatherIndex)
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.