summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityPigZombie.java
blob: a26a2a5d7ed8d62972712096c577c1e10c5b0940 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package net.minecraft.server;

import java.util.List;
import java.util.Random;

import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPigZombie;

public class EntityPigZombie extends EntityZombie {

    private int a;
    private int b;
    private static final ItemStack f;

    public EntityPigZombie(World world) {
        super(world);
        a = 0;
        b = 0;
        aP = "/mob/pigzombie.png";
        bC = 0.5F;
        c = 5;
        ae = true;
        //CraftBukkit start
        CraftServer server = ((WorldServer) this.l).getServer();
        this.bukkitEntity = new CraftPigZombie(server, this);
        //CraftBukkit end
    }

    public void b_() {
        bC = d == null ? 0.5F : 0.95F;
        if (b > 0 && --b == 0) {
            l.a(((Entity) (this)), "mob.zombiepig.zpigangry", i() * 2.0F, ((W.nextFloat() - W.nextFloat()) * 0.2F + 1.0F) * 1.8F);
        }
        super.b_();
    }

    public boolean b() {
        return l.k > 0 && l.a(z) && l.a(((Entity) (this)), z).size() == 0 && !l.b(z);
    }

    public void a(NBTTagCompound nbttagcompound) {
        super.a(nbttagcompound);
        nbttagcompound.a("Anger", (short) a);
    }

    public void b(NBTTagCompound nbttagcompound) {
        super.b(nbttagcompound);
        a = ((int) (nbttagcompound.c("Anger")));
    }

    protected Entity l() {
        if (a == 0) {
            return null;
        } else {
            return super.l();
        }
    }

    public void o() {
        super.o();
    }

    public boolean a(Entity entity, int i) {
        if (entity instanceof EntityPlayer) {
            List list = l.b(((Entity) (this)), z.b(32D, 32D, 32D));

            for (int j = 0; j < list.size(); j++) {
                Entity entity1 = (Entity) list.get(j);

                if (entity1 instanceof EntityPigZombie) {
                    EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;

                    entitypigzombie.g(entity);
                }
            }

            g(entity);
        }
        return super.a(entity, i);
    }

    private void g(Entity entity) {
        d = entity;
        a = 400 + W.nextInt(400);
        b = W.nextInt(40);
    }

    protected String e() {
        return "mob.zombiepig.zpig";
    }

    protected String f() {
        return "mob.zombiepig.zpighurt";
    }

    protected String g() {
        return "mob.zombiepig.zpigdeath";
    }

    protected int h() {
        return Item.ap.ba;
    }

    static {
        f = new ItemStack(Item.E, 1);
    }
}