Record Class BiomeDefinition

java.lang.Object
java.lang.Record
fr.fidorial.world.biome.BiomeDefinition
Record Components:
key - the namespaced identifier of the biome
hasPrecipitation - whether rain or snow may fall
temperature - biome temperature, driving snow, freezing water and the default colors
temperatureModifier - how the client reinterprets temperature
downfall - humidity, within [0, 1], driving the default foliage colors
effects - the client-side tinting
attributes - the environment attributes this biome sets, possibly empty
All Implemented Interfaces:
Biome, Keyed

public record BiomeDefinition(Key key, boolean hasPrecipitation, float temperature, TemperatureModifier temperatureModifier, float downfall, BiomeEffects effects, EnvironmentAttributes attributes) extends Record implements Biome
A complete biome definition, ready to be sent to clients.
Since:
0.1.0
  • Constructor Details

    • BiomeDefinition

      public BiomeDefinition(Key key, boolean hasPrecipitation, float temperature, TemperatureModifier temperatureModifier, float downfall, BiomeEffects effects, EnvironmentAttributes attributes)
      Creates an instance of a BiomeDefinition record class.
      Parameters:
      key - the value for the key record component
      hasPrecipitation - the value for the hasPrecipitation record component
      temperature - the value for the temperature record component
      temperatureModifier - the value for the temperatureModifier record component
      downfall - the value for the downfall record component
      effects - the value for the effects record component
      attributes - the value for the attributes record component
  • Method Details

    • builder

      @Contract(value="_ -> new", pure=true) public static BiomeBuilder builder(Key key)
      Returns a new builder for the biome identified by key.
      Parameters:
      key - the namespaced identifier of the biome
      Returns:
      a new builder for the biome identified by key
    • builder

      @Contract(value="_ -> new", pure=true) public static BiomeBuilder builder(BiomeDefinition definition)
      Returns a new builder pre-filled with the values of definition.
      Parameters:
      definition - the definition to copy
      Returns:
      a new builder pre-filled with the values of definition
    • typedKey

      @Contract(value="-> new", pure=true) public TypedKey<Biome> typedKey()
      Returns this biome's key, typed against the minecraft:worldgen/biome registry.
      Returns:
      this biome's key, typed against the minecraft:worldgen/biome registry
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • key

      public Key key()
      Returns the value of the key record component.
      Specified by:
      key in interface Keyed
      Returns:
      the value of the key record component
    • hasPrecipitation

      public boolean hasPrecipitation()
      Returns the value of the hasPrecipitation record component.
      Returns:
      the value of the hasPrecipitation record component
    • temperature

      public float temperature()
      Returns the value of the temperature record component.
      Returns:
      the value of the temperature record component
    • temperatureModifier

      public TemperatureModifier temperatureModifier()
      Returns the value of the temperatureModifier record component.
      Returns:
      the value of the temperatureModifier record component
    • downfall

      public float downfall()
      Returns the value of the downfall record component.
      Returns:
      the value of the downfall record component
    • effects

      public BiomeEffects effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component
    • attributes

      public EnvironmentAttributes attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component