public EntitySchrab(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_) {
    super(p_i1756_1_);
    this.renderDistanceWeight = 10.0D;
    this.shootingEntity = p_i1756_2_;

    if (p_i1756_2_ instanceof EntityPlayer) {
      this.canBePickedUp = 1;
    }

    this.setSize(0.5F, 0.5F);
    this.setLocationAndAngles(
        p_i1756_2_.posX,
        p_i1756_2_.posY + p_i1756_2_.getEyeHeight(),
        p_i1756_2_.posZ,
        p_i1756_2_.rotationYaw,
        p_i1756_2_.rotationPitch);
    this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    this.posY -= 0.10000000149011612D;
    this.posZ -= 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 =
        -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionZ =
        MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
    this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F);
  }
Ejemplo n.º 2
0
 public EntityBKnife(World var1, EntityLiving var2) {
   super(var1);
   this.owner = var2;
   this.renderDistanceWeight = 10.0D;
   this.doesArrowBelongToPlayer = var2 instanceof EntityPlayer;
   this.setSize(0.5F, 0.5F);
   this.setLocationAndAngles(
       var2.posX,
       var2.posY + (double) var2.getEyeHeight(),
       var2.posZ,
       var2.rotationYaw,
       var2.rotationPitch);
   this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F) * 0.16F);
   this.posY -= 0.10000000149011612D;
   this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F) * 0.16F);
   this.setPosition(this.posX, this.posY, this.posZ);
   this.yOffset = 0.0F;
   this.motionX =
       (double)
           (-MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F)
               * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));
   this.motionZ =
       (double)
           (MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F)
               * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));
   this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * 3.141593F));
   this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F);
 }
Ejemplo n.º 3
0
  protected void setVectorRotations(Vec3 vector, float xRot, float yRot, float zRot) {
    float x = xRot;
    float y = yRot;
    float z = zRot;
    float xC = MathHelper.cos(x);
    float xS = MathHelper.sin(x);
    float yC = MathHelper.cos(y);
    float yS = MathHelper.sin(y);
    float zC = MathHelper.cos(z);
    float zS = MathHelper.sin(z);

    double xVec = vector.xCoord;
    double yVec = vector.yCoord;
    double zVec = vector.zCoord;

    // rotation around x
    double xy = xC * yVec - xS * zVec;
    double xz = xC * zVec + xS * yVec;
    // rotation around y
    double yz = yC * xz - yS * xVec;
    double yx = yC * xVec + yS * xz;
    // rotation around z
    double zx = zC * yx - zS * xy;
    double zy = zC * xy + zS * yx;

    xVec = zx;
    yVec = zy;
    zVec = yz;

    vector.xCoord = xVec;
    vector.yCoord = yVec;
    vector.zCoord = zVec;
  }
Ejemplo n.º 4
0
 public EntityFishHook(World worldIn, Player fishingPlayer) {
   super(worldIn);
   this.ignoreFrustumCheck = true;
   this.angler = fishingPlayer;
   this.angler.fishEntity = this;
   this.setSize(0.25F, 0.25F);
   this.setLocationAndAngles(
       fishingPlayer.posX,
       fishingPlayer.posY + (double) fishingPlayer.getEyeHeight(),
       fishingPlayer.posZ,
       fishingPlayer.rotationYaw,
       fishingPlayer.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);
   float f = 0.4F;
   this.motionX =
       (double)
           (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
               * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)
               * f);
   this.motionZ =
       (double)
           (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
               * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)
               * f);
   this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI) * f);
   this.handleHookCasting(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F);
 }
Ejemplo n.º 5
0
  public static MovingObjectPosition getMovingObjectPositionFromPlayer(
      World world, EntityLivingBase living, boolean bool) {
    float f = 1.0F;
    float f1 = living.prevRotationPitch + (living.rotationPitch - living.prevRotationPitch) * f;
    float f2 = living.prevRotationYaw + (living.rotationYaw - living.prevRotationYaw) * f;
    double d0 = living.prevPosX + (living.posX - living.prevPosX) * (double) f;
    double d1 =
        living.prevPosY
            + (living.posY - living.prevPosY) * (double) f
            + (double)
                (world.isRemote
                    ? living.getEyeHeight()
                        - (living instanceof EntityPlayer
                            ? ((EntityPlayer) living).getDefaultEyeHeight()
                            : 0)
                    : living
                        .getEyeHeight()); // isRemote check to revert changes to ray trace position
    // due to adding the eye height clientside and player
    // yOffset differences
    double d2 = living.prevPosZ + (living.posZ - living.prevPosZ) * (double) f;
    Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
    float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
    float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
    float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    float f6 = MathHelper.sin(-f1 * 0.017453292F);
    float f7 = f4 * f5;
    float f8 = f3 * f5;
    double d3 = 5.0D;
    if (living instanceof EntityPlayerMP)
      d3 = ((EntityPlayerMP) living).theItemInWorldManager.getBlockReachDistance();

    Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
    return world.func_147447_a(vec3, vec31, bool, !bool, false);
  }
