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 {
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public float bp;
|
|
|
|
public float bq;
|
|
|
|
public float br;
|
|
|
|
public float bs;
|
|
|
|
public float bt;
|
|
|
|
public float bu;
|
|
|
|
public float bv;
|
|
|
|
public float bw;
|
|
|
|
private float bx;
|
|
|
|
private float by;
|
|
|
|
private float bz;
|
|
|
|
private float bA;
|
|
|
|
private float bB;
|
|
|
|
private float bC;
|
2011-06-13 22:17:14 +02:00
|
|
|
|
|
|
|
public EntitySquid(World world) {
|
|
|
|
super(world);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.a(0.95F, 0.95F);
|
2013-07-01 13:03:00 +02:00
|
|
|
this.by = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
protected void aC() {
|
|
|
|
super.aC();
|
2013-07-09 01:43:37 +02:00
|
|
|
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
protected String t() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
protected String aS() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
protected String aT() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
protected float be() {
|
2011-06-13 22:17:14 +02:00
|
|
|
return 0.4F;
|
|
|
|
}
|
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
protected Item getLoot() {
|
|
|
|
return Item.d(0);
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
protected boolean g_() {
|
2013-07-01 13:03:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
protected void dropDeathLoot(boolean flag, int i) {
|
2013-03-25 05:22:32 +01: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-04-12 01:11:10 +02:00
|
|
|
/* CraftBukkit start - Delegate to Entity to use existing inWater value
|
2014-03-21 05:26:30 +01:00
|
|
|
public boolean L() {
|
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
|
|
|
}
|
2013-04-12 01:11:10 +02:00
|
|
|
// CraftBukkit end */
|
2011-06-13 22:17:14 +02:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
public void e() {
|
|
|
|
super.e();
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bq = this.bp;
|
|
|
|
this.bs = this.br;
|
|
|
|
this.bu = this.bt;
|
|
|
|
this.bw = this.bv;
|
|
|
|
this.bt += this.by;
|
|
|
|
if (this.bt > 6.2831855F) {
|
|
|
|
this.bt -= 6.2831855F;
|
2011-06-13 22:17:14 +02:00
|
|
|
if (this.random.nextInt(10) == 0) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.by = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
if (this.L()) {
|
2011-06-13 22:17:14 +02:00
|
|
|
float f;
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
if (this.bt < 3.1415927F) {
|
|
|
|
f = this.bt / 3.1415927F;
|
|
|
|
this.bv = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
|
2011-06-13 22:17:14 +02:00
|
|
|
if ((double) f > 0.75D) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bx = 1.0F;
|
|
|
|
this.bz = 1.0F;
|
2011-06-13 22:17:14 +02:00
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bz *= 0.8F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = 0.0F;
|
|
|
|
this.bx *= 0.9F;
|
|
|
|
this.bz *= 0.99F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
|
|
|
|
2012-01-12 23:10:13 +01:00
|
|
|
if (!this.world.isStatic) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.motX = (double) (this.bA * this.bx);
|
|
|
|
this.motY = (double) (this.bB * this.bx);
|
|
|
|
this.motZ = (double) (this.bC * this.bx);
|
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
|
2014-03-21 05:26:30 +01:00
|
|
|
this.aM += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aM) * 0.1F;
|
|
|
|
this.yaw = this.aM;
|
2013-07-01 13:03:00 +02:00
|
|
|
this.br += 3.1415927F * this.bz * 1.5F;
|
2012-08-15 12:15:36 +02:00
|
|
|
// CraftBukkit - Math -> TrigMath
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bp += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.bp) * 0.1F;
|
2011-06-13 22:17:14 +02:00
|
|
|
} else {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bv = MathHelper.abs(MathHelper.sin(this.bt)) * 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;
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bp = (float) ((double) this.bp + (double) (-90.0F - this.bp) * 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);
|
|
|
|
}
|
|
|
|
|
2014-03-21 05:26:30 +01:00
|
|
|
protected void bp() {
|
|
|
|
++this.aU;
|
|
|
|
if (this.aU > 100) {
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bA = this.bB = this.bC = 0.0F;
|
|
|
|
} else if (this.random.nextInt(50) == 0 || !this.inWater || this.bA == 0.0F && this.bB == 0.0F && this.bC == 0.0F) {
|
2011-06-13 22:17:14 +02:00
|
|
|
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
this.bA = MathHelper.cos(f) * 0.2F;
|
|
|
|
this.bB = -0.1F + this.random.nextFloat() * 0.2F;
|
|
|
|
this.bC = MathHelper.sin(f) * 0.2F;
|
2011-06-13 22:17:14 +02:00
|
|
|
}
|
2011-06-30 00:02:25 +02:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
this.w();
|
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
|
|
|
}
|