Record Class DistanceComparator<T>
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.DistanceComparator<T>
- All Implemented Interfaces:
Comparator<T>
public record DistanceComparator<T>(net.minecraft.world.phys.Vec3 origin, PositionGetter<T> position)
extends Record
implements Comparator<T>
-
Constructor Summary
ConstructorsConstructorDescriptionDistanceComparator(net.minecraft.world.phys.Vec3 origin, PositionGetter<T> position) Creates an instance of aDistanceComparatorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.phys.Vec3origin()Returns the value of theoriginrecord component.position()Returns the value of thepositionrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
DistanceComparator
Creates an instance of aDistanceComparatorrecord class.- Parameters:
origin- the value for theoriginrecord componentposition- the value for thepositionrecord component
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<T>
-
toString
-
hashCode
-
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 withObjects::equals(Object,Object).- Specified by:
equalsin interfaceComparator<T>- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
origin
public net.minecraft.world.phys.Vec3 origin()Returns the value of theoriginrecord component.- Returns:
- the value of the
originrecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-