Ejemplo n.º 6
0
 public EntityThrownSickle(World world, EntityLivingBase entityLiving, double projectileSpeed) {
   this(world);
   throwingEntity = entityLiving;
   setSize(0.25F, 0.25F);
   setLocationAndAngles(
       entityLiving.posX,
       entityLiving.posY + entityLiving.getEyeHeight(),
       entityLiving.posZ,
       entityLiving.rotationYaw,
       entityLiving.rotationPitch);
   posX -= MathHelper.cos((rotationYaw / 180F) * 3.141593F) * 0.16F;
   posY -= 0.10000000149011612D;
   posZ -= MathHelper.sin((rotationYaw / 180F) * 3.141593F) * 0.16F;
   setPosition(posX, posY, posZ);
   yOffset = 0.0F;
   float f = 0.05F;
   motionX =
       -MathHelper.sin((rotationYaw / 180F) * 3.141593F)
           * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
           * f;
   motionZ =
       MathHelper.cos((rotationYaw / 180F) * 3.141593F)
           * MathHelper.cos((rotationPitch / 180F) * 3.141593F)
           * f;
   motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F) * f;
   setHeading(motionX, motionY, motionZ, projectileSpeed, projectileSpeed);
   this.projectileSpeed = projectileSpeed;
 }
Ejemplo n.º 7
0
 @Override
 public void setRotationAngles(
     float f, float f1, float f2, float f3, float f4, float f5, Entity e) {
   super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
   if ((e instanceof EntityBunny && ((EntityBunny) e).isSitting())) {
     Body.rotateAngleX = 0.95993f;
     Leg1.rotateAngleX = Leg2.rotateAngleX = -1.5708f;
     Leg3.rotateAngleX = Leg4.rotateAngleX = -0.2818f;
     Leg1.rotationPointY = Leg2.rotationPointY = 23;
     Leg1.rotationPointZ = Leg2.rotationPointZ = 2;
   } else {
     Leg1.rotationPointY = Leg2.rotationPointY = 19;
     Leg1.rotationPointZ = Leg2.rotationPointZ = 3;
     this.Body.rotateAngleX = ((float) Math.PI / 2F);
     this.Leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
     this.Leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
     this.Leg3.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
     this.Leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
   }
   this.Head.rotateAngleX = f4 / (180F / (float) Math.PI);
   this.Head.rotateAngleY = f3 / (180F / (float) Math.PI);
   this.Ear1.rotateAngleX = f4 / (180F / (float) Math.PI);
   this.Ear1.rotateAngleY = f3 / (180F / (float) Math.PI);
   this.Ear2.rotateAngleX = f4 / (180F / (float) Math.PI);
   this.Ear2.rotateAngleY = f3 / (180F / (float) Math.PI);
   this.tail.rotateAngleX = ((float) Math.PI / 2F);
 }
Ejemplo n.º 8
0
 public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {
   super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
   leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.0F * f1;
   leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1;
   leg1.rotateAngleZ = MathHelper.cos(f * 0.6662F) * 1.0F * f1;
   leg2.rotateAngleZ = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1;
 }
  public EntityMamormeterShot(World world, EntityLivingBase entity, float var3) {
    super(world);
    this.shootingEntity = entity;

    if (entity instanceof EntityPlayer) {
      this.canBePickedUp = 1;
    }

    this.setSize(0.5F, 0.5F);
    this.setLocationAndAngles(
        entity.posX,
        entity.posY + entity.getEyeHeight(),
        entity.posZ,
        entity.rotationYaw,
        entity.rotationPitch);
    this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    this.posY -= 0.10000000149011612D;
    this.posZ -= 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 =
        -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionZ =
        MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
    this.setArrowHeading(this.motionX, this.motionY, this.motionZ, var3 * 1.5F, 1.0F);
  }
