summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntitySquid.java
blob: 5e48e4466dab50fff24d96f91a1494b19b5e5aed (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package net.minecraft.server;

import java.util.Random;

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

public class EntitySquid extends EntityWaterMob {

    public float a;
    public float b;
    public float c;
    public float f;
    public float ak;
    public float al;
    public float am;
    public float an;
    private float ao;
    private float ap;
    private float aq;
    private float ar;
    private float as;
    private float at;

    public EntitySquid(World world) {
        super(world);
        a = 0.0F;
        b = 0.0F;
        c = 0.0F;
        f = 0.0F;
        ak = 0.0F;
        al = 0.0F;
        am = 0.0F;
        an = 0.0F;
        ao = 0.0F;
        ap = 0.0F;
        aq = 0.0F;
        ar = 0.0F;
        as = 0.0F;
        at = 0.0F;
        aP = "/mob/squid.png";
        a(0.95F, 0.95F);
        ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F;
        //CraftBukkit start
        CraftServer server = ((WorldServer) this.l).getServer();
        this.bukkitEntity = new CraftSquid(server, this);
        //CraftBukkit end
    }

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

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

    protected String e() {
        return null;
    }

    protected String f() {
        return null;
    }

    protected String g() {
        return null;
    }

    protected float i() {
        return 0.4F;
    }

    protected int h() {
        return 0;
    }

    protected void g_() {
        int j = W.nextInt(3) + 1;

        for (int k = 0; k < j; k++) {
            a(new ItemStack(Item.aU, 1, 0), 0.0F);
        }
    }

    public boolean a(EntityPlayer entityplayer) {
        ItemStack itemstack = entityplayer.an.e();

        if (itemstack != null && itemstack.c == Item.au.ba) {
            entityplayer.an.a(entityplayer.an.c, new ItemStack(Item.aE));
            return true;
        } else {
            return false;
        }
    }

    public boolean v() {
        return l.a(z.b(0.0D, -0.60000002384185791D, 0.0D), Material.f, ((Entity) (this)));
    }

    public void o() {
        super.o();
        b = a;
        f = c;
        al = ak;
        an = am;
        ak += ap;
        if (ak > 6.283185F) {
            ak -= 6.283185F;
            if (W.nextInt(10) == 0) {
                ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F;
            }
        }
        if (v()) {
            if (ak < 3.141593F) {
                float f1 = ak / 3.141593F;

                am = MathHelper.a(f1 * f1 * 3.141593F) * 3.141593F * 0.25F;
                if ((double) f1 > 0.75D) {
                    ao = 1.0F;
                    aq = 1.0F;
                } else {
                    aq = aq * 0.8F;
                }
            } else {
                am = 0.0F;
                ao = ao * 0.9F;
                aq = aq * 0.99F;
            }
            if (!aW) {
                s = ar * ao;
                t = as * ao;
                u = at * ao;
            }
            float f2 = MathHelper.a(s * s + u * u);

            aI += ((-(float) Math.atan2(s, u) * 180F) / 3.141593F - aI) * 0.1F;
            v = aI;
            c = c + 3.141593F * aq * 1.5F;
            a += ((-(float) Math.atan2(f2, t) * 180F) / 3.141593F - a) * 0.1F;
        } else {
            am = MathHelper.e(MathHelper.a(ak)) * 3.141593F * 0.25F;
            if (!aW) {
                s = 0.0D;
                t -= 0.080000000000000002D;
                t *= 0.98000001907348633D;
                u = 0.0D;
            }
            a += ((float) ((double) (-90F - a) * 0.02D));
        }
    }

    public void c(float f1, float f2) {
        c(s, t, u);
    }

    protected void d() {
        if (W.nextInt(50) == 0 || !ab || ar == 0.0F && as == 0.0F && at == 0.0F) {
            float f1 = W.nextFloat() * 3.141593F * 2.0F;

            ar = MathHelper.b(f1) * 0.2F;
            as = -0.1F + W.nextFloat() * 0.2F;
            at = MathHelper.a(f1) * 0.2F;
        }
    }
}