Class TargetGoal

java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
com.pixelmonmod.pixelmon.ai.TargetGoal
Direct Known Subclasses:
TargetNearestGoal

public abstract class TargetGoal extends net.minecraft.world.entity.ai.goal.Goal
Causes the entity to approach another entity.
  • Nested Class Summary

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    If true, EntityAI targets must be able to be seen (cannot be blocked by walls) to be suitable targets.
    protected float
    The distance that the entity can see a target from.
    protected net.minecraft.world.entity.Mob
    The entity that this task belongs to
  • Constructor Summary

    Constructors
    Constructor
    Description
    TargetGoal(PixelmonEntity par1EntityLiving, float targetDistance, boolean shouldCheckSight)
    Initializes a targeting AI.
    TargetGoal(net.minecraft.world.entity.Mob entity, float targetDistance, boolean shouldCheckSight, boolean mustReach)
    Initializes a targeting AI.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether an in-progress EntityAIBase should continue executing.
    protected boolean
    isSuitableTarget(net.minecraft.world.entity.LivingEntity entity, boolean targetInvulnerable)
    A method used to see if an entity is a suitable target through a number of checks.
    void
    Execute a one-shot task or start executing a continuous task.
    void
    Resets the task.
    void
     

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

    adjustedTickDelay, canUse, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, toString

    Methods inherited from class java.lang.Object

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

    • taskOwner

      protected net.minecraft.world.entity.Mob taskOwner
      The entity that this task belongs to
    • targetDistance

      protected float targetDistance
      The distance that the entity can see a target from.
    • shouldCheckSight

      protected boolean shouldCheckSight
      If true, EntityAI targets must be able to be seen (cannot be blocked by walls) to be suitable targets.
  • Constructor Details

    • TargetGoal

      public TargetGoal(PixelmonEntity par1EntityLiving, float targetDistance, boolean shouldCheckSight)
      Initializes a targeting AI.
      Parameters:
      par1EntityLiving - The Pokémon to give the targeting AI to.
      targetDistance - The distance that the entity can see a target from.
      shouldCheckSight - Whether targets must be visible to the entity to be targeted.
    • TargetGoal

      public TargetGoal(net.minecraft.world.entity.Mob entity, float targetDistance, boolean shouldCheckSight, boolean mustReach)
      Initializes a targeting AI.
      Parameters:
      entity - The entity to give the targeting AI to.
      targetDistance - The distance that the entity can see a target from.
      shouldCheckSight - Whether targets must be visible to the entity to be targeted.
      mustReach - Whether to check if the entity can reach its target.
  • Method Details

    • canContinueToUse

      public boolean canContinueToUse()
      Returns whether an in-progress EntityAIBase should continue executing.
      Overrides:
      canContinueToUse in class net.minecraft.world.entity.ai.goal.Goal
      Returns:
      Whether an in-progress EntityAIBase should continue executing.
    • start

      public void start()
      Execute a one-shot task or start executing a continuous task.
      Overrides:
      start in class net.minecraft.world.entity.ai.goal.Goal
    • stop

      public void stop()
      Resets the task.
      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
    • isSuitableTarget

      protected boolean isSuitableTarget(net.minecraft.world.entity.LivingEntity entity, boolean targetInvulnerable)
      A method used to see if an entity is a suitable target through a number of checks.
      Parameters:
      entity - The entity to check for being a suitable target.
      targetInvulnerable - Whether to target players that are invincible.
      Returns:
      Whether the entity is a suitable target.