Ejemplo n.º 10
0
 MovingObjectPosition rayTrace(World world, EntityLivingBase entity, boolean adjacent) {
   float f1 = entity.rotationPitch;
   float f2 = entity.rotationYaw;
   double y = entity.posY + entity.getEyeHeight() - entity.yOffset;
   Vec3 vec3 = Vec3.createVectorHelper(entity.posX, y, entity.posZ);
   float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
   float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
   float f5 = -MathHelper.cos(-f1 * 0.017453292F);
   float f6 = MathHelper.sin(-f1 * 0.017453292F);
   float f7 = f4 * f5;
   float f8 = f3 * f5;
   double d3 = 5.0D;
   if (entity instanceof EntityPlayerMP) {
     d3 = ((EntityPlayerMP) entity).theItemInWorldManager.getBlockReachDistance();
   }
   Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
   MovingObjectPosition ret = world.func_147447_a(vec3, vec31, adjacent, !adjacent, false);
   if (ret != null && adjacent) {
     ForgeDirection side = ForgeDirection.getOrientation(ret.sideHit);
     ret.blockX += side.offsetX;
     ret.blockY += side.offsetY;
     ret.blockZ += side.offsetZ;
   }
   return ret;
 }
  /**
   * Constructor
   *
   * @param world The world the entity should be spawned in.
   * @param owner The owner of this fish hook entity.
   */
  public EntityChoreFishHook(World world, AbstractEntity owner) {
    super(world);

    angler = owner;
    angler.fishingChore.fishEntity = this;
    setSize(0.25F, 0.25F);
    setLocationAndAngles(
        angler.posX,
        (angler.posY + 1.62D) - angler.yOffset,
        angler.posZ,
        angler.rotationYaw,
        angler.rotationPitch);

    posX -= MathHelper.cos((rotationYaw / 180F) * (float) Math.PI) * 0.16F;
    posY -= 0.1D;
    posZ -= MathHelper.sin((rotationYaw / 180F) * (float) Math.PI) * 0.16F;
    yOffset = 0.0F;
    setPosition(posX, posY, posZ);

    float f = 0.4F;
    motionX =
        -MathHelper.sin((rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((rotationPitch / 180F) * (float) Math.PI)
            * f;
    motionZ =
        MathHelper.cos((rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((rotationPitch / 180F) * (float) Math.PI)
            * f;
    motionY = -MathHelper.sin((rotationPitch / 180F) * (float) Math.PI) * f;

    calculateVelocity(motionX, motionY, motionZ, 1.5F, 1.0F);
  }
Ejemplo n.º 12
0
  public EntityNutsCall(World par1World, EntityLiving par2EntityLiving, float par3) {
    super(par1World);
    isImmuneToFire = true;
    this.renderDistanceWeight = 10.0D;
    this.shootingEntity = par2EntityLiving;

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

    this.setSize(1.5F, 0.5F);
    this.setLocationAndAngles(
        par2EntityLiving.posX,
        par2EntityLiving.posY + (double) par2EntityLiving.getEyeHeight(),
        par2EntityLiving.posZ,
        par2EntityLiving.rotationYaw,
        par2EntityLiving.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.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
  }
Ejemplo n.º 13
0
  public static MovingObjectPosition getMovingObjectPositionFromPlayer(
      World par1World, EntityPlayer par2EntityPlayer, boolean par3) {
    float var4 = 1.0F;
    float var5 =
        par2EntityPlayer.prevRotationPitch
            + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
    float var6 =
        par2EntityPlayer.prevRotationYaw
            + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
    double var7 =
        par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4;
    double var9 =
        par2EntityPlayer.prevPosY
            + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4
            + 1.62D
            - par2EntityPlayer.yOffset;
    double var11 =
        par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4;
    Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11);
    float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI);
    float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI);
    float var16 = -MathHelper.cos(-var5 * 0.017453292F);
    float var17 = MathHelper.sin(-var5 * 0.017453292F);
    float var18 = var15 * var16;
    float var20 = var14 * var16;
    double var21 = 5.0D;

    if (par2EntityPlayer instanceof EntityPlayerMP) {
      var21 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance();
    }

    Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
    return par1World.rayTraceBlocks(var13, var23, par3);
  }
  /** Sets the models various rotation angles. */
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {
    headCamel.rotateAngleY = f3 / (180F / (float) Math.PI);
    headCamel.rotateAngleX = f4 / (180F / (float) Math.PI);
    mouth.rotateAngleY = earR.rotateAngleY = earL.rotateAngleY = headCamel.rotateAngleY;
    earR.rotateAngleX = earL.rotateAngleX = headCamel.rotateAngleX;
    mouth.rotateAngleX = headCamel.rotateAngleX + 0.29382F;

    if (taildirection > 0) {
      tailwag += 0.0002F;

      if (tailwag > 0.067F) {
        taildirection = taildirection * -1;
      }
    } else {
      tailwag -= 0.0002F;

      if ((double) tailwag < -0.067000000000000004D) {
        taildirection = taildirection * -1;
      }
    }

    leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
    leg3.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
    leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
  }
Ejemplo n.º 15
0
  /**
   * Returns the MovingObjectPosition of block hit by player. Adapted from protected method of same
   * name in Item.class.
   */
  private MovingObjectPosition getMovingObjectPositionFromPlayer(
      World world, EntityPlayer entityPlayer) {
    double xPos = entityPlayer.prevPosX + (entityPlayer.posX - entityPlayer.prevPosX);
    double yPos =
        entityPlayer.prevPosY
            + (entityPlayer.posY - entityPlayer.prevPosY)
            + (world.isRemote
                ? entityPlayer.getEyeHeight() - entityPlayer.getDefaultEyeHeight()
                : entityPlayer.getEyeHeight());
    double zPos = entityPlayer.prevPosZ + (entityPlayer.posZ - entityPlayer.prevPosZ);

    float pitch =
        entityPlayer.prevRotationPitch
            + (entityPlayer.rotationPitch - entityPlayer.prevRotationPitch);
    float yaw =
        entityPlayer.prevRotationYaw + (entityPlayer.rotationYaw - entityPlayer.prevRotationYaw);

    float commonComp = -MathHelper.cos(-pitch * 0.017453292F);

    float xComp = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI) * commonComp;
    float yComp = MathHelper.sin(-pitch * 0.017453292F);
    float zComp = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI) * commonComp;
    double reachDist = 5.0D;

    if (entityPlayer instanceof EntityPlayerMP) {
      reachDist = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
    }

    Vec3 vec1 = Vec3.createVectorHelper(xPos, yPos, zPos);
    Vec3 vec2 = vec1.addVector(xComp * reachDist, yComp * reachDist, zComp * reachDist);

    return world.rayTraceBlocks(vec1, vec2);
  }
