EntityAISit .java

net.minecraft.entity.ai.EntityAISit (class): members: setSitting, isSitting, theEntity, resetTask, startExecuting, shouldExecute. imports: EntityTameable.

net.minecraft.entity.aiclass68 linescommonextends EntityAIBase1.6 KB

API Surface (4)

boolean shouldExecute()
void startExecuting()
void resetTask()
void setSitting(boolean sitting)

Fields & Constants (2)

theEntity
isSitting

Code Graph: Dependencies (3)

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

Full Source

EntityAISit.java68 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 EntityAISit extends EntityAIBase
7
{
8
    private EntityTameable theEntity;
9
10
    /** If the EntityTameable is sitting. */
11
    private boolean isSitting;
12
13
    public EntityAISit(EntityTameable entityIn)
14
    {
15
        this.theEntity = entityIn;
16
        this.setMutexBits(5);
17
    }
18
19
    /**
20
     * Returns whether the EntityAIBase should begin execution.
21
     */
22
    public boolean shouldExecute()
23
    {
24
        if (!this.theEntity.isTamed())
25
        {
26
            return false;
27
        }
28
        else if (this.theEntity.isInWater())
29
        {
30
            return false;
31
        }
32
        else if (!this.theEntity.onGround)
33
        {
34
            return false;
35
        }
36
        else
37
        {
38
            EntityLivingBase entitylivingbase = this.theEntity.getOwner();
39
            return entitylivingbase == null ? true : (this.theEntity.getDistanceSqToEntity(entitylivingbase) < 144.0D && entitylivingbase.getAITarget() != null ? false : this.isSitting);
40
        }
41
    }
42
43
    /**
44
     * Execute a one shot task or start executing a continuous task
45
     */
46
    public void startExecuting()
47
    {
48
        this.theEntity.getNavigator().clearPathEntity();
49
        this.theEntity.setSitting(true);
50
    }
51
52
    /**
53
     * Resets the task
54
     */
55
    public void resetTask()
56
    {
57
        this.theEntity.setSitting(false);
58
    }
59
60
    /**
61
     * Sets the sitting flag.
62
     */
63
    public void setSitting(boolean sitting)
64
    {
65
        this.isSitting = sitting;
66
    }
67
}
68

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