EntityAIOwnerHurtByTarget .java

net.minecraft.entity.ai.EntityAIOwnerHurtByTarget (class): members: theDefendingTameable, theOwnerAttacker, field_142051_e, startExecuting, shouldExecute.

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

API Surface (2)

boolean shouldExecute()
void startExecuting()

Fields & Constants (3)

theDefendingTameable
theOwnerAttacker
field_142051_e

Code Graph: Dependencies (3)

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

Full Source

EntityAIOwnerHurtByTarget.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 EntityAIOwnerHurtByTarget extends EntityAITarget
7
{
8
    EntityTameable theDefendingTameable;
9
    EntityLivingBase theOwnerAttacker;
10
    private int field_142051_e;
11
12
    public EntityAIOwnerHurtByTarget(EntityTameable theDefendingTameableIn)
13
    {
14
        super(theDefendingTameableIn, false);
15
        this.theDefendingTameable = theDefendingTameableIn;
16
        this.setMutexBits(1);
17
    }
18
19
    /**
20
     * Returns whether the EntityAIBase should begin execution.
21
     */
22
    public boolean shouldExecute()
23
    {
24
        if (!this.theDefendingTameable.isTamed())
25
        {
26
            return false;
27
        }
28
        else
29
        {
30
            EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner();
31
32
            if (entitylivingbase == null)
33
            {
34
                return false;
35
            }
36
            else
37
            {
38
                this.theOwnerAttacker = entitylivingbase.getAITarget();
39
                int i = entitylivingbase.getRevengeTimer();
40
                return i != this.field_142051_e && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.shouldAttackEntity(this.theOwnerAttacker, 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.theOwnerAttacker);
51
        EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner();
52
53
        if (entitylivingbase != null)
54
        {
55
            this.field_142051_e = entitylivingbase.getRevengeTimer();
56
        }
57
58
        super.startExecuting();
59
    }
60
}
61

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