Class HardLookAtTargetGoal

java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
com.binaris.wizardry.content.entity.goal.HardLookAtTargetGoal

public class HardLookAtTargetGoal extends net.minecraft.world.entity.ai.goal.Goal
Helps a mob to look directly at its target with hard rotations, ignoring any smoothing that would normally be applied.

This is useful for spell-casting mobs that need to face their target precisely when casting spells that require direct line of sight. The goal limits the maximum rotation per tick to avoid instant snapping, creating a more natural look.

Behavior:

  • If the mob has a target, it will rotate to face it directly.
  • The rotation speed is limited by specified maximum yaw and pitch changes per tick to prevent instant snapping.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.entity.ai.goal.Goal

    net.minecraft.world.entity.ai.goal.Goal.Flag
  • Constructor Summary

    Constructors
    Constructor
    Description
    HardLookAtTargetGoal(net.minecraft.world.entity.PathfinderMob mob, float maxYawRotationPerTick, float maxPitchRotationPerTick)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     
    boolean
     
    void
     
    void
     

    Methods inherited from class net.minecraft.world.entity.ai.goal.Goal

    adjustedTickDelay, getFlags, isInterruptable, reducedTickDelay, setFlags, start, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HardLookAtTargetGoal

      public HardLookAtTargetGoal(net.minecraft.world.entity.PathfinderMob mob, float maxYawRotationPerTick, float maxPitchRotationPerTick)
      Constructor
      Parameters:
      mob - Mob that will use this goal
      maxYawRotationPerTick - Max horizontal rotation per tick (recommended: 10.0F)
      maxPitchRotationPerTick - Max vertical rotation per tick (recommended: 10.0F)
  • Method Details

    • canUse

      public boolean canUse()
      Specified by:
      canUse in class net.minecraft.world.entity.ai.goal.Goal
    • canContinueToUse

      public boolean canContinueToUse()
      Overrides:
      canContinueToUse in class net.minecraft.world.entity.ai.goal.Goal
    • requiresUpdateEveryTick

      public boolean requiresUpdateEveryTick()
      Overrides:
      requiresUpdateEveryTick in class net.minecraft.world.entity.ai.goal.Goal
    • stop

      public void stop()
      Overrides:
      stop in class net.minecraft.world.entity.ai.goal.Goal
    • tick

      public void tick()
      Overrides:
      tick in class net.minecraft.world.entity.ai.goal.Goal