2011-06-13 22:17:14 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2012-08-15 12:15:36 +02:00
|
|
|
import org.bukkit.craftbukkit.TrigMath; // CraftBukkit
|
|
|
|
|
2011-06-13 22:17:14 +02:00
|
|
|
public class EntitySquid extends EntityWaterAnimal {
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public float d = 0.0F;
|
|
|
|
public float e = 0.0F;
|
|
|
|
public float f = 0.0F;
|
2011-06-13 22:17:14 +02:00
|
|
|
public float g = 0.0F;
|
|
|
|
public float h = 0.0F;
|
|
|
|
public float i = 0.0F;
|
|
|
|
public float j = 0.0F;
|
2013-03-13 23:33:27 +01:00
|
|
|
public float bK = 0.0F;
|
2012-10-25 05:53:23 +02:00
|
|
|
private float bL = 0.0F;
|
|
|
|
private float bM = 0.0F;
|
|
|
|
private float bN = 0.0F;
|
|
|
|
private float bO = 0.0F;
|
2012-12-20 05:03:52 +01:00
|
|
|
private float bP = 0.0F;
|
2013-03-13 23:33:27 +01:00
|
|
|
private float bQ = 0.0F;
|
2011-06-13 22:17:14 +02:00
|
|
|
|
|
|
|
public EntitySquid(World world) {
|
|
|
|
super(world);
|
|
|
|
this.texture = "/mob/squid.png";
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(0.95F, 0.95F);
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bM = 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;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bb() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bc() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected String bd() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected float ba() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return 0.4F;
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
protected int getLootId() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
protected void dropDeathLoot(boolean flag, int i) {
|
2011-06-13 22:17:14 +02:00
|
|
|
// CraftBukkit start - whole method
|
2011-06-27 00:25:01 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2012-07-22 08:18:00 +02:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
2011-06-13 22:17:14 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
public boolean G() {
|
2012-10-25 05:53:23 +02:00
|
|
|
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, (Entity) this);
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2012-10-25 05:53:23 +02:00
|
|
|
public void c() {
|
|
|
|
super.c();
|
2012-07-29 09:33:13 +02:00
|
|
|
this.e = this.d;
|
|
|
|
this.g = this.f;
|
2011-09-15 02:23:52 +02:00
|
|
|
this.i = this.h;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bK = this.j;
|
|
|
|
this.h += this.bM;
|
2011-09-15 02:23:52 +02:00
|
|
|
if (this.h > 6.2831855F) {
|
|
|
|
this.h -= 6.2831855F;
|
2011-06-13 22:17:14 +02:00
|
|
|
if (this.random.nextInt(10) == 0) {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
if (this.G()) {
|
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) {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bL = 1.0F;
|
|
|
|
this.bN = 1.0F;
|
2011-06-13 22:17:14 +02:00
|
|
|
} else {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bN *= 0.8F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
} else {
|
2011-09-15 02:23:52 +02:00
|
|
|
this.j = 0.0F;
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bL *= 0.9F;
|
|
|
|
this.bN *= 0.99F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2012-01-12 23:10:13 +01:00
|
|
|
if (!this.world.isStatic) {
|
2013-03-13 23:33:27 +01:00
|
|
|
this.motX = (double) (this.bO * this.bL);
|
|
|
|
this.motY = (double) (this.bP * this.bL);
|
|
|
|
this.motZ = (double) (this.bQ * this.bL);
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
2012-08-15 12:15:36 +02:00
|
|
|
// CraftBukkit - Math -> TrigMath
|
2013-03-13 23:33:27 +01:00
|
|
|
this.ay += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.ay) * 0.1F;
|
|
|
|
this.yaw = this.ay;
|
|
|
|
this.f += 3.1415927F * this.bN * 1.5F;
|
2012-08-15 12:15:36 +02:00
|
|
|
// CraftBukkit - Math -> TrigMath
|
|
|
|
this.d += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
|
2011-06-13 22:17:14 +02:00
|
|
|
} else {
|
2011-09-15 02:23:52 +02:00
|
|
|
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
|
2012-01-12 23:10:13 +01:00
|
|
|
if (!this.world.isStatic) {
|
2011-06-13 22:17:14 +02:00
|
|
|
this.motX = 0.0D;
|
|
|
|
this.motY -= 0.08D;
|
|
|
|
this.motY *= 0.9800000190734863D;
|
|
|
|
this.motZ = 0.0D;
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
this.d = (float) ((double) this.d + (double) (-90.0F - this.d) * 0.02D);
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void e(float f, float f1) {
|
2011-06-13 22:17:14 +02:00
|
|
|
this.move(this.motX, this.motY, this.motZ);
|
|
|
|
}
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
protected void bq() {
|
|
|
|
++this.bC;
|
|
|
|
if (this.bC > 100) {
|
|
|
|
this.bO = this.bP = this.bQ = 0.0F;
|
2013-03-20 21:09:23 +01:00
|
|
|
} else if (this.random.nextInt(50) == 0 || !this.inWater || this.bO == 0.0F && this.bP == 0.0F && this.bQ == 0.0F) {
|
2011-06-13 22:17:14 +02:00
|
|
|
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
|
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bO = MathHelper.cos(f) * 0.2F;
|
|
|
|
this.bP = -0.1F + this.random.nextFloat() * 0.2F;
|
|
|
|
this.bQ = MathHelper.sin(f) * 0.2F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
2011-06-30 00:02:25 +02:00
|
|
|
|
2013-03-13 23:33:27 +01:00
|
|
|
this.bn();
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
public boolean canSpawn() {
|
2012-03-01 11:49:23 +01:00
|
|
|
return this.locY > 45.0D && this.locY < 63.0D && super.canSpawn();
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|