summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityCreeper.java
blob: c6b7f2e684f076b649c0382a23f6422849e066e8 (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
package net.minecraft.server;

import java.util.Random;

//CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftCreeper;
//CraftBukkit end

public class EntityCreeper extends EntityMobs {

    int a;
    int b;

    public EntityCreeper(World world) {
        super(world);
        aP = "/mob/creeper.png";
        //CraftBukkit start
        CraftServer server = ((WorldServer) this.l).getServer();
        this.bukkitEntity = new CraftCreeper(server, this);
        //CraftBukkit end
    }

    protected void a() {
        super.a();
        af.a(16, ((Byte.valueOf((byte) -1))));
    }

    public void a(NBTTagCompound nbttagcompound) {
        super.a(nbttagcompound);
    }

    public void b(NBTTagCompound nbttagcompound) {
        super.b(nbttagcompound);
    }

    public void b_() {
        b = a;
        if (l.z) {
            int i = K();

            if (i > 0 && a == 0) {
                l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F);
            }
            a += i;
            if (a < 0) {
                a = 0;
            }
            if (a >= 30) {
                a = 30;
            }
        }
        super.b_();
    }

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

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

    public void f(Entity entity) {
        super.f(entity);
        if (entity instanceof EntitySkeleton) {
            a(Item.aY.ba + W.nextInt(2), 1);
        }
    }

    protected void a(Entity entity, float f1) {
        int i = K();

        if (i <= 0 && f1 < 3F || i > 0 && f1 < 7F) {
            if (a == 0) {
                l.a(((Entity) (this)), "random.fuse", 1.0F, 0.5F);
            }
            a(1);
            a++;
            if (a >= 30) {
                l.a(((Entity) (this)), p, q, r, 3F);
                q();
            }
            e = true;
        } else {
            a(-1);
            a--;
            if (a < 0) {
                a = 0;
            }
        }
    }

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

    private int K() {
        return ((int) (af.a(16)));
    }

    private void a(int i) {
        af.b(16, ((Byte.valueOf((byte) i))));
    }
}