Skip to content

HitResultHelper.Entity ​

com.jsmacrosce.jsmacros.client.api.helper.world.HitResultHelper.Entity

Since1.9.1

A target that carries the entity and the hit location recorded by the hit result.

js
const interactions = Player.interactions();  
const target = interactions === null ? null : interactions.getTarget();  
if (target instanceof HitResults.Entity) {
  Chat.log(`the crosshair is on ${target.getEntity().getName()}`);  
}

Available in scripts as HitResults.Entity.

Nested type declared in HitResultHelper.

Constructors ​

new HitResultHelper.Entity ​

new HitResultHelper.Entity(EntityHitResult base)#
Wraps the supplied entity hit result.

Parameters:

  • base: entity hit result to wrap

Methods ​

asEntity ​

Returns this entity-hit helper.
Returns: this entity-hit helper

getEntity ​

getEntity(): EntityHelper<?>Since1.9.1#
The hit entity wrapped in its matching EntityHelper subtype.
Returns: the hit entity wrapped in its matching helper subtype.

toString ​

toString(): String#
Returns a diagnostic containing the hit position and entity type identifier.
Returns: a diagnostic with the position and the value from EntityHelper.getType()