EntityAICreeperSwell .java

net.minecraft.entity.ai.EntityAICreeperSwell (class): members: creeperAttackTarget, swellingCreeper, updateTask, resetTask, startExecuting, shouldExecute.

net.minecraft.entity.aiclass71 linescommonextends EntityAIBase1.9 KB

API Surface (4)

boolean shouldExecute()
void startExecuting()
void resetTask()
void updateTask()

Fields & Constants (2)

swellingCreeper
creeperAttackTarget

Code Graph: Dependencies (3)

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

Full Source

EntityAICreeperSwell.java71 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.ai;
2
3
import net.minecraft.entity.EntityLivingBase;
4
import net.minecraft.entity.monster.EntityCreeper;
5
6
public class EntityAICreeperSwell extends EntityAIBase
7
{
8
    /** The creeper that is swelling. */
9
    EntityCreeper swellingCreeper;
10
11
    /**
12
     * The creeper's attack target. This is used for the changing of the creeper's state.
13
     */
14
    EntityLivingBase creeperAttackTarget;
15
16
    public EntityAICreeperSwell(EntityCreeper entitycreeperIn)
17
    {
18
        this.swellingCreeper = entitycreeperIn;
19
        this.setMutexBits(1);
20
    }
21
22
    /**
23
     * Returns whether the EntityAIBase should begin execution.
24
     */
25
    public boolean shouldExecute()
26
    {
27
        EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget();
28
        return this.swellingCreeper.getCreeperState() > 0 || entitylivingbase != null && this.swellingCreeper.getDistanceSqToEntity(entitylivingbase) < 9.0D;
29
    }
30
31
    /**
32
     * Execute a one shot task or start executing a continuous task
33
     */
34
    public void startExecuting()
35
    {
36
        this.swellingCreeper.getNavigator().clearPathEntity();
37
        this.creeperAttackTarget = this.swellingCreeper.getAttackTarget();
38
    }
39
40
    /**
41
     * Resets the task
42
     */
43
    public void resetTask()
44
    {
45
        this.creeperAttackTarget = null;
46
    }
47
48
    /**
49
     * Updates the task
50
     */
51
    public void updateTask()
52
    {
53
        if (this.creeperAttackTarget == null)
54
        {
55
            this.swellingCreeper.setCreeperState(-1);
56
        }
57
        else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D)
58
        {
59
            this.swellingCreeper.setCreeperState(-1);
60
        }
61
        else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget))
62
        {
63
            this.swellingCreeper.setCreeperState(-1);
64
        }
65
        else
66
        {
67
            this.swellingCreeper.setCreeperState(1);
68
        }
69
    }
70
}
71

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