Record Class InclusiveRange<T extends Comparable<T>>

java.lang.Object
java.lang.Record
net.minecraft.util.InclusiveRange<T>

public record InclusiveRange<T extends Comparable<T>>(T extends Comparable<T> minInclusive, T extends Comparable<T> maxInclusive) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<InclusiveRange<Integer>>
     
    private final T
    The field for the maxInclusive record component.
    private final T
    The field for the minInclusive record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    InclusiveRange(T minInclusive, T maxInclusive)
    Creates an instance of a InclusiveRange record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Comparable<T>>
    com.mojang.serialization.Codec<InclusiveRange<T>>
    codec(com.mojang.serialization.Codec<T> p_184573_)
     
    static <T extends Comparable<T>>
    com.mojang.serialization.Codec<InclusiveRange<T>>
    codec(com.mojang.serialization.Codec<T> p_184575_, T p_184576_, T p_184577_)
     
    boolean
     
    static <T extends Comparable<T>>
    com.mojang.serialization.DataResult<InclusiveRange<T>>
    create(T p_184581_, T p_184582_)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    isValueInRange(T p_184579_)
     
    Returns the value of the maxInclusive record component.
    Returns the value of the minInclusive record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • minInclusive

      private final T extends Comparable<T> minInclusive
      The field for the minInclusive record component.
    • maxInclusive

      private final T extends Comparable<T> maxInclusive
      The field for the maxInclusive record component.
    • INT

      public static final com.mojang.serialization.Codec<InclusiveRange<Integer>> INT
  • Constructor Details

    • InclusiveRange

      public InclusiveRange(T minInclusive, T maxInclusive)
      Creates an instance of a InclusiveRange record class.
      Parameters:
      minInclusive - the value for the minInclusive record component
      maxInclusive - the value for the maxInclusive record component
  • Method Details

    • codec

      public static <T extends Comparable<T>> com.mojang.serialization.Codec<InclusiveRange<T>> codec(com.mojang.serialization.Codec<T> p_184573_)
    • codec

      public static <T extends Comparable<T>> com.mojang.serialization.Codec<InclusiveRange<T>> codec(com.mojang.serialization.Codec<T> p_184575_, T p_184576_, T p_184577_)
    • create

      public static <T extends Comparable<T>> com.mojang.serialization.DataResult<InclusiveRange<T>> create(T p_184581_, T p_184582_)
    • isValueInRange

      public boolean isValueInRange(T p_184579_)
    • contains

      public boolean contains(InclusiveRange<T> p_184571_)
    • 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
    • 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 Objects::equals(Object,Object).
      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.
    • minInclusive

      public T minInclusive()
      Returns the value of the minInclusive record component.
      Returns:
      the value of the minInclusive record component
    • maxInclusive

      public T maxInclusive()
      Returns the value of the maxInclusive record component.
      Returns:
      the value of the maxInclusive record component