diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-04-20 19:05:14 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-04-20 19:05:14 +0200 |
commit | 483a878b8bcf1feb789cb5fd9374d0a060cc4d8a (patch) | |
tree | fb56faee3872a85282e2fa88235580589c826e45 /src/main/java/net/minecraft/server/EntitySnowball.java | |
parent | ac9f297445a6116c5bb314b3be9f38520a58845e (diff) | |
download | craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.gz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.lz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.tar.xz craftbukkit-483a878b8bcf1feb789cb5fd9374d0a060cc4d8a.zip |
Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySnowball.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySnowball.java | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index a2b8ee3c..2bd1eee4 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -17,7 +17,7 @@ public class EntitySnowball extends Entity { private int e = 0; private boolean f = false; public int a = 0; - private EntityLiving g; + private EntityLiving shooter; private int h; private int i = 0; @@ -30,19 +30,19 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world, EntityLiving entityliving) { super(world); - this.g = entityliving; + this.shooter = entityliving; this.b(0.25F, 0.25F); - 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; float f = 0.4F; - this.motX = (double) (-MathHelper.a(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f); - this.motZ = (double) (MathHelper.b(this.yaw / 180.0F * 3.1415927F) * MathHelper.b(this.pitch / 180.0F * 3.1415927F) * f); - this.motY = (double) (-MathHelper.a(this.pitch / 180.0F * 3.1415927F) * f); + this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f); + this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f); this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); } @@ -50,7 +50,7 @@ public class EntitySnowball extends Entity { super(world); this.h = 0; this.b(0.25F, 0.25F); - this.a(d0, d1, d2); + this.setPosition(d0, d1, d2); this.height = 0.0F; } @@ -91,7 +91,7 @@ public class EntitySnowball extends Entity { if (i == this.e) { ++this.h; if (this.h == 1200) { - this.D(); + this.die(); } return; @@ -107,14 +107,14 @@ public class EntitySnowball 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); } if (!this.world.isStatic) { @@ -125,7 +125,7 @@ public class EntitySnowball extends Entity { for (int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); - if (entity1.d_() && (entity1 != this.g || this.i >= 5)) { + if (entity1.d_() && (entity1 != this.shooter || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -148,12 +148,12 @@ public class EntitySnowball extends Entity { if (movingobjectposition != null) { // CraftBukkit start - if (movingobjectposition.g != null) { + if (movingobjectposition.entity != null) { boolean stick; - if (movingobjectposition.g instanceof EntityLiving) { + if (movingobjectposition.entity instanceof EntityLiving) { CraftServer server = ((WorldServer) this.world).getServer(); - org.bukkit.entity.Entity shooter = (this.g == null) ? null : this.g.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(); DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK; int damage = 0; @@ -164,13 +164,13 @@ public class EntitySnowball extends Entity { if (!event.isCancelled()) { // this function returns if the snowball should stick or not, i.e. !bounce - stick = movingobjectposition.g.a(this.g, event.getDamage()); + stick = movingobjectposition.entity.damageEntity(this.shooter, event.getDamage()); } else { // event was cancelled, get if the snowball should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.g, 0); + stick = movingobjectposition.entity.damageEntity(this.shooter, 0); } if (stick) { ; @@ -182,7 +182,7 @@ public class EntitySnowball extends Entity { this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); } - this.D(); + this.die(); } this.locX += this.motX; @@ -227,7 +227,7 @@ public class EntitySnowball extends Entity { this.motY *= (double) f2; this.motZ *= (double) f2; this.motY -= (double) f3; - this.a(this.locX, this.locY, this.locZ); + this.setPosition(this.locX, this.locY, this.locZ); } public void a(NBTTagCompound nbttagcompound) { @@ -249,10 +249,10 @@ public class EntitySnowball extends Entity { } public void b(EntityHuman entityhuman) { - if (this.f && this.g == 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.f && 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(); } } } |