diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityEgg.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEgg.java | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 220e020d..32efe891 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -21,7 +21,7 @@ public class EntityEgg extends Entity { private int e = 0; private boolean f = false; public int a = 0; - private EntityLiving g; + private EntityLiving thrower; private int h; private int i = 0; @@ -34,19 +34,19 @@ public class EntityEgg extends Entity { public EntityEgg(World world, EntityLiving entityliving) { super(world); - this.g = entityliving; + this.thrower = 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); } @@ -54,7 +54,7 @@ public class EntityEgg 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; } @@ -95,7 +95,7 @@ public class EntityEgg extends Entity { if (i == this.e) { ++this.h; if (this.h == 1200) { - this.D(); + this.die(); } return; @@ -111,14 +111,14 @@ public class EntityEgg 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) { @@ -129,7 +129,7 @@ public class EntityEgg 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.thrower || this.i >= 5)) { float f = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); @@ -152,12 +152,12 @@ public class EntityEgg 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.thrower == null) ? null : this.thrower.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; @@ -168,13 +168,13 @@ public class EntityEgg extends Entity { if (!event.isCancelled()) { // this function returns if the egg should stick or not, i.e. !bounce - stick = movingobjectposition.g.a(this.g, event.getDamage()); + stick = movingobjectposition.entity.damageEntity(this.thrower, event.getDamage()); } else { // event was cancelled, get if the egg should bounce or not stick = !event.getBounce(); } } else { - stick = movingobjectposition.g.a(this.g, 0); + stick = movingobjectposition.entity.damageEntity(this.thrower, 0); } if (stick) { @@ -190,9 +190,9 @@ public class EntityEgg extends Entity { CreatureType hatchingType = CreatureType.CHICKEN; - if (this.g instanceof EntityPlayer) { + if (this.thrower instanceof EntityPlayer) { CraftServer server = ((WorldServer) this.world).getServer(); - Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity(); + Player player = (this.thrower == null) ? null : (Player) this.thrower.getBukkitEntity(); PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType); server.getPluginManager().callEvent(event); @@ -258,9 +258,9 @@ public class EntityEgg extends Entity { // The world we're spawning in accepts this creature boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal; - if ((isAnimal && this.world.E) || (!isAnimal && this.world.D)) { - entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F); - this.world.a(entity); + if ((isAnimal && this.world.allowAnimals) || (!isAnimal && this.world.allowMonsters)) { + entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); + this.world.addEntity(entity); } } } @@ -270,7 +270,7 @@ public class EntityEgg 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; @@ -315,7 +315,7 @@ public class EntityEgg 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) { @@ -337,10 +337,10 @@ public class EntityEgg 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.thrower == 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(); } } } |