Ejemplo n.º 16
0
  public EntityMeteorChunk(World par1World, EntityLivingBase par2EntityLivingBase, float speed) {
    super(par1World);
    this.renderDistanceWeight = 10.0D;
    this.shootingEntity = par2EntityLivingBase;

    if (par2EntityLivingBase instanceof EntityPlayer) {
      this.canBePickedUp = 1;
    }

    this.setSize(0.5F, 0.5F);
    this.setLocationAndAngles(
        par2EntityLivingBase.posX,
        par2EntityLivingBase.posY + par2EntityLivingBase.getEyeHeight(),
        par2EntityLivingBase.posZ,
        par2EntityLivingBase.rotationYaw,
        par2EntityLivingBase.rotationPitch);
    this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    this.posY -= 0.10000000149011612D;
    this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    this.setPosition(this.posX, this.posY, this.posZ);
    this.motionX =
        -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionZ =
        MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    this.motionY = -MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI);
    this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F);
  }
Ejemplo n.º 17
0
 public void setRotationAngles(
     float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
   this.Leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
   this.Leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
   this.Leg3.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
   this.Leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
 }
Ejemplo n.º 18
0
 public EntityPokeBall(
     World world, EntityLiving entityliving, EntityPixelmon e, EnumPokeballs type) {
   super(world, entityliving);
   thrower = entityliving;
   endRotationYaw = entityliving.rotationYawHead;
   pixelmon = e;
   dataWatcher.addObject(10, type.getIndex());
   mode = Mode.full;
   float speed = 0.3f;
   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))
           * 0.8;
   this.motionZ =
       (double)
               (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
                   * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI))
           * 0.8;
   this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)) * 0.8;
 }
