Record Class Weather

java.lang.Object
java.lang.Record
net.minestom.server.instance.Weather
Record Components:
rainLevel - a percentage between 0 and 1 used to change how heavy the rain is higher values darken the sky and increase rain opacity
thunderLevel - a percentage between 0 and 1 used to change how heavy the thunder is higher values further darken the sky

public record Weather(float rainLevel, float thunderLevel) extends Record
Represents the possible weather properties of an instance
  • Field Details

    • CLEAR

      public static final Weather CLEAR
    • RAIN

      public static final Weather RAIN
    • THUNDER

      public static final Weather THUNDER
  • Constructor Details

    • Weather

      public Weather(float rainLevel, float thunderLevel)
      Creates an instance of a Weather record class.
      Parameters:
      rainLevel - the value for the rainLevel record component
      thunderLevel - the value for the thunderLevel record component
  • Method Details

    • withRainLevel

      @Contract(pure=true) @NotNull public @NotNull Weather withRainLevel(float rainLevel)
    • isRaining

      public boolean isRaining()
      Returns:
      true if rainLevel is > 0
    • withRainLevel

      @Contract(pure=true) @NotNull public @NotNull Weather withRainLevel(@NotNull @NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator)
    • withThunderLevel

      @Contract(pure=true) @NotNull public @NotNull Weather withThunderLevel(float thunderLevel)
    • withThunderLevel

      @Contract(pure=true) @NotNull public @NotNull Weather withThunderLevel(@NotNull @NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator)
    • createIsRainingPacket

      public ChangeGameStatePacket createIsRainingPacket()
    • createRainLevelPacket

      public ChangeGameStatePacket createRainLevelPacket()
    • createThunderLevelPacket

      public ChangeGameStatePacket createThunderLevelPacket()
    • createWeatherPackets

      @NotNull public @NotNull Collection<SendablePacket> createWeatherPackets()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • rainLevel

      public float rainLevel()
      Returns the value of the rainLevel record component.
      Returns:
      the value of the rainLevel record component
    • thunderLevel

      public float thunderLevel()
      Returns the value of the thunderLevel record component.
      Returns:
      the value of the thunderLevel record component