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 ClassesModifier and TypeClassDescriptionstatic enumEnum representing the type of hit -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RaycastResultConstant representing a miss (no hit) -
Constructor Summary
ConstructorsConstructorDescriptionRaycastResult(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 hitRaycastResult(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 hitRaycastResult(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 aRaycastResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.math.vector.Vector3dReturns the value of theblockPositionrecord component.com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockTypeReturns the value of theblockTyperecord component.doubledistance()Returns the value of thedistancerecord component.Returns the value of theentityNamerecord component.com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> Returns the value of theentityRefrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.com.hypixel.hytale.math.vector.Vector3dReturns the value of thehitPositionrecord component.hitType()Returns the value of thehitTyperecord component.booleanChecks if the raycast hit a blockbooleanChecks if the raycast hit an entitybooleanisHit()Checks if the raycast resulted in a hit (either block or entity)booleanisMiss()Checks if the raycast resulted in a missfinal StringtoString()Returns a string representation of this record class.
-
Field Details
-
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 aRaycastResultrecord class.- Parameters:
hitPosition- the value for thehitPositionrecord componentdistance- the value for thedistancerecord componentblockType- the value for theblockTyperecord componentblockPosition- the value for theblockPositionrecord componententityRef- the value for theentityRefrecord componententityName- the value for theentityNamerecord componenthitType- the value for thehitTyperecord 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
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
hitPosition
public com.hypixel.hytale.math.vector.Vector3d hitPosition()Returns the value of thehitPositionrecord component.- Returns:
- the value of the
hitPositionrecord component
-
distance
public double distance()Returns the value of thedistancerecord component.- Returns:
- the value of the
distancerecord component
-
blockType
public com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType()Returns the value of theblockTyperecord component.- Returns:
- the value of the
blockTyperecord component
-
blockPosition
public com.hypixel.hytale.math.vector.Vector3d blockPosition()Returns the value of theblockPositionrecord component.- Returns:
- the value of the
blockPositionrecord component
-
entityRef
public com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entityRef()Returns the value of theentityRefrecord component.- Returns:
- the value of the
entityRefrecord component
-
entityName
Returns the value of theentityNamerecord component.- Returns:
- the value of the
entityNamerecord component
-
hitType
Returns the value of thehitTyperecord component.- Returns:
- the value of the
hitTyperecord component
-