Record Class Range

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.Range
All Implemented Interfaces:
net.minecraft.util.valueproviders.SampledFloat

public record Range(float min, float max) extends Record implements net.minecraft.util.valueproviders.SampledFloat
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<Range>
     
    static final DataType<Range>
     
    static final Range
     
    static final Range
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Range>
     
    static final Range
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Range(float min, float max)
    Creates an instance of a Range record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    float
    clamp(float value)
     
    float
    delta(float value)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    float
    get(float delta)
     
    final int
    Returns a hash code value for this object.
    boolean
     
    boolean
     
    float
    max()
    Returns the value of the max record component.
    float
    min()
    Returns the value of the min record component.
    static Range
    of(float value)
     
    static Range
    of(float min, float max)
     
    static @Nullable Range
    ofTag(net.minecraft.nbt.Tag nbt)
     
    float
    sample(net.minecraft.util.RandomSource random)
     
    Returns a string representation of this record class.
    net.minecraft.nbt.Tag
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZERO

      public static final Range ZERO
    • ONE

      public static final Range ONE
    • FULL

      public static final Range FULL
    • CODEC

      public static final com.mojang.serialization.Codec<Range> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Range> STREAM_CODEC
    • DATA_TYPE

      public static final DataType<Range> DATA_TYPE
  • Constructor Details

    • Range

      public Range(float min, float max)
      Creates an instance of a Range record class.
      Parameters:
      min - the value for the min record component
      max - the value for the max record component
  • Method Details

    • of

      public static Range of(float min, float max)
    • of

      public static Range of(float value)
    • ofTag

      @Nullable public static @Nullable Range ofTag(net.minecraft.nbt.Tag nbt)
    • toTag

      public net.minecraft.nbt.Tag toTag()
    • get

      public float get(float delta)
    • sample

      public float sample(net.minecraft.util.RandomSource random)
      Specified by:
      sample in interface net.minecraft.util.valueproviders.SampledFloat
    • delta

      public float delta(float value)
    • average

      public float average()
    • toString

      public 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
    • clamp

      public float clamp(float value)
    • isZero

      public boolean isZero()
    • isSame

      public boolean isSame()
    • 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 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.
    • min

      public float min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

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