Package net.minestom.server.instance
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 opacitythunderLevel
- a percentage between 0 and 1 used to change how heavy the thunder is higher values further darken the sky
Represents the possible weather properties of an instance
-
Field Summary
-
Constructor Summary
ConstructorDescriptionWeather
(float rainLevel, float thunderLevel) Creates an instance of aWeather
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull Collection
<SendablePacket> final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
float
Returns the value of therainLevel
record component.float
Returns the value of thethunderLevel
record component.final String
toString()
Returns a string representation of this record class.@NotNull Weather
withRainLevel
(float rainLevel) @NotNull Weather
withRainLevel
(@NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator) @NotNull Weather
withThunderLevel
(float thunderLevel) @NotNull Weather
withThunderLevel
(@NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator)
-
Field Details
-
CLEAR
-
RAIN
-
THUNDER
-
-
Constructor Details
-
Weather
public Weather(float rainLevel, float thunderLevel) Creates an instance of aWeather
record class.- Parameters:
rainLevel
- the value for therainLevel
record componentthunderLevel
- the value for thethunderLevel
record component
-
-
Method Details
-
withRainLevel
-
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
-
withThunderLevel
@Contract(pure=true) @NotNull public @NotNull Weather withThunderLevel(@NotNull @NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator) -
createIsRainingPacket
-
createRainLevelPacket
-
createThunderLevelPacket
-
createWeatherPackets
-
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. -
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. -
equals
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 '=='. -
rainLevel
public float rainLevel()Returns the value of therainLevel
record component.- Returns:
- the value of the
rainLevel
record component
-
thunderLevel
public float thunderLevel()Returns the value of thethunderLevel
record component.- Returns:
- the value of the
thunderLevel
record component
-