Record Class DistanceEntitySorter
java.lang.Object
java.lang.Record
me.desht.pneumaticcraft.common.drone.ai.DistanceEntitySorter
- All Implemented Interfaces:
Comparator<net.minecraft.world.entity.Entity>
public record DistanceEntitySorter(IDroneBase drone)
extends Record
implements Comparator<net.minecraft.world.entity.Entity>
-
Constructor Summary
ConstructorsConstructorDescriptionDistanceEntitySorter(IDroneBase drone) Creates an instance of aDistanceEntitySorterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(net.minecraft.world.entity.Entity entity1, net.minecraft.world.entity.Entity entity2) drone()Returns the value of thedronerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
DistanceEntitySorter
Creates an instance of aDistanceEntitySorterrecord class.- Parameters:
drone- the value for thedronerecord component
-
-
Method Details
-
compare
public int compare(net.minecraft.world.entity.Entity entity1, net.minecraft.world.entity.Entity entity2) - Specified by:
comparein interfaceComparator<net.minecraft.world.entity.Entity>
-
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 withObjects::equals(Object,Object).- Specified by:
equalsin interfaceComparator<net.minecraft.world.entity.Entity>- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
drone
Returns the value of thedronerecord component.- Returns:
- the value of the
dronerecord component
-