Record Class VectorWrapper

java.lang.Object
java.lang.Record
de.eldoria.jacksonbukkit.entities.VectorWrapper

public record VectorWrapper(double xCoord, double yCoord, double zCoord) extends Record
Class for wrapping a Vector.

Allows creation of a Vector or BlockVector.

  • Constructor Details

    • VectorWrapper

      public VectorWrapper(double xCoord, double yCoord, double zCoord)
      Creates an instance of a VectorWrapper record class.
      Parameters:
      xCoord - the value for the xCoord record component
      yCoord - the value for the yCoord record component
      zCoord - the value for the zCoord record component
  • Method Details

    • of

      public static VectorWrapper of(Vector vector)
      Create a new VectorWrapper based on a Vector.
      Parameters:
      vector - vector instance
      Returns:
      new VectorWrapper instance
    • toBukkitVector

      public Vector toBukkitVector()
      Constructs a new Vector based on wrapper values.
      Returns:
      new Vector instance
    • toBukkitBlockVector

      public BlockVector toBukkitBlockVector()
      Constructs a new BlockVector based on wrapper values.
      Returns:
      new BlockVector instance
    • toString

      public final 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 '=='.
      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.
    • xCoord

      public double xCoord()
      Returns the value of the xCoord record component.
      Returns:
      the value of the xCoord record component
    • yCoord

      public double yCoord()
      Returns the value of the yCoord record component.
      Returns:
      the value of the yCoord record component
    • zCoord

      public double zCoord()
      Returns the value of the zCoord record component.
      Returns:
      the value of the zCoord record component