2011-01-03 12:37:41 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
2011-02-21 23:30:01 +01:00
|
|
|
|
|
|
|
// CraftBukkit start
|
2011-06-07 10:21:33 +02:00
|
|
|
import java.util.UUID;
|
2011-04-21 18:29:35 +02:00
|
|
|
import org.bukkit.Bukkit;
|
2011-01-31 23:25:27 +01:00
|
|
|
import org.bukkit.block.BlockFace;
|
2011-02-01 11:02:43 +01:00
|
|
|
import org.bukkit.entity.LivingEntity;
|
2011-11-29 08:10:05 +01:00
|
|
|
import org.bukkit.entity.Painting;
|
2011-01-31 23:25:27 +01:00
|
|
|
import org.bukkit.entity.Vehicle;
|
2011-11-29 08:10:05 +01:00
|
|
|
import org.bukkit.event.entity.EntityCombustByBlockEvent;
|
|
|
|
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
|
|
|
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
2011-01-31 23:25:27 +01:00
|
|
|
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
2011-02-01 11:02:43 +01:00
|
|
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
2011-04-07 08:18:30 +02:00
|
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
2011-02-21 23:30:01 +01:00
|
|
|
import org.bukkit.event.entity.EntityCombustEvent;
|
|
|
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
2011-04-21 18:29:35 +02:00
|
|
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
2011-02-21 23:30:01 +01:00
|
|
|
import org.bukkit.event.entity.EntityDamageEvent;
|
2011-11-29 08:10:05 +01:00
|
|
|
import org.bukkit.plugin.PluginManager;
|
2011-02-21 23:30:01 +01:00
|
|
|
// CraftBukkit end
|
2011-01-03 12:37:41 +01:00
|
|
|
|
|
|
|
public abstract class Entity {
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
private static int entityCount = 0;
|
|
|
|
public int id;
|
2011-11-20 09:01:14 +01:00
|
|
|
public double bb;
|
|
|
|
public boolean bc;
|
2011-01-29 22:50:29 +01:00
|
|
|
public Entity passenger;
|
|
|
|
public Entity vehicle;
|
|
|
|
public World world;
|
|
|
|
public double lastX;
|
|
|
|
public double lastY;
|
|
|
|
public double lastZ;
|
|
|
|
public double locX;
|
|
|
|
public double locY;
|
|
|
|
public double locZ;
|
|
|
|
public double motX;
|
|
|
|
public double motY;
|
|
|
|
public double motZ;
|
|
|
|
public float yaw;
|
|
|
|
public float pitch;
|
|
|
|
public float lastYaw;
|
|
|
|
public float lastPitch;
|
|
|
|
public final AxisAlignedBB boundingBox;
|
|
|
|
public boolean onGround;
|
2011-04-20 19:05:14 +02:00
|
|
|
public boolean positionChanged;
|
2011-09-15 02:23:52 +02:00
|
|
|
public boolean bw;
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean bx;
|
|
|
|
public boolean velocityChanged;
|
|
|
|
protected boolean bz;
|
|
|
|
public boolean bA;
|
2011-01-29 22:50:29 +01:00
|
|
|
public boolean dead;
|
|
|
|
public float height;
|
|
|
|
public float width;
|
2011-11-30 00:17:43 +01:00
|
|
|
public float length;
|
2011-11-20 09:01:14 +01:00
|
|
|
public float bF;
|
|
|
|
public float bG;
|
2011-05-14 16:29:42 +02:00
|
|
|
public float fallDistance; // CraftBukkit - private -> public
|
2011-01-03 12:37:41 +01:00
|
|
|
private int b;
|
2011-11-20 09:01:14 +01:00
|
|
|
public double bI;
|
|
|
|
public double bJ;
|
|
|
|
public double bK;
|
|
|
|
public float bL;
|
|
|
|
public float bM;
|
|
|
|
public boolean bN;
|
|
|
|
public float bO;
|
2011-01-29 22:50:29 +01:00
|
|
|
protected Random random;
|
|
|
|
public int ticksLived;
|
|
|
|
public int maxFireTicks;
|
2011-11-20 09:01:14 +01:00
|
|
|
public int fireTicks; // CraftBukkit - private -> public
|
|
|
|
protected boolean bS;
|
2011-01-29 22:50:29 +01:00
|
|
|
public int noDamageTicks;
|
|
|
|
private boolean justCreated;
|
2011-06-27 00:25:01 +02:00
|
|
|
protected boolean fireProof;
|
2011-01-29 22:50:29 +01:00
|
|
|
protected DataWatcher datawatcher;
|
2011-01-03 12:37:41 +01:00
|
|
|
private double e;
|
2011-11-20 09:01:14 +01:00
|
|
|
private double f;
|
|
|
|
public boolean bW;
|
2011-09-15 02:23:52 +02:00
|
|
|
public int bX;
|
|
|
|
public int bY;
|
2011-11-20 09:01:14 +01:00
|
|
|
public int bZ;
|
2011-09-15 02:23:52 +02:00
|
|
|
public boolean ca;
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean cb;
|
2011-06-07 10:21:33 +02:00
|
|
|
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
|
2011-01-03 12:37:41 +01:00
|
|
|
|
|
|
|
public Entity(World world) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.id = entityCount++;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bb = 1.0D;
|
|
|
|
this.bc = false;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
|
|
|
this.onGround = false;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bx = false;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.velocityChanged = false;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bA = true;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.dead = false;
|
|
|
|
this.height = 0.0F;
|
2011-11-30 00:17:43 +01:00
|
|
|
this.width = 0.6F;
|
|
|
|
this.length = 1.8F;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bF = 0.0F;
|
|
|
|
this.bG = 0.0F;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.fallDistance = 0.0F;
|
|
|
|
this.b = 1;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bL = 0.0F;
|
|
|
|
this.bM = 0.0F;
|
|
|
|
this.bN = false;
|
|
|
|
this.bO = 0.0F;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.random = new Random();
|
|
|
|
this.ticksLived = 0;
|
|
|
|
this.maxFireTicks = 1;
|
|
|
|
this.fireTicks = 0;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bS = false;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.noDamageTicks = 0;
|
|
|
|
this.justCreated = true;
|
2011-06-27 00:25:01 +02:00
|
|
|
this.fireProof = false;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.datawatcher = new DataWatcher();
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bW = false;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.world = world;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.setPosition(0.0D, 0.0D, 0.0D);
|
2011-01-29 22:50:29 +01:00
|
|
|
this.datawatcher.a(0, Byte.valueOf((byte) 0));
|
2011-11-20 09:01:14 +01:00
|
|
|
this.datawatcher.a(1, Short.valueOf((short) 300));
|
2011-04-20 22:47:26 +02:00
|
|
|
this.b();
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 22:47:26 +02:00
|
|
|
protected abstract void b();
|
2011-01-14 14:31:10 +01:00
|
|
|
|
2011-09-24 23:03:31 +02:00
|
|
|
public DataWatcher getDataWatcher() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return this.datawatcher;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
public boolean equals(Object object) {
|
|
|
|
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return this.id;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void die() {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.dead = true;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-03-31 22:40:00 +02:00
|
|
|
protected void b(float f, float f1) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.width = f;
|
|
|
|
this.length = f1;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-02-23 03:37:56 +01:00
|
|
|
protected void c(float f, float f1) {
|
2011-05-14 16:29:42 +02:00
|
|
|
// CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0.
|
2011-04-23 10:18:00 +02:00
|
|
|
if (Float.isNaN(f)) {
|
|
|
|
f = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) {
|
2011-04-07 08:18:30 +02:00
|
|
|
if (this instanceof EntityPlayer) {
|
2011-04-20 19:05:14 +02:00
|
|
|
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
|
|
|
|
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
|
2011-04-07 08:18:30 +02:00
|
|
|
}
|
|
|
|
f = 0;
|
|
|
|
}
|
|
|
|
|
2011-05-14 16:29:42 +02:00
|
|
|
// pitch was sometimes set to NaN, so we need to set it back to 0.
|
2011-04-23 10:18:00 +02:00
|
|
|
if (Float.isNaN(f1)) {
|
|
|
|
f1 = 0;
|
|
|
|
}
|
|
|
|
|
2011-06-12 00:02:58 +02:00
|
|
|
if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) {
|
2011-04-07 08:18:30 +02:00
|
|
|
if (this instanceof EntityPlayer) {
|
2011-04-20 19:05:14 +02:00
|
|
|
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
|
|
|
|
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
|
2011-04-07 08:18:30 +02:00
|
|
|
}
|
|
|
|
f1 = 0;
|
|
|
|
}
|
2011-05-14 16:29:42 +02:00
|
|
|
// CraftBukkit end
|
2011-04-20 22:47:26 +02:00
|
|
|
|
|
|
|
this.yaw = f % 360.0F;
|
|
|
|
this.pitch = f1 % 360.0F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void setPosition(double d0, double d1, double d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.locX = d0;
|
|
|
|
this.locY = d1;
|
|
|
|
this.locZ = d2;
|
2011-11-30 00:17:43 +01:00
|
|
|
float f = this.width / 2.0F;
|
|
|
|
float f1 = this.length;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bL, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bL + (double) f1, d2 + (double) f);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void w_() {
|
|
|
|
this.af();
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void af() {
|
2011-11-26 18:27:39 +01:00
|
|
|
// MethodProfiler.a("entityBaseTick"); // CraftBukkit -- not in production code
|
2011-01-29 22:50:29 +01:00
|
|
|
if (this.vehicle != null && this.vehicle.dead) {
|
|
|
|
this.vehicle = null;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
++this.ticksLived;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bF = this.bG;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.lastX = this.locX;
|
|
|
|
this.lastY = this.locY;
|
|
|
|
this.lastZ = this.locZ;
|
|
|
|
this.lastPitch = this.pitch;
|
|
|
|
this.lastYaw = this.yaw;
|
2011-09-15 02:23:52 +02:00
|
|
|
int i;
|
|
|
|
|
2011-09-24 23:03:31 +02:00
|
|
|
if (this.isSprinting()) {
|
2011-09-15 02:23:52 +02:00
|
|
|
int j = MathHelper.floor(this.locX);
|
|
|
|
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
|
|
|
|
|
|
|
i = MathHelper.floor(this.locZ);
|
|
|
|
int l = this.world.getTypeId(j, k, i);
|
|
|
|
|
|
|
|
if (l > 0) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
|
2011-09-15 02:23:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.i_()) {
|
|
|
|
if (!this.bS && !this.justCreated) {
|
2011-01-29 22:50:29 +01:00
|
|
|
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
|
|
|
|
|
|
|
|
if (f > 1.0F) {
|
|
|
|
f = 1.0F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
this.world.makeSound(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
|
|
|
float f1 = (float) MathHelper.floor(this.boundingBox.b);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
float f2;
|
|
|
|
float f3;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
|
|
|
|
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
|
|
|
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
2011-09-15 02:23:52 +02:00
|
|
|
this.world.a("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
|
|
|
|
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
|
|
|
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
2011-09-15 02:23:52 +02:00
|
|
|
this.world.a("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
this.fallDistance = 0.0F;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bS = true;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.fireTicks = 0;
|
2011-01-03 12:37:41 +01:00
|
|
|
} else {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bS = false;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (this.world.isStatic) {
|
|
|
|
this.fireTicks = 0;
|
|
|
|
} else if (this.fireTicks > 0) {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (this.fireProof) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.fireTicks -= 4;
|
|
|
|
if (this.fireTicks < 0) {
|
|
|
|
this.fireTicks = 0;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (this.fireTicks % 20 == 0) {
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit start - TODO: this event spams!
|
2011-02-23 13:56:36 +01:00
|
|
|
if (this instanceof EntityLiving) {
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, 1);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-01-12 06:48:19 +01:00
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
if (!event.isCancelled()) {
|
2011-09-15 18:36:27 +02:00
|
|
|
this.damageEntity(DamageSource.BURN, event.getDamage());
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-09-15 18:36:27 +02:00
|
|
|
this.damageEntity(DamageSource.BURN, 1);
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
--this.fireTicks;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.aA()) {
|
|
|
|
this.av();
|
|
|
|
this.fallDistance *= 0.5F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (this.locY < -64.0D) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.ao();
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (!this.world.isStatic) {
|
|
|
|
this.a(0, this.fireTicks > 0);
|
|
|
|
this.a(2, this.vehicle != null);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
this.justCreated = false;
|
2011-11-26 18:27:39 +01:00
|
|
|
// MethodProfiler.a(); // CraftBukkit -- not in production code
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
protected void av() {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!this.fireProof) {
|
2011-11-29 08:10:05 +01:00
|
|
|
// CraftBukkit start - fallen in lava TODO: this event spams!
|
2011-02-23 13:56:36 +01:00
|
|
|
if (this instanceof EntityLiving) {
|
2011-06-27 00:25:01 +02:00
|
|
|
org.bukkit.Server server = this.world.getServer();
|
|
|
|
|
2011-01-19 09:07:56 +01:00
|
|
|
// TODO: shouldn't be sending null for the block.
|
2011-02-23 13:56:36 +01:00
|
|
|
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
|
2011-01-18 06:30:01 +01:00
|
|
|
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
2011-01-12 06:48:19 +01:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4);
|
2011-01-29 22:50:29 +01:00
|
|
|
server.getPluginManager().callEvent(event);
|
2011-02-23 13:56:36 +01:00
|
|
|
|
|
|
|
if (!event.isCancelled()) {
|
2011-09-15 18:36:27 +02:00
|
|
|
this.damageEntity(DamageSource.LAVA, event.getDamage());
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
if (this.fireTicks <= 0) {
|
2011-01-18 06:30:01 +01:00
|
|
|
// not on fire yet
|
2011-11-29 08:10:05 +01:00
|
|
|
EntityCombustEvent combustEvent = new EntityCombustByBlockEvent(damager, damagee, 15);
|
2011-01-29 22:50:29 +01:00
|
|
|
server.getPluginManager().callEvent(combustEvent);
|
2011-06-27 00:25:01 +02:00
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
if (!combustEvent.isCancelled()) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(combustEvent.getDuration());
|
2011-01-18 06:30:01 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-11-29 08:10:05 +01:00
|
|
|
// This will be called every single tick the entity is in lava, so don't throw an event.
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(15);
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
return;
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
2011-11-29 08:10:05 +01:00
|
|
|
// CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-09-15 18:36:27 +02:00
|
|
|
this.damageEntity(DamageSource.LAVA, 4);
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(15);
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
public void setOnFire(int i) {
|
2011-11-20 09:01:14 +01:00
|
|
|
int j = i * 20;
|
|
|
|
|
|
|
|
if (this.fireTicks < j) {
|
|
|
|
this.fireTicks = j;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
public void extinguish() {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.fireTicks = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void ao() {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.die();
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-07-08 14:25:53 +02:00
|
|
|
public boolean d(double d0, double d1, double d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2);
|
2011-04-20 19:05:14 +02:00
|
|
|
List list = this.world.getEntities(this, axisalignedbb);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-04-20 22:47:26 +02:00
|
|
|
return list.size() > 0 ? false : !this.world.c(axisalignedbb);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void move(double d0, double d1, double d2) {
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.bN) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.boundingBox.d(d0, d1, d2);
|
|
|
|
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
|
|
|
} else {
|
2011-11-26 18:27:39 +01:00
|
|
|
// MethodProfiler.a("move"); // CraftBukkit -- not in production code
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bL *= 0.4F;
|
2011-01-29 22:50:29 +01:00
|
|
|
double d3 = this.locX;
|
|
|
|
double d4 = this.locZ;
|
2011-04-20 22:47:26 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.bz) {
|
|
|
|
this.bz = false;
|
2011-04-20 22:47:26 +02:00
|
|
|
d0 *= 0.25D;
|
|
|
|
d1 *= 0.05000000074505806D;
|
|
|
|
d2 *= 0.25D;
|
|
|
|
this.motX = 0.0D;
|
|
|
|
this.motY = 0.0D;
|
|
|
|
this.motZ = 0.0D;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
double d5 = d0;
|
|
|
|
double d6 = d1;
|
|
|
|
double d7 = d2;
|
2011-04-20 19:05:14 +02:00
|
|
|
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
|
|
|
|
boolean flag = this.onGround && this.isSneaking();
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
double d8;
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
for (d8 = 0.05D; d0 != 0.0D && this.world.getEntities(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (d0 < d8 && d0 >= -d8) {
|
|
|
|
d0 = 0.0D;
|
|
|
|
} else if (d0 > 0.0D) {
|
|
|
|
d0 -= d8;
|
|
|
|
} else {
|
|
|
|
d0 += d8;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
for (; d2 != 0.0D && this.world.getEntities(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (d2 < d8 && d2 >= -d8) {
|
|
|
|
d2 = 0.0D;
|
|
|
|
} else if (d2 > 0.0D) {
|
|
|
|
d2 -= d8;
|
|
|
|
} else {
|
|
|
|
d2 += d8;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
List list = this.world.getEntities(this, this.boundingBox.a(d0, d1, d2));
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
this.boundingBox.d(0.0D, d1, 0.0D);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d6 != d1) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
boolean flag1 = this.onGround || d6 != d1 && d6 < 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
int j;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
for (j = 0; j < list.size(); ++j) {
|
|
|
|
d0 = ((AxisAlignedBB) list.get(j)).a(this.boundingBox, d0);
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
this.boundingBox.d(d0, 0.0D, 0.0D);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d5 != d0) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
for (j = 0; j < list.size(); ++j) {
|
|
|
|
d2 = ((AxisAlignedBB) list.get(j)).c(this.boundingBox, d2);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
this.boundingBox.d(0.0D, 0.0D, d2);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d7 != d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
double d9;
|
|
|
|
double d10;
|
|
|
|
int k;
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.bM > 0.0F && flag1 && (flag || this.bL < 0.05F) && (d5 != d0 || d7 != d2)) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d9 = d0;
|
|
|
|
d10 = d1;
|
|
|
|
double d11 = d2;
|
|
|
|
|
|
|
|
d0 = d5;
|
2011-11-20 09:01:14 +01:00
|
|
|
d1 = (double) this.bM;
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = d7;
|
2011-04-20 19:05:14 +02:00
|
|
|
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
this.boundingBox.b(axisalignedbb);
|
2011-04-20 19:05:14 +02:00
|
|
|
list = this.world.getEntities(this, this.boundingBox.a(d5, d1, d7));
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
for (k = 0; k < list.size(); ++k) {
|
|
|
|
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.boundingBox.d(0.0D, d1, 0.0D);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d6 != d1) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k = 0; k < list.size(); ++k) {
|
|
|
|
d0 = ((AxisAlignedBB) list.get(k)).a(this.boundingBox, d0);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.boundingBox.d(d0, 0.0D, 0.0D);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d5 != d0) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k = 0; k < list.size(); ++k) {
|
|
|
|
d2 = ((AxisAlignedBB) list.get(k)).c(this.boundingBox, d2);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.boundingBox.d(0.0D, 0.0D, d2);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d7 != d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!this.bA && d6 != d1) {
|
2011-05-26 14:48:22 +02:00
|
|
|
d2 = 0.0D;
|
|
|
|
d1 = 0.0D;
|
|
|
|
d0 = 0.0D;
|
|
|
|
} else {
|
2011-11-20 09:01:14 +01:00
|
|
|
d1 = (double) (-this.bM);
|
2011-05-26 14:48:22 +02:00
|
|
|
|
|
|
|
for (k = 0; k < list.size(); ++k) {
|
|
|
|
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.boundingBox.d(0.0D, d1, 0.0D);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (d9 * d9 + d11 * d11 >= d0 * d0 + d2 * d2) {
|
|
|
|
d0 = d9;
|
|
|
|
d1 = d10;
|
|
|
|
d2 = d11;
|
|
|
|
this.boundingBox.b(axisalignedbb1);
|
|
|
|
} else {
|
2011-05-26 14:48:22 +02:00
|
|
|
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
|
|
|
|
|
|
|
|
if (d12 > 0.0D) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bL = (float) ((double) this.bL + d12 + 0.01D);
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-26 18:27:39 +01:00
|
|
|
// MethodProfiler.a(); // CraftBukkit -- not in production code
|
|
|
|
// MethodProfiler.a("rest"); // CraftBukkit -- not in production code
|
2011-01-29 22:50:29 +01:00
|
|
|
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.positionChanged = d5 != d0 || d7 != d2;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bw = d6 != d1;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.onGround = d6 != d1 && d6 < 0.0D;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bx = this.positionChanged || this.bw;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.a(d1, this.onGround);
|
|
|
|
if (d5 != d0) {
|
|
|
|
this.motX = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (d6 != d1) {
|
|
|
|
this.motY = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (d7 != d2) {
|
|
|
|
this.motZ = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
d9 = this.locX - d3;
|
|
|
|
d10 = this.locZ - d4;
|
|
|
|
int l;
|
|
|
|
int i1;
|
|
|
|
int j1;
|
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
if ((this.positionChanged) && (this.getBukkitEntity() instanceof Vehicle)) {
|
|
|
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
|
|
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
|
2011-01-31 23:25:27 +01:00
|
|
|
|
|
|
|
if (d5 > d0) {
|
2011-07-17 15:02:32 +02:00
|
|
|
block = block.getRelative(BlockFace.SOUTH);
|
2011-01-31 23:25:27 +01:00
|
|
|
} else if (d5 < d0) {
|
2011-07-17 15:02:32 +02:00
|
|
|
block = block.getRelative(BlockFace.NORTH);
|
2011-01-31 23:25:27 +01:00
|
|
|
} else if (d7 > d2) {
|
2011-07-17 15:02:32 +02:00
|
|
|
block = block.getRelative(BlockFace.WEST);
|
2011-01-31 23:25:27 +01:00
|
|
|
} else if (d7 < d2) {
|
2011-07-17 15:02:32 +02:00
|
|
|
block = block.getRelative(BlockFace.EAST);
|
2011-01-31 23:25:27 +01:00
|
|
|
}
|
|
|
|
|
2011-03-26 22:32:56 +01:00
|
|
|
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
|
2011-06-27 00:25:01 +02:00
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-01-31 23:25:27 +01:00
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit end
|
2011-01-31 23:25:27 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.g_() && !flag && this.vehicle == null) {
|
|
|
|
this.bG = (float) ((double) this.bG + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
|
2011-04-20 19:05:14 +02:00
|
|
|
l = MathHelper.floor(this.locX);
|
|
|
|
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
|
|
|
j1 = MathHelper.floor(this.locZ);
|
2011-01-29 22:50:29 +01:00
|
|
|
k = this.world.getTypeId(l, i1, j1);
|
2011-11-20 09:01:14 +01:00
|
|
|
if (k == 0 && this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) {
|
2011-05-26 14:48:22 +02:00
|
|
|
k = this.world.getTypeId(l, i1 - 1, j1);
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.bG > (float) this.b && k > 0) {
|
|
|
|
this.b = (int) this.bG + 1;
|
|
|
|
this.a(l, i1, j1, k);
|
2011-01-29 22:50:29 +01:00
|
|
|
Block.byId[k].b(this.world, l, i1, j1, this);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
l = MathHelper.floor(this.boundingBox.a + 0.0010D);
|
|
|
|
i1 = MathHelper.floor(this.boundingBox.b + 0.0010D);
|
|
|
|
j1 = MathHelper.floor(this.boundingBox.c + 0.0010D);
|
|
|
|
k = MathHelper.floor(this.boundingBox.d - 0.0010D);
|
|
|
|
int k1 = MathHelper.floor(this.boundingBox.e - 0.0010D);
|
|
|
|
int l1 = MathHelper.floor(this.boundingBox.f - 0.0010D);
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (this.world.a(l, i1, j1, k, k1, l1)) {
|
|
|
|
for (int i2 = l; i2 <= k; ++i2) {
|
|
|
|
for (int j2 = i1; j2 <= k1; ++j2) {
|
|
|
|
for (int k2 = j1; k2 <= l1; ++k2) {
|
|
|
|
int l2 = this.world.getTypeId(i2, j2, k2);
|
|
|
|
|
|
|
|
if (l2 > 0) {
|
|
|
|
Block.byId[l2].a(this.world, i2, j2, k2, this);
|
|
|
|
}
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
boolean flag2 = this.ay();
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.burn(1);
|
2011-01-29 22:50:29 +01:00
|
|
|
if (!flag2) {
|
|
|
|
++this.fireTicks;
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit start - not on fire yet
|
2011-11-29 08:10:05 +01:00
|
|
|
if (this.fireTicks <= 0) { // only throw events on the first combust, otherwise it spams
|
|
|
|
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
2011-06-27 00:25:01 +02:00
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
if (!event.isCancelled()) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(event.getDuration());
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-11-20 09:01:14 +01:00
|
|
|
// CraftBukkit end
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(8);
|
2011-01-18 06:30:01 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
} else if (this.fireTicks <= 0) {
|
|
|
|
this.fireTicks = -this.maxFireTicks;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag2 && this.fireTicks > 0) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.world.makeSound(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
2011-01-29 22:50:29 +01:00
|
|
|
this.fireTicks = -this.maxFireTicks;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
|
2011-11-26 18:27:39 +01:00
|
|
|
// MethodProfiler.a(); // CraftBukkit -- not in production code
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(int i, int j, int k, int l) {
|
|
|
|
StepSound stepsound = Block.byId[l].stepSound;
|
|
|
|
|
|
|
|
if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) {
|
|
|
|
stepsound = Block.SNOW.stepSound;
|
|
|
|
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
|
|
|
|
} else if (!Block.byId[l].material.isLiquid()) {
|
|
|
|
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
protected boolean g_() {
|
2011-03-31 22:40:00 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
protected void a(double d0, boolean flag) {
|
2011-01-03 12:37:41 +01:00
|
|
|
if (flag) {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (this.fallDistance > 0.0F) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.b(this.fallDistance);
|
2011-01-29 22:50:29 +01:00
|
|
|
this.fallDistance = 0.0F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
} else if (d0 < 0.0D) {
|
|
|
|
this.fallDistance = (float) ((double) this.fallDistance - d0);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public AxisAlignedBB h_() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
protected void burn(int i) {
|
|
|
|
if (!this.fireProof) {
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start
|
2011-02-23 03:37:56 +01:00
|
|
|
if (this instanceof EntityLiving) {
|
2011-06-27 00:25:01 +02:00
|
|
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i);
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-01-11 09:25:13 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (event.isCancelled()) {
|
2011-02-23 13:56:36 +01:00
|
|
|
return;
|
2011-01-12 06:48:19 +01:00
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
|
|
|
|
i = event.getDamage();
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit end
|
2011-09-15 18:36:27 +02:00
|
|
|
this.damageEntity(DamageSource.FIRE, i);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
public final boolean isFireproof() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return this.fireProof;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void b(float f) {
|
2011-05-26 14:48:22 +02:00
|
|
|
if (this.passenger != null) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.passenger.b(f);
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-04-20 22:47:26 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean ay() {
|
|
|
|
return this.bS || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean az() {
|
|
|
|
return this.bS;
|
2011-04-20 22:47:26 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean i_() {
|
2011-05-26 14:48:22 +02:00
|
|
|
return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D).shrink(0.0010D, 0.0010D, 0.0010D), Material.WATER, this);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(Material material) {
|
2011-11-20 09:01:14 +01:00
|
|
|
double d0 = this.locY + (double) this.x();
|
2011-04-20 19:05:14 +02:00
|
|
|
int i = MathHelper.floor(this.locX);
|
|
|
|
int j = MathHelper.d((float) MathHelper.floor(d0));
|
|
|
|
int k = MathHelper.floor(this.locZ);
|
2011-01-29 22:50:29 +01:00
|
|
|
int l = this.world.getTypeId(i, j, k);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (l != 0 && Block.byId[l].material == material) {
|
2011-11-20 09:01:14 +01:00
|
|
|
float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F;
|
2011-01-29 22:50:29 +01:00
|
|
|
float f1 = (float) (j + 1) - f;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
return d0 < (double) f1;
|
2011-01-03 12:37:41 +01:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public float x() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return 0.0F;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean aA() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
public void a(float f, float f1, float f2) {
|
|
|
|
float f3 = MathHelper.c(f * f + f1 * f1);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (f3 >= 0.01F) {
|
|
|
|
if (f3 < 1.0F) {
|
|
|
|
f3 = 1.0F;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
f3 = f2 / f3;
|
|
|
|
f *= f3;
|
|
|
|
f1 *= f3;
|
2011-04-20 19:05:14 +02:00
|
|
|
float f4 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F);
|
|
|
|
float f5 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
this.motX += (double) (f * f5 - f1 * f4);
|
|
|
|
this.motZ += (double) (f1 * f5 + f * f4);
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public float a(float f) {
|
2011-04-20 19:05:14 +02:00
|
|
|
int i = MathHelper.floor(this.locX);
|
2011-09-15 02:23:52 +02:00
|
|
|
int j = MathHelper.floor(this.locZ);
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.world.isLoaded(i, this.world.height / 2, j)) {
|
2011-09-15 02:23:52 +02:00
|
|
|
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
|
|
|
|
int k = MathHelper.floor(this.locY - (double) this.height + d0);
|
2011-06-30 00:02:25 +02:00
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
return this.world.m(i, k, j);
|
2011-06-30 00:02:25 +02:00
|
|
|
} else {
|
2011-09-15 02:23:52 +02:00
|
|
|
return 0.0F;
|
2011-06-30 00:02:25 +02:00
|
|
|
}
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
public void spawnIn(World world) {
|
2011-06-08 19:40:40 +02:00
|
|
|
// CraftBukkit start
|
2011-06-12 00:02:58 +02:00
|
|
|
if (world == null) {
|
2011-06-08 19:40:40 +02:00
|
|
|
this.die();
|
2011-06-27 00:25:01 +02:00
|
|
|
this.world = ((org.bukkit.craftbukkit.CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
|
|
|
return;
|
2011-06-08 19:40:40 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-27 00:25:01 +02:00
|
|
|
this.world = world;
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void setLocation(double d0, double d1, double d2, float f, float f1) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.lastX = this.locX = d0;
|
|
|
|
this.lastY = this.locY = d1;
|
|
|
|
this.lastZ = this.locZ = d2;
|
|
|
|
this.lastYaw = this.yaw = f;
|
|
|
|
this.lastPitch = this.pitch = f1;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bL = 0.0F;
|
2011-01-29 22:50:29 +01:00
|
|
|
double d3 = (double) (this.lastYaw - f);
|
|
|
|
|
|
|
|
if (d3 < -180.0D) {
|
|
|
|
this.lastYaw += 360.0F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
if (d3 >= 180.0D) {
|
|
|
|
this.lastYaw -= 360.0F;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
this.setPosition(this.locX, this.locY, this.locZ);
|
2011-02-23 03:37:56 +01:00
|
|
|
this.c(f, f1);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.bI = this.lastX = this.locX = d0;
|
|
|
|
this.bJ = this.lastY = this.locY = d1 + (double) this.height;
|
|
|
|
this.bK = this.lastZ = this.locZ = d2;
|
2011-01-29 22:50:29 +01:00
|
|
|
this.yaw = f;
|
|
|
|
this.pitch = f1;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.setPosition(this.locX, this.locY, this.locZ);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public float h(Entity entity) {
|
2011-01-29 22:50:29 +01:00
|
|
|
float f = (float) (this.locX - entity.locX);
|
|
|
|
float f1 = (float) (this.locY - entity.locY);
|
|
|
|
float f2 = (float) (this.locZ - entity.locZ);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
return MathHelper.c(f * f + f1 * f1 + f2 * f2);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-07-08 14:25:53 +02:00
|
|
|
public double e(double d0, double d1, double d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
double d3 = this.locX - d0;
|
|
|
|
double d4 = this.locY - d1;
|
|
|
|
double d5 = this.locZ - d2;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
return d3 * d3 + d4 * d4 + d5 * d5;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-07-08 14:25:53 +02:00
|
|
|
public double f(double d0, double d1, double d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
double d3 = this.locX - d0;
|
|
|
|
double d4 = this.locY - d1;
|
|
|
|
double d5 = this.locZ - d2;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public double i(Entity entity) {
|
2011-01-29 22:50:29 +01:00
|
|
|
double d0 = this.locX - entity.locX;
|
|
|
|
double d1 = this.locY - entity.locY;
|
|
|
|
double d2 = this.locZ - entity.locZ;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
return d0 * d0 + d1 * d1 + d2 * d2;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
public void a_(EntityHuman entityhuman) {}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void collide(Entity entity) {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (entity.passenger != this && entity.vehicle != this) {
|
|
|
|
double d0 = entity.locX - this.locX;
|
|
|
|
double d1 = entity.locZ - this.locZ;
|
|
|
|
double d2 = MathHelper.a(d0, d1);
|
|
|
|
|
|
|
|
if (d2 >= 0.009999999776482582D) {
|
|
|
|
d2 = (double) MathHelper.a(d2);
|
|
|
|
d0 /= d2;
|
|
|
|
d1 /= d2;
|
|
|
|
double d3 = 1.0D / d2;
|
|
|
|
|
|
|
|
if (d3 > 1.0D) {
|
|
|
|
d3 = 1.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
d0 *= d3;
|
|
|
|
d1 *= d3;
|
|
|
|
d0 *= 0.05000000074505806D;
|
|
|
|
d1 *= 0.05000000074505806D;
|
2011-11-20 09:01:14 +01:00
|
|
|
d0 *= (double) (1.0F - this.bO);
|
|
|
|
d1 *= (double) (1.0F - this.bO);
|
|
|
|
this.b_(-d0, 0.0D, -d1);
|
|
|
|
entity.b_(d0, 0.0D, d1);
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void b_(double d0, double d1, double d2) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.motX += d0;
|
|
|
|
this.motY += d1;
|
|
|
|
this.motZ += d2;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.cb = true;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
protected void aB() {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.velocityChanged = true;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
public boolean damageEntity(DamageSource damagesource, int i) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.aB();
|
2011-01-03 12:37:41 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean e_() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean f_() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
public void b(Entity entity, int i) {}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
|
|
|
public boolean c(NBTTagCompound nbttagcompound) {
|
2011-11-20 09:01:14 +01:00
|
|
|
String s = this.aC();
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
if (!this.dead && s != null) {
|
2011-04-20 19:05:14 +02:00
|
|
|
nbttagcompound.setString("id", s);
|
2011-01-29 22:50:29 +01:00
|
|
|
this.d(nbttagcompound);
|
2011-01-03 12:37:41 +01:00
|
|
|
return true;
|
2011-01-29 22:50:29 +01:00
|
|
|
} else {
|
|
|
|
return false;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void d(NBTTagCompound nbttagcompound) {
|
2011-11-30 00:17:43 +01:00
|
|
|
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ}));
|
|
|
|
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
2011-04-25 02:14:33 +02:00
|
|
|
|
|
|
|
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
|
|
|
|
// TODO: make sure this is the best way to address this.
|
|
|
|
if (Float.isNaN(this.yaw)) {
|
|
|
|
this.yaw = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Float.isNaN(this.pitch)) {
|
|
|
|
this.pitch = 0;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
|
|
|
|
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
|
|
|
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
|
|
|
nbttagcompound.setShort("Air", (short) this.getAirTicks());
|
|
|
|
nbttagcompound.setBoolean("OnGround", this.onGround);
|
2011-06-12 00:02:58 +02:00
|
|
|
// CraftBukkit start
|
2011-07-13 06:06:07 +02:00
|
|
|
nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits());
|
|
|
|
nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits());
|
2011-06-27 00:25:01 +02:00
|
|
|
nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
|
|
|
nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
2011-06-12 00:02:58 +02:00
|
|
|
// CraftBukkit end
|
2011-04-20 22:47:26 +02:00
|
|
|
this.b(nbttagcompound);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void e(NBTTagCompound nbttagcompound) {
|
2011-11-30 00:17:43 +01:00
|
|
|
NBTTagList nbttaglist = nbttagcompound.getList("Pos");
|
|
|
|
NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
|
|
|
|
NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation");
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
|
|
|
|
this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
|
|
|
|
this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
|
2011-06-12 00:02:58 +02:00
|
|
|
/* CraftBukkit start - moved section down
|
|
|
|
if (Math.abs(this.motX) > 10.0D) {
|
|
|
|
this.motX = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(this.motY) > 10.0D) {
|
|
|
|
this.motY = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(this.motZ) > 10.0D) {
|
|
|
|
this.motZ = 0.0D;
|
|
|
|
}
|
|
|
|
// CraftBukkit end */
|
2011-05-26 14:48:22 +02:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
|
|
|
|
this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
|
|
|
|
this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
|
|
|
|
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
|
|
|
|
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
|
|
|
|
this.fallDistance = nbttagcompound.getFloat("FallDistance");
|
|
|
|
this.fireTicks = nbttagcompound.getShort("Fire");
|
|
|
|
this.setAirTicks(nbttagcompound.getShort("Air"));
|
|
|
|
this.onGround = nbttagcompound.getBoolean("OnGround");
|
2011-04-20 19:05:14 +02:00
|
|
|
this.setPosition(this.locX, this.locY, this.locZ);
|
2011-06-07 10:21:33 +02:00
|
|
|
|
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
long least = nbttagcompound.getLong("UUIDLeast");
|
|
|
|
long most = nbttagcompound.getLong("UUIDMost");
|
2011-06-07 10:21:33 +02:00
|
|
|
|
|
|
|
if (least != 0L && most != 0L) {
|
|
|
|
this.uniqueId = new UUID(most, least);
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
this.c(this.yaw, this.pitch);
|
2011-04-20 22:47:26 +02:00
|
|
|
this.a(nbttagcompound);
|
2011-05-24 04:42:30 +02:00
|
|
|
|
|
|
|
// CraftBukkit start - Exempt Vehicles from notch's sanity check
|
2011-06-27 00:25:01 +02:00
|
|
|
if (!(this.getBukkitEntity() instanceof Vehicle)) {
|
2011-05-24 04:42:30 +02:00
|
|
|
if (Math.abs(this.motX) > 10.0D) {
|
|
|
|
this.motX = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(this.motY) > 10.0D) {
|
|
|
|
this.motY = 0.0D;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Math.abs(this.motZ) > 10.0D) {
|
|
|
|
this.motZ = 0.0D;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-06-10 11:45:17 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit start - reset world
|
2011-07-13 07:16:59 +02:00
|
|
|
if (this instanceof EntityPlayer) {
|
|
|
|
org.bukkit.Server server = Bukkit.getServer();
|
|
|
|
org.bukkit.World bworld = null;
|
2011-06-27 00:25:01 +02:00
|
|
|
|
2011-07-13 07:16:59 +02:00
|
|
|
// TODO: Remove World related checks, replaced with WorldUID.
|
|
|
|
String worldName = nbttagcompound.getString("World");
|
2011-06-27 00:25:01 +02:00
|
|
|
|
2011-07-13 07:16:59 +02:00
|
|
|
if (nbttagcompound.hasKey("WorldUUIDMost") && nbttagcompound.hasKey("WorldUUIDLeast")) {
|
|
|
|
UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"));
|
|
|
|
bworld = server.getWorld(uid);
|
|
|
|
} else {
|
|
|
|
bworld = server.getWorld(worldName);
|
|
|
|
}
|
|
|
|
if (bworld == null) {
|
|
|
|
EntityPlayer entityPlayer = (EntityPlayer) this;
|
|
|
|
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
|
|
|
|
}
|
2011-06-16 05:24:31 +02:00
|
|
|
|
2011-07-13 07:16:59 +02:00
|
|
|
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());
|
|
|
|
}
|
2011-06-27 00:25:01 +02:00
|
|
|
// CraftBukkit end
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
protected final String aC() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return EntityTypes.b(this);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract void a(NBTTagCompound nbttagcompound);
|
|
|
|
|
2011-04-20 22:47:26 +02:00
|
|
|
protected abstract void b(NBTTagCompound nbttagcompound);
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
protected NBTTagList a(double... adouble) {
|
2011-01-03 12:37:41 +01:00
|
|
|
NBTTagList nbttaglist = new NBTTagList();
|
2011-01-29 22:50:29 +01:00
|
|
|
double[] adouble1 = adouble;
|
|
|
|
int i = adouble.length;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
for (int j = 0; j < i; ++j) {
|
|
|
|
double d0 = adouble1[j];
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
nbttaglist.add(new NBTTagDouble((String) null, d0));
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return nbttaglist;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
protected NBTTagList a(float... afloat) {
|
2011-01-03 12:37:41 +01:00
|
|
|
NBTTagList nbttaglist = new NBTTagList();
|
2011-01-29 22:50:29 +01:00
|
|
|
float[] afloat1 = afloat;
|
|
|
|
int i = afloat.length;
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
for (int j = 0; j < i; ++j) {
|
|
|
|
float f = afloat1[j];
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
nbttaglist.add(new NBTTagFloat((String) null, f));
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return nbttaglist;
|
|
|
|
}
|
|
|
|
|
2011-02-23 03:37:56 +01:00
|
|
|
public EntityItem b(int i, int j) {
|
2011-01-29 22:50:29 +01:00
|
|
|
return this.a(i, j, 0.0F);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
public EntityItem a(int i, int j, float f) {
|
|
|
|
return this.a(new ItemStack(i, j, 0), f);
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
public EntityItem a(ItemStack itemstack, float f) {
|
|
|
|
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
entityitem.pickupDelay = 10;
|
|
|
|
this.world.addEntity(entityitem);
|
2011-01-03 12:37:41 +01:00
|
|
|
return entityitem;
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
public boolean isAlive() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return !this.dead;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean T() {
|
2011-05-26 14:48:22 +02:00
|
|
|
for (int i = 0; i < 8; ++i) {
|
2011-11-30 00:17:43 +01:00
|
|
|
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.width * 0.8F;
|
2011-05-26 14:48:22 +02:00
|
|
|
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
|
2011-11-30 00:17:43 +01:00
|
|
|
float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.width * 0.8F;
|
2011-05-26 14:48:22 +02:00
|
|
|
int j = MathHelper.floor(this.locX + (double) f);
|
2011-11-20 09:01:14 +01:00
|
|
|
int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1);
|
2011-05-26 14:48:22 +02:00
|
|
|
int l = MathHelper.floor(this.locZ + (double) f2);
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
if (this.world.e(j, k, l)) {
|
2011-05-26 14:48:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
return false;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
public boolean b(EntityHuman entityhuman) {
|
2011-01-03 12:37:41 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public AxisAlignedBB a_(Entity entity) {
|
2011-01-03 12:37:41 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void M() {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (this.vehicle.dead) {
|
|
|
|
this.vehicle = null;
|
|
|
|
} else {
|
|
|
|
this.motX = 0.0D;
|
|
|
|
this.motY = 0.0D;
|
|
|
|
this.motZ = 0.0D;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.w_();
|
2011-05-26 14:48:22 +02:00
|
|
|
if (this.vehicle != null) {
|
2011-11-20 09:01:14 +01:00
|
|
|
this.vehicle.i();
|
|
|
|
this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
for (this.e += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.f >= 180.0D; this.f -= 360.0D) {
|
2011-05-26 14:48:22 +02:00
|
|
|
;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
while (this.f < -180.0D) {
|
|
|
|
this.f += 360.0D;
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
while (this.e >= 180.0D) {
|
|
|
|
this.e -= 360.0D;
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
while (this.e < -180.0D) {
|
|
|
|
this.e += 360.0D;
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
double d0 = this.f * 0.5D;
|
|
|
|
double d1 = this.e * 0.5D;
|
2011-05-26 14:48:22 +02:00
|
|
|
float f = 10.0F;
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (d0 > (double) f) {
|
|
|
|
d0 = (double) f;
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (d0 < (double) (-f)) {
|
|
|
|
d0 = (double) (-f);
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (d1 > (double) f) {
|
|
|
|
d1 = (double) f;
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (d1 < (double) (-f)) {
|
|
|
|
d1 = (double) (-f);
|
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
this.f -= d0;
|
|
|
|
this.e -= d1;
|
2011-05-26 14:48:22 +02:00
|
|
|
this.yaw = (float) ((double) this.yaw + d0);
|
|
|
|
this.pitch = (float) ((double) this.pitch + d1);
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void i() {
|
|
|
|
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.R(), this.locZ);
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public double R() {
|
2011-01-29 22:50:29 +01:00
|
|
|
return (double) this.height;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public double q() {
|
2011-11-30 00:17:43 +01:00
|
|
|
return (double) this.length * 0.75D;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void mount(Entity entity) {
|
2011-01-11 09:25:13 +01:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
this.setPassengerOf(entity);
|
2011-01-11 09:25:13 +01:00
|
|
|
}
|
|
|
|
|
2011-01-30 16:15:17 +01:00
|
|
|
protected org.bukkit.entity.Entity bukkitEntity;
|
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
public org.bukkit.entity.Entity getBukkitEntity() {
|
2011-06-27 00:25:01 +02:00
|
|
|
if (this.bukkitEntity == null) {
|
|
|
|
this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this);
|
2011-01-30 16:15:17 +01:00
|
|
|
}
|
2011-06-27 00:25:01 +02:00
|
|
|
return this.bukkitEntity;
|
2011-01-29 22:50:29 +01:00
|
|
|
}
|
|
|
|
|
2011-01-08 01:26:08 +01:00
|
|
|
public void setPassengerOf(Entity entity) {
|
2011-02-23 03:37:56 +01:00
|
|
|
// b(null) doesn't really fly for overloaded methods,
|
2011-01-08 01:26:08 +01:00
|
|
|
// so this method is needed
|
2011-01-11 09:25:13 +01:00
|
|
|
|
2011-01-21 06:54:30 +01:00
|
|
|
// CraftBukkit end
|
2011-01-29 22:50:29 +01:00
|
|
|
this.e = 0.0D;
|
2011-11-20 09:01:14 +01:00
|
|
|
this.f = 0.0D;
|
2011-01-03 12:37:41 +01:00
|
|
|
if (entity == null) {
|
2011-01-29 22:50:29 +01:00
|
|
|
if (this.vehicle != null) {
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
|
|
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-02-01 11:02:43 +01:00
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit end
|
2011-02-01 11:02:43 +01:00
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
2011-01-29 22:50:29 +01:00
|
|
|
this.vehicle.passenger = null;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
2011-01-29 22:50:29 +01:00
|
|
|
|
|
|
|
this.vehicle = null;
|
|
|
|
} else if (this.vehicle == entity) {
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit start
|
2011-06-27 00:25:01 +02:00
|
|
|
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
|
|
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
|
|
|
this.world.getServer().getPluginManager().callEvent(event);
|
2011-02-01 11:02:43 +01:00
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit end
|
2011-02-01 11:02:43 +01:00
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
this.vehicle.passenger = null;
|
|
|
|
this.vehicle = null;
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch);
|
2011-01-29 22:50:29 +01:00
|
|
|
} else {
|
|
|
|
if (this.vehicle != null) {
|
|
|
|
this.vehicle.passenger = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entity.passenger != null) {
|
|
|
|
entity.passenger.vehicle = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.vehicle = entity;
|
|
|
|
entity.passenger = this;
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public float j_() {
|
|
|
|
return 0.1F;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Vec3D ap() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void Y() {}
|
2011-01-03 12:37:41 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public ItemStack[] getEquipment() {
|
2011-01-03 12:37:41 +01:00
|
|
|
return null;
|
|
|
|
}
|
2011-01-14 14:31:10 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public boolean z() {
|
|
|
|
return this.fireTicks > 0 || this.k(0);
|
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public boolean isSneaking() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return this.k(1);
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void setSneak(boolean flag) {
|
2011-01-29 22:50:29 +01:00
|
|
|
this.a(1, flag);
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
|
2011-09-24 23:03:31 +02:00
|
|
|
public boolean isSprinting() {
|
2011-11-20 09:01:14 +01:00
|
|
|
return this.k(3);
|
2011-09-15 02:23:52 +02:00
|
|
|
}
|
|
|
|
|
2011-09-24 23:03:31 +02:00
|
|
|
public void setSprinting(boolean flag) {
|
2011-09-15 02:23:52 +02:00
|
|
|
this.a(3, flag);
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void g(boolean flag) {
|
2011-09-15 02:23:52 +02:00
|
|
|
this.a(4, flag);
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
protected boolean k(int i) {
|
2011-09-24 23:03:31 +02:00
|
|
|
return (this.datawatcher.getByte(0) & 1 << i) != 0;
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:50:29 +01:00
|
|
|
protected void a(int i, boolean flag) {
|
2011-09-24 23:03:31 +02:00
|
|
|
byte b0 = this.datawatcher.getByte(0);
|
2011-01-14 14:31:10 +01:00
|
|
|
|
|
|
|
if (flag) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << i)));
|
2011-01-14 14:31:10 +01:00
|
|
|
} else {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.datawatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << i))));
|
2011-01-14 14:31:10 +01:00
|
|
|
}
|
|
|
|
}
|
2011-04-20 22:47:26 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public int getAirTicks() {
|
|
|
|
return this.datawatcher.b(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAirTicks(int i) {
|
|
|
|
this.datawatcher.watch(1, Short.valueOf((short) i));
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
public void a(EntityWeatherLighting entityweatherlighting) {
|
2011-05-14 16:29:42 +02:00
|
|
|
// CraftBukkit start
|
2011-11-29 08:10:05 +01:00
|
|
|
final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
|
2011-11-30 00:17:43 +01:00
|
|
|
final org.bukkit.entity.Entity stormBukkitEntity = entityweatherlighting.getBukkitEntity();
|
2011-12-05 09:13:10 +01:00
|
|
|
final PluginManager pluginManager = Bukkit.getPluginManager();
|
2011-11-29 08:10:05 +01:00
|
|
|
|
|
|
|
if (thisBukkitEntity instanceof Painting) {
|
|
|
|
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((Painting) thisBukkitEntity, stormBukkitEntity);
|
|
|
|
pluginManager.callEvent(event);
|
|
|
|
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(stormBukkitEntity, thisBukkitEntity, EntityDamageEvent.DamageCause.LIGHTNING, 5);
|
|
|
|
pluginManager.callEvent(event);
|
2011-05-14 16:29:42 +02:00
|
|
|
|
2011-04-21 18:29:35 +02:00
|
|
|
if (event.isCancelled()) {
|
|
|
|
return;
|
|
|
|
}
|
2011-05-14 16:29:42 +02:00
|
|
|
|
2011-06-27 00:25:01 +02:00
|
|
|
this.burn(event.getDamage());
|
2011-05-14 16:29:42 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
|
2011-04-20 22:47:26 +02:00
|
|
|
++this.fireTicks;
|
|
|
|
if (this.fireTicks == 0) {
|
2011-11-29 08:10:05 +01:00
|
|
|
// CraftBukkit start - raise a combust event when lightning strikes
|
|
|
|
EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
|
|
|
pluginManager.callEvent(entityCombustEvent);
|
|
|
|
if (!entityCombustEvent.isCancelled()) {
|
2011-11-30 00:17:43 +01:00
|
|
|
this.setOnFire(entityCombustEvent.getDuration());
|
2011-11-29 08:10:05 +01:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-04-20 22:47:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(EntityLiving entityliving) {}
|
2011-05-26 14:48:22 +02:00
|
|
|
|
|
|
|
protected boolean g(double d0, double d1, double d2) {
|
|
|
|
int i = MathHelper.floor(d0);
|
|
|
|
int j = MathHelper.floor(d1);
|
|
|
|
int k = MathHelper.floor(d2);
|
|
|
|
double d3 = d0 - (double) i;
|
|
|
|
double d4 = d1 - (double) j;
|
|
|
|
double d5 = d2 - (double) k;
|
|
|
|
|
2011-06-30 00:02:25 +02:00
|
|
|
if (this.world.e(i, j, k)) {
|
|
|
|
boolean flag = !this.world.e(i - 1, j, k);
|
|
|
|
boolean flag1 = !this.world.e(i + 1, j, k);
|
|
|
|
boolean flag2 = !this.world.e(i, j - 1, k);
|
|
|
|
boolean flag3 = !this.world.e(i, j + 1, k);
|
|
|
|
boolean flag4 = !this.world.e(i, j, k - 1);
|
|
|
|
boolean flag5 = !this.world.e(i, j, k + 1);
|
2011-05-26 14:48:22 +02:00
|
|
|
byte b0 = -1;
|
|
|
|
double d6 = 9999.0D;
|
|
|
|
|
|
|
|
if (flag && d3 < d6) {
|
|
|
|
d6 = d3;
|
|
|
|
b0 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag1 && 1.0D - d3 < d6) {
|
|
|
|
d6 = 1.0D - d3;
|
|
|
|
b0 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag2 && d4 < d6) {
|
|
|
|
d6 = d4;
|
|
|
|
b0 = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag3 && 1.0D - d4 < d6) {
|
|
|
|
d6 = 1.0D - d4;
|
|
|
|
b0 = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag4 && d5 < d6) {
|
|
|
|
d6 = d5;
|
|
|
|
b0 = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag5 && 1.0D - d5 < d6) {
|
|
|
|
d6 = 1.0D - d5;
|
|
|
|
b0 = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
float f = this.random.nextFloat() * 0.2F + 0.1F;
|
|
|
|
|
|
|
|
if (b0 == 0) {
|
|
|
|
this.motX = (double) (-f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 == 1) {
|
|
|
|
this.motX = (double) f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 == 2) {
|
|
|
|
this.motY = (double) (-f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 == 3) {
|
|
|
|
this.motY = (double) f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 == 4) {
|
|
|
|
this.motZ = (double) (-f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (b0 == 5) {
|
|
|
|
this.motZ = (double) f;
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2011-05-26 14:48:22 +02:00
|
|
|
}
|
2011-09-15 02:23:52 +02:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public void s() {
|
|
|
|
this.bz = true;
|
2011-09-15 02:23:52 +02:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public String ad() {
|
2011-09-15 02:23:52 +02:00
|
|
|
String s = EntityTypes.b(this);
|
|
|
|
|
|
|
|
if (s == null) {
|
|
|
|
s = "generic";
|
|
|
|
}
|
|
|
|
|
2011-11-30 00:17:43 +01:00
|
|
|
return LocaleI18n.a("entity." + s + ".name");
|
2011-09-15 02:23:52 +02:00
|
|
|
}
|
2011-11-20 09:01:14 +01:00
|
|
|
|
|
|
|
public Entity[] aG() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(Entity entity) {
|
|
|
|
return this == entity;
|
|
|
|
}
|
2011-01-03 12:37:41 +01:00
|
|
|
}
|