summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntitySheep.java
blob: 725624a90609dd09a7814425262ada21ac5ca03f (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package net.minecraft.server;

import java.util.Random;

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

public class EntitySheep extends EntityAnimals {

    public static final float a[][] = {
        {
            1.0F, 1.0F, 1.0F
        }, {
            0.95F, 0.7F, 0.2F
        }, {
            0.9F, 0.5F, 0.85F
        }, {
            0.6F, 0.7F, 0.95F
        }, {
            0.9F, 0.9F, 0.2F
        }, {
            0.5F, 0.8F, 0.1F
        }, {
            0.95F, 0.7F, 0.8F
        }, {
            0.3F, 0.3F, 0.3F
        }, {
            0.6F, 0.6F, 0.6F
        }, {
            0.3F, 0.6F, 0.7F
        }, {
            0.7F, 0.4F, 0.9F
        }, {
            0.2F, 0.4F, 0.8F
        }, {
            0.5F, 0.4F, 0.3F
        }, {
            0.4F, 0.5F, 0.2F
        }, {
            0.8F, 0.3F, 0.3F
        }, {
            0.1F, 0.1F, 0.1F
        }
    };

    public EntitySheep(World world) {
        super(world);
        aP = "/mob/sheep.png";
        a(0.9F, 1.3F);
        // CraftBukkit start
        CraftServer server = ((WorldServer) this.l).getServer();
        this.bukkitEntity = new CraftSheep(server, this);
        // CraftBukkit end
    }

    protected void a() {
        super.a();
        af.a(16, ((new Byte((byte) 0))));
    }

    public boolean a(Entity entity, int i) {
        if (!l.z && !f_() && (entity instanceof EntityLiving)) {
            a(true);
            int j = 1 + W.nextInt(3);

            for (int k = 0; k < j; k++) {
                EntityItem entityitem = a(new ItemStack(Block.ab.bi, 1, e_()), 1.0F);

                entityitem.t += W.nextFloat() * 0.05F;
                entityitem.s += (W.nextFloat() - W.nextFloat()) * 0.1F;
                entityitem.u += (W.nextFloat() - W.nextFloat()) * 0.1F;
            }
        }
        return super.a(entity, i);
    }

    public void a(NBTTagCompound nbttagcompound) {
        super.a(nbttagcompound);
        nbttagcompound.a("Sheared", f_());
        nbttagcompound.a("Color", (byte) e_());
    }

    public void b(NBTTagCompound nbttagcompound) {
        super.b(nbttagcompound);
        a(nbttagcompound.l("Sheared"));
        a(((int) (nbttagcompound.b("Color"))));
    }

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

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

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

    public int e_() {
        return af.a(16) & 0xf;
    }

    public void a(int i) {
        byte byte0 = af.a(16);

        af.b(16, ((Byte.valueOf((byte) (byte0 & 0xf0 | i & 0xf)))));
    }

    public boolean f_() {
        return (af.a(16) & 0x10) != 0;
    }

    public void a(boolean flag) {
        byte byte0 = af.a(16);

        if (flag) {
            af.b(16, ((Byte.valueOf((byte) (byte0 | 0x10)))));
        } else {
            af.b(16, ((Byte.valueOf((byte) (byte0 & 0xffffffef)))));
        }
    }

    public static int a(Random random) {
        int i = random.nextInt(100);

        if (i < 5) {
            return 15;
        }
        if (i < 10) {
            return 7;
        }
        return i >= 15 ? 0 : 8;
    }
}