Record Class RaycastResult

java.lang.Object
java.lang.Record
io.hymods.lib.data.RaycastResult

public record RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, com.hypixel.hytale.math.vector.Vector3d blockPosition, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef, String entityName, RaycastResult.HitType hitType) extends Record
Result of a raycast operation containing hit information
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enum representing the type of hit
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final RaycastResult
    Constant representing a miss (no hit)
  • Constructor Summary

    Constructors
    Constructor
    Description
    RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef, String entityName)
    Constructor for an entity hit
    RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, com.hypixel.hytale.math.vector.Vector3d blockPosition)
    Constructor for a block hit
    RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, com.hypixel.hytale.math.vector.Vector3d blockPosition, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef, String entityName, RaycastResult.HitType hitType)
    Creates an instance of a RaycastResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.math.vector.Vector3d
    Returns the value of the blockPosition record component.
    com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType
    Returns the value of the blockType record component.
    double
    Returns the value of the distance record component.
    Returns the value of the entityName record component.
    com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>
    Returns the value of the entityRef record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    com.hypixel.hytale.math.vector.Vector3d
    Returns the value of the hitPosition record component.
    Returns the value of the hitType record component.
    boolean
    Checks if the raycast hit a block
    boolean
    Checks if the raycast hit an entity
    boolean
    Checks if the raycast resulted in a hit (either block or entity)
    boolean
    Checks if the raycast resulted in a miss
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • MISS

      public static final RaycastResult MISS
      Constant representing a miss (no hit)
  • Constructor Details

    • RaycastResult

      public RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, com.hypixel.hytale.math.vector.Vector3d blockPosition)
      Constructor for a block hit
    • RaycastResult

      public RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef, String entityName)
      Constructor for an entity hit
    • RaycastResult

      public RaycastResult(com.hypixel.hytale.math.vector.Vector3d hitPosition, double distance, com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, com.hypixel.hytale.math.vector.Vector3d blockPosition, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef, String entityName, RaycastResult.HitType hitType)
      Creates an instance of a RaycastResult record class.
      Parameters:
      hitPosition - the value for the hitPosition record component
      distance - the value for the distance record component
      blockType - the value for the blockType record component
      blockPosition - the value for the blockPosition record component
      entityRef - the value for the entityRef record component
      entityName - the value for the entityName record component
      hitType - the value for the hitType record component
  • Method Details

    • isMiss

      public boolean isMiss()
      Checks if the raycast resulted in a miss
    • isHit

      public boolean isHit()
      Checks if the raycast resulted in a hit (either block or entity)
    • isBlockHit

      public boolean isBlockHit()
      Checks if the raycast hit a block
    • isEntityHit

      public boolean isEntityHit()
      Checks if the raycast hit an entity
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • hitPosition

      public com.hypixel.hytale.math.vector.Vector3d hitPosition()
      Returns the value of the hitPosition record component.
      Returns:
      the value of the hitPosition record component
    • distance

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

      public com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType()
      Returns the value of the blockType record component.
      Returns:
      the value of the blockType record component
    • blockPosition

      public com.hypixel.hytale.math.vector.Vector3d blockPosition()
      Returns the value of the blockPosition record component.
      Returns:
      the value of the blockPosition record component
    • entityRef

      public com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef()
      Returns the value of the entityRef record component.
      Returns:
      the value of the entityRef record component
    • entityName

      public String entityName()
      Returns the value of the entityName record component.
      Returns:
      the value of the entityName record component
    • hitType

      public RaycastResult.HitType hitType()
      Returns the value of the hitType record component.
      Returns:
      the value of the hitType record component