Class TargetGoal

java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.target.TargetGoal
Direct Known Subclasses:
DefendVillageTargetGoal, HurtByTargetGoal, NearestAttackableTargetGoal, OwnerHurtByTargetGoal, OwnerHurtTargetGoal, TraderLlama.TraderLlamaDefendWanderingTraderGoal, Vex.VexCopyOwnerTargetGoal

public abstract class TargetGoal extends Goal
  • Field Details

    • EMPTY_REACH_CACHE

      private static final int EMPTY_REACH_CACHE
      See Also:
    • CAN_REACH_CACHE

      private static final int CAN_REACH_CACHE
      See Also:
    • CANT_REACH_CACHE

      private static final int CANT_REACH_CACHE
      See Also:
    • mob

      protected final Mob mob
      The entity that this goal belongs to
    • mustSee

      protected final boolean mustSee
    • mustReach

      private final boolean mustReach
    • reachCache

      private int reachCache
    • reachCacheTime

      private int reachCacheTime
    • unseenTicks

      private int unseenTicks
    • targetMob

      @Nullable protected LivingEntity targetMob
    • unseenMemoryTicks

      protected int unseenMemoryTicks
  • Constructor Details

    • TargetGoal

      public TargetGoal(Mob pMob, boolean pMustSee)
    • TargetGoal

      public TargetGoal(Mob pMob, boolean pMustSee, boolean pMustReach)
  • Method Details

    • canContinueToUse

      public boolean canContinueToUse()
      Overrides:
      canContinueToUse in class Goal
    • getFollowDistance

      protected double getFollowDistance()
    • start

      public void start()
      Overrides:
      start in class Goal
    • stop

      public void stop()
      Overrides:
      stop in class Goal
    • canAttack

      protected boolean canAttack(@Nullable LivingEntity pPotentialTarget, TargetingConditions pTargetPredicate)
      Checks if this is a suitable target.
    • canReach

      private boolean canReach(LivingEntity pTarget)
      Checks to see if this entity can find a short path to the given target.
    • setUnseenMemoryTicks

      public TargetGoal setUnseenMemoryTicks(int pUnseenMemoryTicks)