EntityAIOwnerHurtTarget .java

net.minecraft.entity.ai.EntityAIOwnerHurtTarget (class, 61 lines): members: theEntityTameable, field_142050_e, theTarget, startExecuting, shouldExecute.

net.minecraft.entity.aiclass61 linescommonextends EntityAITarget1.7 KB

API Surface (2)

boolean shouldExecute()
void startExecuting()

Fields & Constants (3)

theEntityTameable
theTarget
field_142050_e

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntityAIOwnerHurtTarget.java61 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.ai;
2
3
import net.minecraft.entity.EntityLivingBase;
4
import net.minecraft.entity.passive.EntityTameable;
5
6
public class EntityAIOwnerHurtTarget extends EntityAITarget
7
{
8
    EntityTameable theEntityTameable;
9
    EntityLivingBase theTarget;
10
    private int field_142050_e;
11
12
    public EntityAIOwnerHurtTarget(EntityTameable theEntityTameableIn)
13
    {
14
        super(theEntityTameableIn, false);
15
        this.theEntityTameable = theEntityTameableIn;
16
        this.setMutexBits(1);
17
    }
18
19
    /**
20
     * Returns whether the EntityAIBase should begin execution.
21
     */
22
    public boolean shouldExecute()
23
    {
24
        if (!this.theEntityTameable.isTamed())
25
        {
26
            return false;
27
        }
28
        else
29
        {
30
            EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner();
31
32
            if (entitylivingbase == null)
33
            {
34
                return false;
35
            }
36
            else
37
            {
38
                this.theTarget = entitylivingbase.getLastAttacker();
39
                int i = entitylivingbase.getLastAttackerTime();
40
                return i != this.field_142050_e && this.isSuitableTarget(this.theTarget, false) && this.theEntityTameable.shouldAttackEntity(this.theTarget, entitylivingbase);
41
            }
42
        }
43
    }
44
45
    /**
46
     * Execute a one shot task or start executing a continuous task
47
     */
48
    public void startExecuting()
49
    {
50
        this.taskOwner.setAttackTarget(this.theTarget);
51
        EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner();
52
53
        if (entitylivingbase != null)
54
        {
55
            this.field_142050_e = entitylivingbase.getLastAttackerTime();
56
        }
57
58
        super.startExecuting();
59
    }
60
}
61

Deobfuscated MCP 1.8.9 source of EntityAIOwnerHurtTarget from Marcelektro/MavenMCP-1.8.9 (net/minecraft/entity/ai/EntityAIOwnerHurtTarget.java), stored verbatim.