summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/PathfinderGoalSit.java
blob: a7c32bdde90f18e0d2722ebc76f614d4eb2ef5c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package net.minecraft.server;

public class PathfinderGoalSit extends PathfinderGoal {

    private EntityTameableAnimal a;
    private boolean b = false;

    public PathfinderGoalSit(EntityTameableAnimal entitytameableanimal) {
        this.a = entitytameableanimal;
        this.a(5);
    }

    public boolean a() {
        if (!this.a.isTamed()) {
            return this.b && this.a.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
        } else if (this.a.H()) {
            return false;
        } else if (!this.a.onGround) {
            return false;
        } else {
            EntityLiving entityliving = this.a.getOwner();

            return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aC() != null ? false : this.b);
        }
    }

    public void c() {
        this.a.getNavigation().g();
        this.a.setSitting(true);
    }

    public void d() {
        this.a.setSitting(false);
    }

    public void setSitting(boolean flag) {
        this.b = flag;
    }
}