Record Class WorldCoordinate

java.lang.Object
java.lang.Record
net.minecraft.commands.arguments.coordinates.WorldCoordinate

public record WorldCoordinate(boolean relative, double value) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType
     
    static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType
     
    private static final char
     
    private final boolean
    The field for the relative record component.
    private final double
    The field for the value record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorldCoordinate(boolean relative, double value)
    Creates an instance of a WorldCoordinate record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    get(double pCoord)
     
    final int
    Returns a hash code value for this object.
    boolean
     
    static boolean
    isRelative(com.mojang.brigadier.StringReader pReader)
     
    parseDouble(com.mojang.brigadier.StringReader pReader, boolean pCenterCorrect)
     
    parseInt(com.mojang.brigadier.StringReader pReader)
     
    boolean
    Returns the value of the relative record component.
    final String
    Returns a string representation of this record class.
    double
    Returns the value of the value record component.

    Methods inherited from class java.lang.Object

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

    • relative

      private final boolean relative
      The field for the relative record component.
    • value

      private final double value
      The field for the value record component.
    • PREFIX_RELATIVE

      private static final char PREFIX_RELATIVE
      See Also:
    • ERROR_EXPECTED_DOUBLE

      public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType ERROR_EXPECTED_DOUBLE
    • ERROR_EXPECTED_INT

      public static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType ERROR_EXPECTED_INT
  • Constructor Details

    • WorldCoordinate

      public WorldCoordinate(boolean relative, double value)
      Creates an instance of a WorldCoordinate record class.
      Parameters:
      relative - the value for the relative record component
      value - the value for the value record component
  • Method Details

    • get

      public double get(double pCoord)
    • parseDouble

      public static WorldCoordinate parseDouble(com.mojang.brigadier.StringReader pReader, boolean pCenterCorrect) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • parseInt

      public static WorldCoordinate parseInt(com.mojang.brigadier.StringReader pReader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • isRelative

      public static boolean isRelative(com.mojang.brigadier.StringReader pReader)
    • isRelative

      public boolean isRelative()
    • 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.
    • relative

      public boolean relative()
      Returns the value of the relative record component.
      Returns:
      the value of the relative record component
    • value

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