13
0
geforkt von Mirrors/Paper
Paper/src/main/java/net/minecraft/server/EntitySquid.java

161 Zeilen
4.5 KiB
Java

2011-06-13 22:17:14 +02:00
package net.minecraft.server;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
2011-06-13 22:17:14 +02:00
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;
2011-09-15 02:23:52 +02:00
public float k = 0.0F;
2011-06-13 22:17:14 +02:00
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;
2011-09-15 02:23:52 +02:00
private float q = 0.0F;
2011-06-13 22:17:14 +02:00
public EntitySquid(World world) {
super(world);
this.texture = "/mob/squid.png";
this.b(0.95F, 0.95F);
2011-09-15 02:23:52 +02:00
this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
2011-06-13 22:17:14 +02:00
}
2011-11-20 09:01:14 +01:00
public int getMaxHealth() {
return 10;
}
2011-06-13 22:17:14 +02:00
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
2011-11-20 09:01:14 +01:00
protected String c_() {
2011-06-13 22:17:14 +02:00
return null;
}
2011-11-20 09:01:14 +01:00
protected String m() {
2011-06-13 22:17:14 +02:00
return null;
}
2011-11-20 09:01:14 +01:00
protected String n() {
2011-06-13 22:17:14 +02:00
return null;
}
2011-11-20 09:01:14 +01:00
protected float o() {
2011-06-13 22:17:14 +02:00
return 0.4F;
}
2011-11-20 09:01:14 +01:00
protected int e() {
2011-06-13 22:17:14 +02:00
return 0;
}
protected void dropDeathLoot(boolean flag, int i) {
2011-06-13 22:17:14 +02:00
// CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
2011-06-13 22:17:14 +02:00
2011-11-20 09:01:14 +01:00
int count = this.random.nextInt(3 + i) + 1;
2011-06-13 22:17:14 +02:00
if (count > 0) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
2011-06-13 22:17:14 +02:00
// CraftBukkit end
}
2011-09-15 02:23:52 +02:00
public boolean b(EntityHuman entityhuman) {
2011-11-20 09:01:14 +01:00
return super.b(entityhuman);
2011-06-13 22:17:14 +02:00
}
2011-11-20 09:01:14 +01:00
public boolean az() {
2011-06-13 22:17:14 +02:00
return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
}
2011-11-20 09:01:14 +01:00
public void d() {
super.d();
2011-06-13 22:17:14 +02:00
this.b = this.a;
2011-09-15 02:23:52 +02:00
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;
2011-06-13 22:17:14 +02:00
if (this.random.nextInt(10) == 0) {
2011-09-15 02:23:52 +02:00
this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
2011-06-13 22:17:14 +02:00
}
}
2011-11-20 09:01:14 +01:00
if (this.az()) {
2011-06-13 22:17:14 +02:00
float f;
2011-09-15 02:23:52 +02:00
if (this.h < 3.1415927F) {
f = this.h / 3.1415927F;
this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
2011-06-13 22:17:14 +02:00
if ((double) f > 0.75D) {
2011-09-15 02:23:52 +02:00
this.l = 1.0F;
this.n = 1.0F;
2011-06-13 22:17:14 +02:00
} else {
2011-09-15 02:23:52 +02:00
this.n *= 0.8F;
2011-06-13 22:17:14 +02:00
}
} else {
2011-09-15 02:23:52 +02:00
this.j = 0.0F;
this.l *= 0.9F;
this.n *= 0.99F;
2011-06-13 22:17:14 +02:00
}
2011-11-20 09:01:14 +01:00
if (!this.aj) {
2011-09-15 02:23:52 +02:00
this.motX = (double) (this.o * this.l);
this.motY = (double) (this.p * this.l);
this.motZ = (double) (this.q * this.l);
2011-06-13 22:17:14 +02:00
}
f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
2011-11-20 09:01:14 +01:00
this.V += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.V) * 0.1F;
this.yaw = this.V;
2011-09-15 02:23:52 +02:00
this.c += 3.1415927F * this.n * 1.5F;
2011-06-13 22:17:14 +02:00
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
} else {
2011-09-15 02:23:52 +02:00
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
2011-11-20 09:01:14 +01:00
if (!this.aj) {
2011-06-13 22:17:14 +02:00
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);
}
2011-11-20 09:01:14 +01:00
protected void m_() {
++this.aS;
if (this.aS > 100) {
this.o = this.p = this.q = 0.0F;
} else if (this.random.nextInt(50) == 0 || !this.bS || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
2011-06-13 22:17:14 +02:00
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
2011-09-15 02:23:52 +02:00
this.o = MathHelper.cos(f) * 0.2F;
this.p = -0.1F + this.random.nextFloat() * 0.2F;
this.q = MathHelper.sin(f) * 0.2F;
2011-06-13 22:17:14 +02:00
}
2011-06-30 00:02:25 +02:00
2011-11-20 09:01:14 +01:00
this.ak();
}
public boolean g() {
return this.locY > 45.0D && this.locY < (double) this.world.seaLevel && super.g();
2011-06-13 22:17:14 +02:00
}
2011-11-20 09:01:14 +01:00
}