示例#1
0
 public EntityBolt(World world, EntityLiving entityliving, float f) {
   this(world);
   shooter = entityliving;
   shotByPlayer = entityliving instanceof EntityPlayer;
   this.setSize(0.5F, 0.5F);
   this.setLocationAndAngles(
       entityliving.posX,
       entityliving.posY + (double) entityliving.getEyeHeight(),
       entityliving.posZ,
       entityliving.rotationYaw,
       entityliving.rotationPitch);
   this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F);
   this.posY -= 0.10000000149011612D;
   this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F);
   this.setPosition(this.posX, this.posY, this.posZ);
   this.yOffset = 0.0F;
   this.motionX =
       (double)
           (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
               * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
   this.motionZ =
       (double)
           (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
               * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
   this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
   this.setArrowHeading(this.motionX, this.motionY, this.motionZ, f * 1.5F);
 }
示例#2
0
  public EntityArrow(
      World par1World,
      EntityLiving par2EntityLiving,
      EntityLiving par3EntityLiving,
      float par4,
      float par5) {
    super(par1World);
    this.xTile = -1;
    this.yTile = -1;
    this.zTile = -1;
    this.inTile = 0;
    this.inData = 0;
    this.inGround = false;
    this.field_70251_a = 0;
    this.arrowShake = 0;
    this.ticksInAir = 0;
    this.damage = 2D;
    this.shootingEntity = par2EntityLiving;

    if (par2EntityLiving instanceof EntityPlayer) {
      this.field_70251_a = 1;
    }

    this.posY = (par2EntityLiving.posY + par2EntityLiving.getEyeHeight()) - 0.10000000149011612D;
    double d = par3EntityLiving.posX - par2EntityLiving.posX;
    double d1 =
        (par3EntityLiving.posY + par3EntityLiving.getEyeHeight())
            - 0.69999998807907104D
            - this.posY;
    double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ;
    double d3 = MathHelper.sqrt_double(d * d + d2 * d2);

    if (d3 < 9.9999999999999995E-008D) {
      return;
    } else {
      float f = (float) ((Math.atan2(d2, d) * 180D) / Math.PI) - 90F;
      float f1 = (float) (-((Math.atan2(d1, d3) * 180D) / Math.PI));
      double d4 = d / d3;
      double d5 = d2 / d3;
      setLocationAndAngles(
          par2EntityLiving.posX + d4, this.posY, par2EntityLiving.posZ + d5, f, f1);
      this.yOffset = 0.0F;
      float f2 = (float) d3 * 0.2F;
      setArrowHeading(d, d1 + f2, d2, par4, par5);
      return;
    }
  }
 public static Vec3D projectViewFromEntity(EntityLiving par0EntityLiving, double par1) {
   double var3 =
       par0EntityLiving.prevPosX + (par0EntityLiving.posX - par0EntityLiving.prevPosX) * par1;
   double var5 =
       par0EntityLiving.prevPosY
           + (par0EntityLiving.posY - par0EntityLiving.prevPosY) * par1
           + (double) par0EntityLiving.getEyeHeight();
   double var7 =
       par0EntityLiving.prevPosZ + (par0EntityLiving.posZ - par0EntityLiving.prevPosZ) * par1;
   double var9 = var3 + (double) (objectX * 1.0F);
   double var11 = var5 + (double) (objectY * 1.0F);
   double var13 = var7 + (double) (objectZ * 1.0F);
   return Vec3D.createVector(var9, var11, var13);
 }
 public void faceEntity(Entity entity, float f) {
   double d = entity.posX - posX;
   double d2 = entity.posZ - posZ;
   double d1;
   if (entity instanceof EntityLiving) {
     EntityLiving entityliving = (EntityLiving) entity;
     d1 =
         (entityliving.posY + (double) entityliving.getEyeHeight())
             - (posY + (double) getEyeHeight());
   } else {
     d1 =
         (entity.boundingBox.minY + entity.boundingBox.maxY) / 2D
             - (posY + (double) getEyeHeight());
   }
   double d3 = MathHelper.sqrt_double(d * d + d2 * d2);
   float f1 = (float) ((Math.atan2(d2, d) * 180D) / 3.1415927410125732D) - 90F;
   float f2 = (float) ((Math.atan2(d1, d3) * 180D) / 3.1415927410125732D);
   rotationPitch = -updateRotation(rotationPitch, f2, f);
   rotationYaw = updateRotation(rotationYaw, f1, f);
 }
示例#5
0
  public EntityArrow(World par1World, EntityLiving par2EntityLiving, float par3) {
    super(par1World);
    this.xTile = -1;
    this.yTile = -1;
    this.zTile = -1;
    this.inTile = 0;
    this.inData = 0;
    this.inGround = false;
    this.field_70251_a = 0;
    this.arrowShake = 0;
    this.ticksInAir = 0;
    this.damage = 2D;
    this.shootingEntity = par2EntityLiving;

    if (par2EntityLiving instanceof EntityPlayer) {
      this.field_70251_a = 1;
    }

    setSize(0.5F, 0.5F);
    setLocationAndAngles(
        par2EntityLiving.posX,
        par2EntityLiving.posY + par2EntityLiving.getEyeHeight(),
        par2EntityLiving.posZ,
        par2EntityLiving.rotationYaw,
        par2EntityLiving.rotationPitch);
    this.posX -= MathHelper.cos((this.rotationYaw / 180F) * (float) Math.PI) * 0.16F;
    this.posY -= 0.10000000149011612D;
    this.posZ -= MathHelper.sin((this.rotationYaw / 180F) * (float) Math.PI) * 0.16F;
    setPosition(this.posX, this.posY, this.posZ);
    this.yOffset = 0.0F;
    this.motionX =
        -MathHelper.sin((this.rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((this.rotationPitch / 180F) * (float) Math.PI);
    this.motionZ =
        MathHelper.cos((this.rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((this.rotationPitch / 180F) * (float) Math.PI);
    this.motionY = -MathHelper.sin((this.rotationPitch / 180F) * (float) Math.PI);
    setArrowHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
  }