Ejemplo n.º 19
0
  public EntityLaser(World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
    super(par1World);
    this.renderDistanceWeight = 10.0D;
    this.shootingEntity = par2EntityLivingBase;

    this.setSize(0.5F, 0.5F);
    this.setLocationAndAngles(
        par2EntityLivingBase.posX,
        par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight(),
        par2EntityLivingBase.posZ,
        par2EntityLivingBase.rotationYaw,
        par2EntityLivingBase.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.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
  }
  @Override
  public Vec3 getLookVec() {
    float f1;
    float f2;
    float f3;
    float f4;

    //		if (1 == 1.0F)
    //		{
    f1 = MathHelper.cos(-this.rotationYaw * 0.017453292F - (float) Math.PI);
    f2 = MathHelper.sin(-this.rotationYaw * 0.017453292F - (float) Math.PI);
    f3 = -MathHelper.cos(-this.rotationPitch * 0.017453292F);
    f4 = MathHelper.sin(-this.rotationPitch * 0.017453292F);
    return Vec3.createVectorHelper((double) (f2 * f3), (double) f4, (double) (f1 * f3));
    //		}
    //		else
    //		{
    //			f1 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 1;
    //			f2 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 1;
    //			f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
    //			f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
    //			float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    //			float f6 = MathHelper.sin(-f1 * 0.017453292F);
    //			return Vec3.createVectorHelper((double)(f4 * f5), (double)f6, (double)(f3 * f5));
    //		}
  }
  public EntityNeedle(World world, EntityPlayer owner, ItemStack ammoSource, float spread) {
    this(world);
    if (owner != null) _owner = owner.getCommandSenderName();
    _ammoSource = ammoSource;

    this.setLocationAndAngles(
        owner.posX,
        owner.posY + owner.getEyeHeight(),
        owner.posZ,
        owner.rotationYaw,
        owner.rotationPitch);
    this.posX -= (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F);
    this.posY -= 0.1D;
    this.posZ -= (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 =
        (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
    this.motionZ =
        (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI)
            * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
    this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
    this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 2.25F, spread);
    this.distance = 0;
  }
Ejemplo n.º 22
0
 /** Drops the entity's currently held item into the world */
 public static void dropHeldItem(EntityLivingBase entity) {
   if (!entity.worldObj.isRemote && entity.getHeldItem() != null) {
     EntityItem drop =
         new EntityItem(
             entity.worldObj,
             entity.posX,
             entity.posY - 0.30000001192092896D + (double) entity.getEyeHeight(),
             entity.posZ,
             entity.getHeldItem().copy());
     float f = 0.3F;
     float f1 = entity.worldObj.rand.nextFloat() * (float) Math.PI * 2.0F;
     drop.motionX =
         (double)
             (-MathHelper.sin(entity.rotationYaw / 180.0F * (float) Math.PI)
                 * MathHelper.cos(entity.rotationPitch / 180.0F * (float) Math.PI)
                 * f);
     drop.motionZ =
         (double)
             (MathHelper.cos(entity.rotationYaw / 180.0F * (float) Math.PI)
                 * MathHelper.cos(entity.rotationPitch / 180.0F * (float) Math.PI)
                 * f);
     drop.motionY =
         (double) (-MathHelper.sin(entity.rotationPitch / 180.0F * (float) Math.PI) * f + 0.1F);
     f = 0.02F * entity.worldObj.rand.nextFloat();
     drop.motionX += Math.cos((double) f1) * (double) f;
     drop.motionY +=
         (double) ((entity.worldObj.rand.nextFloat() - entity.worldObj.rand.nextFloat()) * 0.1F);
     drop.motionZ += Math.sin((double) f1) * (double) f;
     drop.delayBeforeCanPickup = 40;
     entity.worldObj.spawnEntityInWorld(drop);
     entity.setCurrentItemOrArmor(0, (ItemStack) null);
   }
 }
Ejemplo n.º 23
0
 public void setRotationAngles(
     float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
   HEADBASE.rotateAngleY = f3 / (270F / (float) Math.PI);
   HEADBASE.rotateAngleX = f4 / (270F / (float) Math.PI);
   LEFTLEG.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
   RIGHTLEG.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
 }
Ejemplo n.º 24
0
 public void setLivingAnimations(
     EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) {
   this.rightbackleg.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
   this.leftbackleg.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float) Math.PI) * 1.4F * par3;
   this.rightfrontleg.rotateAngleX =
       MathHelper.cos(par2 * 0.6662F + (float) Math.PI) * 1.4F * par3;
   this.leftfrontleg.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
 }
