diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityArrow.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityArrow.java | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 509e1181..140ae882 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -17,7 +17,7 @@ public class EntityArrow extends Entity { private int f = 0; private boolean g = false; public int a = 0; - public EntityLiving b; + public EntityLiving shooter; private int h; private int i = 0; @@ -29,23 +29,23 @@ public class EntityArrow extends Entity { public EntityArrow(World world, double d0, double d1, double d2) { super(world); this.b(0.5F, 0.5F); - this.a(d0, d1, d2); + this.setPosition(d0, d1, d2); this.height = 0.0F; } public EntityArrow(World world, EntityLiving entityliving) { super(world); - this.b = entityliving; + this.shooter = entityliving; this.b(0.5F, 0.5F); - this.c(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); - this.locX -= (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.q(), entityliving.locZ, entityliving.yaw, entityliving.pitch); + this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locY -= 0.10000000149011612D; - this.locZ -= (double) (MathHelper.a(this.yaw / 180.0F * 3.1415927F) * 0.16F); - this.a(this.locX, this.locY, this.locZ); + this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); + this.setPosition(this.locX, this.locY, this.locZ); this.height = 0.0F; - this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F)); - this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F)); - this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F)); + this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)); + this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)); + this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F)); this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); } @@ -92,7 +92,7 @@ public class EntityArrow extends Entity { if (i == this.f) { ++this.h; if (this.h == 1200) { - this.D(); + this.die(); } return; @@ -108,14 +108,14 @@ public class EntityArrow extends Entity { ++this.i; } - Vec3D vec3d = Vec3D.b(this.locX, this.locY, this.locZ); - Vec3D vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ); + Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1); - vec3d = Vec3D.b(this.locX, this.locY, this.locZ); - vec3d1 = Vec3D.b(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); + vec3d = Vec3D.create(this.locX, this.locY, this.locZ); + vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); if (movingobjectposition != null) { - vec3d1 = Vec3D.b(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); + vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); } Entity entity = null; @@ -127,7 +127,7 @@ public class EntityArrow extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.b || this.i >= 5)) { + if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -150,7 +150,7 @@ public class EntityArrow extends Entity { float f2; if (movingobjectposition != null) { - if (movingobjectposition.g != null) { + if (movingobjectposition.entity != null) { // CraftBukkit start boolean stick; if (entity instanceof EntityLiving) { @@ -158,8 +158,8 @@ public class EntityArrow extends Entity { // TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE // or leave as DamageCause.ENTITY_ATTACK - org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity(); - org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity(); + org.bukkit.entity.Entity shooter = (this.shooter == null) ? null : this.shooter.getBukkitEntity(); + org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); org.bukkit.entity.Entity projectile = this.getBukkitEntity(); // TODO deal with arrows being fired from a non-entity DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; @@ -169,18 +169,18 @@ public class EntityArrow extends Entity { server.getPluginManager().callEvent(event); if (!event.isCancelled()) { // this function returns if the arrow should stick in or not, i.e. !bounce - stick = movingobjectposition.g.a(this.b, event.getDamage()); + stick = movingobjectposition.entity.damageEntity(this.shooter, event.getDamage()); } else { // event was cancelled, get if the arrow should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.b, 4); + stick = movingobjectposition.entity.damageEntity(this.shooter, 4); } if (stick) { // CraftBukkit end - this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); - this.D(); + this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); + this.die(); } else { this.motX *= -0.10000000149011612D; this.motY *= -0.10000000149011612D; @@ -201,7 +201,7 @@ public class EntityArrow extends Entity { this.locX -= this.motX / (double) f2 * 0.05000000074505806D; this.locY -= this.motY / (double) f2 * 0.05000000074505806D; this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D; - this.world.a(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); + this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); this.g = true; this.a = 7; } @@ -248,7 +248,7 @@ public class EntityArrow extends Entity { this.motY *= (double) f3; this.motZ *= (double) f3; this.motY -= (double) f1; - this.a(this.locX, this.locY, this.locZ); + this.setPosition(this.locX, this.locY, this.locZ); } public void a(NBTTagCompound nbttagcompound) { @@ -271,10 +271,10 @@ public class EntityArrow extends Entity { public void b(EntityHuman entityhuman) { if (!this.world.isStatic) { - if (this.g && this.b == entityhuman && this.a <= 0 && entityhuman.inventory.a(new ItemStack(Item.ARROW, 1))) { - this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); - entityhuman.b(this, 1); - this.D(); + if (this.g && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) { + this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityhuman.receive(this, 1); + this.die(); } } } |