EntityAISwimming .java

net.minecraft.entity.ai.EntityAISwimming (class, 36 lines): members: theEntity, updateTask, shouldExecute. imports: PathNavigateGround, EntityLiving.

net.minecraft.entity.aiclass36 linescommonextends EntityAIBase855 B

API Surface (2)

boolean shouldExecute()
void updateTask()

Fields & Constants (1)

theEntity

Code Graph: Dependencies (3)

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

Full Source

EntityAISwimming.java36 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.ai;
2
3
import net.minecraft.entity.EntityLiving;
4
import net.minecraft.pathfinding.PathNavigateGround;
5
6
public class EntityAISwimming extends EntityAIBase
7
{
8
    private EntityLiving theEntity;
9
10
    public EntityAISwimming(EntityLiving entitylivingIn)
11
    {
12
        this.theEntity = entitylivingIn;
13
        this.setMutexBits(4);
14
        ((PathNavigateGround)entitylivingIn.getNavigator()).setCanSwim(true);
15
    }
16
17
    /**
18
     * Returns whether the EntityAIBase should begin execution.
19
     */
20
    public boolean shouldExecute()
21
    {
22
        return this.theEntity.isInWater() || this.theEntity.isInLava();
23
    }
24
25
    /**
26
     * Updates the task
27
     */
28
    public void updateTask()
29
    {
30
        if (this.theEntity.getRNG().nextFloat() < 0.8F)
31
        {
32
            this.theEntity.getJumpHelper().setJumping();
33
        }
34
    }
35
}
36

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