Record Class DimensionLink
java.lang.Object
java.lang.Record
tech.anonymoushacker1279.openportals.portal.linking.DimensionLink
- Record Components:
pos1- The first portal position.pos2- The second portal position.
Represents a bidirectional link between two portal positions. The link works in both directions - you can travel from
pos1 to pos2, or from pos2 to pos1.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDimensionLink(DimensionalBlockPos pos1, DimensionalBlockPos pos2) Creates an instance of aDimensionLinkrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanconnects(DimensionalBlockPos position) Check if this link connects the given position.final booleanIndicates whether some other object is "equal to" this one.@Nullable DimensionalBlockPosgetDestination(DimensionalBlockPos source) Get the destination for the given source position.final inthashCode()Returns a hash code value for this object.pos1()Returns the value of thepos1record component.pos2()Returns the value of thepos2record component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
Method Details
-
connects
Check if this link connects the given position.- Parameters:
position- the position to check- Returns:
- true if this link connects to the given position
-
getDestination
Get the destination for the given source position. If the source is pos1, returns pos2. If the source is pos2, returns pos1.- Parameters:
source- the source position- Returns:
- the destination position, or null if source doesn't match either end
-
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). -
pos1
-
pos2
-