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

import org.bukkit.event.entity.EntityDeathEvent; // CraftBukkit

public class EntitySquid extends EntityWaterAnimal {

    public float a = 0.0F;
    public float b = 0.0F;
    public float c = 0.0F;
    public float g = 0.0F;
    public float h = 0.0F;
    public float i = 0.0F;
    public float j = 0.0F;
    public float k = 0.0F;
    private float l = 0.0F;
    private float m = 0.0F;
    private float n = 0.0F;
    private float o = 0.0F;
    private float p = 0.0F;
    private float q = 0.0F;

    public EntitySquid(World world) {
        super(world);
        this.texture = "/mob/squid.png";
        this.b(0.95F, 0.95F);
        this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
    }

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

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

    protected String h() {
        return null;
    }

    protected String i() {
        return null;
    }

    protected String j() {
        return null;
    }

    protected float l() {
        return 0.4F;
    }

    protected int k() {
        return 0;
    }

    protected void a(boolean flag) {
        // CraftBukkit start - whole method
        java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();

        int count = this.random.nextInt(3) + 1;
        if (count > 0) {
            loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
        }

        org.bukkit.World bworld = this.world.getWorld();
        org.bukkit.entity.Entity entity = this.getBukkitEntity();

        EntityDeathEvent event = new EntityDeathEvent(entity, loot);
        this.world.getServer().getPluginManager().callEvent(event);

        for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
            bworld.dropItemNaturally(entity.getLocation(), stack);
        }
        // CraftBukkit end
    }

    public boolean b(EntityHuman entityhuman) {
        return false;
    }

    public boolean ao() {
        return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
    }

    public void s() {
        super.s();
        this.b = this.a;
        this.g = this.c;
        this.i = this.h;
        this.k = this.j;
        this.h += this.m;
        if (this.h > 6.2831855F) {
            this.h -= 6.2831855F;
            if (this.random.nextInt(10) == 0) {
                this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
            }
        }

        if (this.ao()) {
            float f;

            if (this.h < 3.1415927F) {
                f = this.h / 3.1415927F;
                this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
                if ((double) f > 0.75D) {
                    this.l = 1.0F;
                    this.n = 1.0F;
                } else {
                    this.n *= 0.8F;
                }
            } else {
                this.j = 0.0F;
                this.l *= 0.9F;
                this.n *= 0.99F;
            }

            if (!this.ai) {
                this.motX = (double) (this.o * this.l);
                this.motY = (double) (this.p * this.l);
                this.motZ = (double) (this.q * this.l);
            }

            f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
            this.U += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.U) * 0.1F;
            this.yaw = this.U;
            this.c += 3.1415927F * this.n * 1.5F;
            this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
        } else {
            this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
            if (!this.ai) {
                this.motX = 0.0D;
                this.motY -= 0.08D;
                this.motY *= 0.9800000190734863D;
                this.motZ = 0.0D;
            }

            this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D);
        }
    }

    public void a(float f, float f1) {
        this.move(this.motX, this.motY, this.motZ);
    }

    protected void c_() {
        if (this.random.nextInt(50) == 0 || !this.bQ || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
            float f = this.random.nextFloat() * 3.1415927F * 2.0F;

            this.o = MathHelper.cos(f) * 0.2F;
            this.p = -0.1F + this.random.nextFloat() * 0.2F;
            this.q = MathHelper.sin(f) * 0.2F;
        }

        this.ad();
    }
}