Package com.pixelmonmod.pixelmon.ai
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
Modifier and TypeFieldDescriptionprotected 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
ConstructorDescriptionTargetGoal
(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 TypeMethodDescriptionboolean
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
start()
Execute a one-shot task or start executing a continuous task.void
stop()
Resets the task.void
tick()
Methods inherited from class net.minecraft.world.entity.ai.goal.Goal
adjustedTickDelay, canUse, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, toString
-
Field Details
-
taskOwner
protected net.minecraft.world.entity.Mob taskOwnerThe entity that this task belongs to -
targetDistance
protected float targetDistanceThe distance that the entity can see a target from. -
shouldCheckSight
protected boolean shouldCheckSightIf true, EntityAI targets must be able to be seen (cannot be blocked by walls) to be suitable targets.
-
-
Constructor Details
-
TargetGoal
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 classnet.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 classnet.minecraft.world.entity.ai.goal.Goal
-
stop
public void stop()Resets the task.- Overrides:
stop
in classnet.minecraft.world.entity.ai.goal.Goal
-
tick
public void tick()- Overrides:
tick
in classnet.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.
-