Ejemplo n.º 25
0
 public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) {
   this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
   this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
   this.leg4.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
   this.leg3.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.4F * f1;
   this.leg4.rotateAngleY = 0.0F;
   this.leg3.rotateAngleY = 0.0F;
 }
Ejemplo n.º 26
0
 @Override
 public void setRotationAngles(
     float f, float f1, float f2, float f3, float f4, float f5, Entity ent) {
   frontleft_leg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
   rear_left_leg.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 1.4F * f1;
   rear_right_leg.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 1.4F * f1;
   frontright_leg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
 }
  public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    float f = par2Random.nextFloat() * (float) Math.PI;
    double d = (float) (par3 + 8) + (MathHelper.sin(f) * (float) numberOfBlocks) / 8F;
    double d1 = (float) (par3 + 8) - (MathHelper.sin(f) * (float) numberOfBlocks) / 8F;
    double d2 = (float) (par5 + 8) + (MathHelper.cos(f) * (float) numberOfBlocks) / 8F;
    double d3 = (float) (par5 + 8) - (MathHelper.cos(f) * (float) numberOfBlocks) / 8F;
    double d4 = (par4 + par2Random.nextInt(3)) - 2;
    double d5 = (par4 + par2Random.nextInt(3)) - 2;

    for (int i = 0; i <= numberOfBlocks; i++) {
      double d6 = d + ((d1 - d) * (double) i) / (double) numberOfBlocks;
      double d7 = d4 + ((d5 - d4) * (double) i) / (double) numberOfBlocks;
      double d8 = d2 + ((d3 - d2) * (double) i) / (double) numberOfBlocks;
      double d9 = (par2Random.nextDouble() * (double) numberOfBlocks) / 16D;
      double d10 =
          (double) (MathHelper.sin(((float) i * (float) Math.PI) / (float) numberOfBlocks) + 1.0F)
                  * d9
              + 1.0D;
      double d11 =
          (double) (MathHelper.sin(((float) i * (float) Math.PI) / (float) numberOfBlocks) + 1.0F)
                  * d9
              + 1.0D;
      int j = MathHelper.floor_double(d6 - d10 / 2D);
      int k = MathHelper.floor_double(d7 - d11 / 2D);
      int l = MathHelper.floor_double(d8 - d10 / 2D);
      int i1 = MathHelper.floor_double(d6 + d10 / 2D);
      int j1 = MathHelper.floor_double(d7 + d11 / 2D);
      int k1 = MathHelper.floor_double(d8 + d10 / 2D);

      for (int l1 = j; l1 <= i1; l1++) {
        double d12 = (((double) l1 + 0.5D) - d6) / (d10 / 2D);

        if (d12 * d12 >= 1.0D) {
          continue;
        }

        for (int i2 = k; i2 <= j1; i2++) {
          double d13 = (((double) i2 + 0.5D) - d7) / (d11 / 2D);

          if (d12 * d12 + d13 * d13 >= 1.0D) {
            continue;
          }

          for (int j2 = l; j2 <= k1; j2++) {
            double d14 = (((double) j2 + 0.5D) - d8) / (d10 / 2D);

            if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D
                && par1World.getBlockId(l1, i2, j2) == Block.netherrack.blockID) {
              par1World.setBlock(l1, i2, j2, minableBlockId);
            }
          }
        }
      }
    }

    return true;
  }
  public CREEPSEntityFoam(World world, EntityLivingBase entityliving, float f) {
    this(world);
    shootingEntity = entityliving;
    damage = 1;
    double d = -MathHelper.sin((entityliving.rotationYaw * (float) Math.PI) / 180F);
    double d1 = MathHelper.cos((entityliving.rotationYaw * (float) Math.PI) / 180F);
    setLocationAndAngles(
        entityliving.posX + d * 0.40000000596046448D,
        (entityliving.posY + (double) entityliving.getEyeHeight()) - 0.25D,
        entityliving.posZ + d1 * 0.80000001192092896D,
        entityliving.rotationYaw,
        entityliving.rotationPitch);
    posX -= MathHelper.cos((rotationYaw / 180F) * (float) Math.PI) * 0.16F;
    posY -= 0.10000000149011612D;
    posZ -= MathHelper.sin((rotationYaw / 180F) * (float) Math.PI) * 0.16F;

    if (entityliving instanceof EntityPlayer) {
      posY += 0.20000000298023224D;
    }

    setPosition(posX, posY, posZ);
    motionX =
        -MathHelper.sin((rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((rotationPitch / 180F) * (float) Math.PI);
    motionZ =
        MathHelper.cos((rotationYaw / 180F) * (float) Math.PI)
            * MathHelper.cos((rotationPitch / 180F) * (float) Math.PI);
    motionY = -MathHelper.sin((rotationPitch / 180F) * (float) Math.PI);
    float f1 = 1.0F;

    if (entityliving instanceof EntityPlayer) {
      playerFire = true;
      float f2 = 0.3333333F;
      float f3 = f2 / 0.1F;

      if (f3 > 0.0F) {
        f1 = (float) ((double) f1 * (1.0D + 2D / (double) f3));
      }
    }

    if (Math.abs(entityliving.motionX) > 0.10000000000000001D
        || Math.abs(entityliving.motionY) > 0.10000000000000001D
        || Math.abs(entityliving.motionZ) > 0.10000000000000001D) {
      f1 *= 2.0F;
    }

    if (entityliving.onGround) ;

    setThrowableHeading(
        motionX,
        motionY,
        motionZ,
        (float) (2.380000114440918D + ((double) worldObj.rand.nextFloat() - 0.5D)),
        f1);
  }
Ejemplo n.º 29
0
 public void setRotationAngles(
     float par1, float par2, float par3, float par4, float par5, float par6) {
   this.Head.rotateAngleX = par5 / (180F / (float) Math.PI);
   this.Head.rotateAngleY = par4 / (180F / (float) Math.PI);
   this.Beak.rotateAngleX = this.Head.rotateAngleX;
   this.Beak.rotateAngleY = this.Head.rotateAngleY;
   this.RightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
   this.LeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
   this.WingRight.rotateAngleZ = par3;
   this.WingLeft.rotateAngleZ = -par3;
 }
Ejemplo n.º 30
0
  @Override
  public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    float var6 = par2Random.nextFloat() * (float) Math.PI;
    double var7 = par3 + 8 + MathHelper.sin(var6) * numberOfBlocks / 8.0F;
    double var9 = par3 + 8 - MathHelper.sin(var6) * numberOfBlocks / 8.0F;
    double var11 = par5 + 8 + MathHelper.cos(var6) * numberOfBlocks / 8.0F;
    double var13 = par5 + 8 - MathHelper.cos(var6) * numberOfBlocks / 8.0F;
    double var15 = par4 + par2Random.nextInt(3) - 2;
    double var17 = par4 + par2Random.nextInt(3) - 2;

    for (int var19 = 0; var19 <= numberOfBlocks; ++var19) {
      double var20 = var7 + (var9 - var7) * var19 / numberOfBlocks;
      double var22 = var15 + (var17 - var15) * var19 / numberOfBlocks;
      double var24 = var11 + (var13 - var11) * var19 / numberOfBlocks;
      double var26 = par2Random.nextDouble() * numberOfBlocks / 16.0D;
      double var28 =
          (MathHelper.sin(var19 * (float) Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D;
      double var30 =
          (MathHelper.sin(var19 * (float) Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D;
      int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
      int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
      int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
      int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
      int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
      int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);

      for (int var38 = var32; var38 <= var35; ++var38) {
        double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);

        if (var39 * var39 < 1.0D) {
          for (int var41 = var33; var41 <= var36; ++var41) {
            double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);

            if (var39 * var39 + var42 * var42 < 1.0D) {
              for (int var44 = var34; var44 <= var37; ++var44) {
                double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);

                if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D
                        && par1World.getBlockId(var38, var41, var44)
                            == Block.field_111032_cD.blockID
                    || par1World.getBlockId(var38, var41, var44)
                        == Blocks.holyGrass.get().blockID) {
                  par1World.setBlock(var38, var41, var44, minableBlockId, 1, 2);
                }
              }
            }
          }
        }
      }
    }

    return true;
  }