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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWeather(float rainLevel, float thunderLevel) Creates an instance of aWeatherrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull Collection<SendablePacket> final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanfloatReturns the value of therainLevelrecord component.floatReturns the value of thethunderLevelrecord component.final StringtoString()Returns a string representation of this record class.@NotNull WeatherwithRainLevel(float rainLevel) @NotNull WeatherwithRainLevel(@NotNull it.unimi.dsi.fastutil.floats.FloatUnaryOperator operator) @NotNull WeatherwithThunderLevel(float thunderLevel) @NotNull WeatherwithThunderLevel(@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 aWeatherrecord class.- Parameters:
rainLevel- the value for therainLevelrecord componentthunderLevel- the value for thethunderLevelrecord component
-
-
Method Details
-
withRainLevel
-
isRaining
public boolean isRaining()- Returns:
- true if
rainLevelis > 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 therainLevelrecord component.- Returns:
- the value of the
rainLevelrecord component
-
thunderLevel
public float thunderLevel()Returns the value of thethunderLevelrecord component.- Returns:
- the value of the
thunderLevelrecord component
-