Пример #1
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;
 }
 /** Sets the listener of sounds */
 public void setListener(EntityLivingBase par1EntityLivingBase, float par2) {
   if (this.loaded && this.options.soundVolume != 0.0F && par1EntityLivingBase != null) {
     float f1 =
         par1EntityLivingBase.prevRotationPitch
             + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch)
                 * par2;
     float f2 =
         par1EntityLivingBase.prevRotationYaw
             + (par1EntityLivingBase.rotationYaw - par1EntityLivingBase.prevRotationYaw) * par2;
     double d0 =
         par1EntityLivingBase.prevPosX
             + (par1EntityLivingBase.posX - par1EntityLivingBase.prevPosX) * (double) par2;
     double d1 =
         par1EntityLivingBase.prevPosY
             + (par1EntityLivingBase.posY - par1EntityLivingBase.prevPosY) * (double) par2;
     double d2 =
         par1EntityLivingBase.prevPosZ
             + (par1EntityLivingBase.posZ - par1EntityLivingBase.prevPosZ) * (double) par2;
     float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
     float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
     float f5 = -f4;
     float f6 = -MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
     float f7 = -f3;
     float f8 = 0.0F;
     float f9 = 1.0F;
     float f10 = 0.0F;
     this.sndSystem.setListenerPosition((float) d0, (float) d1, (float) d2);
     this.sndSystem.setListenerOrientation(f5, f6, f7, f8, f9, f10);
   }
 }
  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);
  }
 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;
 }
Пример #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);
  }
Пример #6
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);
  }
  @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));
    //		}
  }
Пример #8
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);
  }
Пример #9
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;
  }
Пример #10
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);
  }
Пример #11
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;
 }
  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);
  }
Пример #13
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);
   }
 }
Пример #14
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);
 }
Пример #15
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);
  }
Пример #16
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);
 }
  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;
  }
  /**
   * 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);
  }
Пример #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);
  }
Пример #20
0
  public void setRotationAngles(
      float par1, float par2, float par3, float par4, float par5, float par6) {
    // head
    this.head.rotateAngleY = par4 / 57.295776F;
    this.head.rotateAngleX = par5 / 57.295776F;
    this.headeyes.rotateAngleY = this.head.rotateAngleY;
    this.headeyes.rotateAngleX = this.head.rotateAngleX;
    this.headaccessory.rotateAngleY = this.head.rotateAngleY;
    this.headaccessory.rotateAngleX = this.head.rotateAngleX;
    this.hair1.rotateAngleY = this.head.rotateAngleY;
    this.hair2.rotateAngleY = (this.head.rotateAngleY) * 0.75F;

    // arms
    this.rightarm.rotateAngleX =
        MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 0.8F * par2 * 0.5F;
    this.leftarm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 0.8F * par2 * 0.5F;

    this.rightarm.rotateAngleZ = 0.0F;
    this.leftarm.rotateAngleZ = 0.0F;

    float f6;
    float f7;

    if (this.swingProgress > -9990.0F) {
      f6 = this.swingProgress;
      f6 = 1.0F - this.swingProgress;
      f6 *= f6;
      f6 *= f6;
      f6 = 1.0F - f6;
      f7 = MathHelper.sin(f6 * (float) Math.PI);
      float f8 =
          MathHelper.sin(this.swingProgress * (float) Math.PI)
              * -(this.head.rotateAngleX - 0.7F)
              * 0.75F;

      this.rightarm.rotateAngleX =
          (float) ((double) this.rightarm.rotateAngleX - ((double) f7 * 1.2D + (double) f8));
      this.rightarm.rotateAngleY += (this.bodytop.rotateAngleY * 2.0F);
      this.rightarm.rotateAngleZ = (MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F);
    }

    this.rightarm.rotateAngleZ += (MathHelper.cos(par3 * 0.09F) * 0.025F + 0.025F) + 0.1745329F;
    this.rightarm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.025F;
    this.leftarm.rotateAngleZ -= (MathHelper.cos(par3 * 0.09F) * 0.025F + 0.025F) + 0.1745329F;
    this.leftarm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.025F;

    // body
    this.tail.rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.5F * par2;

    // legs
    this.rightleg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 0.5F * par2;
    this.leftleg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 0.5F * par2;
    this.rightleglower.rotateAngleX = this.rightleg.rotateAngleX;
    this.leftleglower.rotateAngleX = this.leftleg.rotateAngleX;
    this.rightfoot.rotateAngleX = this.rightleg.rotateAngleX;
    this.leftfoot.rotateAngleX = this.leftleg.rotateAngleX;
  }
  public void setRotationAngles(
      float par1, float par2, float par3, float par4, float par5, float par6) {
    // anchor
    this.anchor.rotationPointY = MathHelper.cos(((float) 1.5F + par3) * 0.5F);

    // head
    this.head.rotateAngleY = par4 / 57.295776F;
    this.head.rotateAngleX = par5 / 57.295776F;
    this.headeyes.rotateAngleY = this.head.rotateAngleY;
    this.headeyes.rotateAngleX = this.head.rotateAngleX;
    this.headaccessory.rotateAngleY = this.head.rotateAngleY;
    this.headaccessory.rotateAngleX = this.head.rotateAngleX;
    this.hair1.rotateAngleY = this.head.rotateAngleY;
    this.hair2.rotateAngleY = (this.head.rotateAngleY) * 0.75F;

    // arms
    this.rightarm.rotateAngleX =
        MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 0.8F * par2 * 0.5F;
    this.leftarm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 0.8F * par2 * 0.5F;

    this.rightarm.rotateAngleZ = 0.0F;
    this.leftarm.rotateAngleZ = 0.0F;

    float f7;
    float f8;

    if (this.swingProgress > -9990.0F) {
      f7 = this.swingProgress;
      f7 = 1.0F - this.swingProgress;
      f7 *= f7;
      f7 *= f7;
      f7 = 1.0F - f7;
      f8 = MathHelper.sin(f7 * (float) Math.PI);
      float f19 =
          MathHelper.sin(this.swingProgress * (float) Math.PI)
              * -(this.head.rotateAngleX - 0.7F)
              * 0.75F;

      this.rightarm.rotateAngleX =
          (float) ((double) this.rightarm.rotateAngleX - ((double) f7 * 1.2D + (double) f8));
      this.rightarm.rotateAngleY += (this.bodytop.rotateAngleY * 2.0F);
      this.rightarm.rotateAngleZ = (MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F);
    }

    this.rightarm.rotateAngleZ += (MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F) + 0.0872665F;
    this.rightarm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
    this.leftarm.rotateAngleZ -= (MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F) + 0.0872665F;
    this.leftarm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;

    // body
    this.rightwing.rotateAngleY = MathHelper.cos(par3 * 0.4F + (float) Math.PI) * 1.0F * 0.5F;
    this.leftwing.rotateAngleY = MathHelper.cos(par3 * 0.4F) * 1.0F * 0.5F;
    this.rightwing.rotateAngleZ = 0.0F;
    this.leftwing.rotateAngleZ = 0.0F;
    this.rightwing.rotateAngleY -= 0.9599311F;
    this.leftwing.rotateAngleY += 0.9599311F;
  }
  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);
  }
  @Override
  public boolean generate(World world, Random rand, int x, int y, int z) {

    float f = rand.nextFloat() * (float) Math.PI;
    double d0 = x + 8 + MathHelper.sin(f) * genClusterSize / 8.0F;
    double d1 = x + 8 - MathHelper.sin(f) * genClusterSize / 8.0F;
    double d2 = z + 8 + MathHelper.cos(f) * genClusterSize / 8.0F;
    double d3 = z + 8 - MathHelper.cos(f) * genClusterSize / 8.0F;
    double d4 = y + rand.nextInt(3) - 2;
    double d5 = y + rand.nextInt(3) - 2;

    for (int l = 0; l <= genClusterSize; ++l) {
      double d6 = d0 + (d1 - d0) * l / genClusterSize;
      double d7 = d4 + (d5 - d4) * l / genClusterSize;
      double d8 = d2 + (d3 - d2) * l / genClusterSize;
      double d9 = rand.nextDouble() * genClusterSize / 16.0D;
      double d10 = (MathHelper.sin(l * (float) Math.PI / genClusterSize) + 1.0F) * d9 + 1.0D;
      double d11 = (MathHelper.sin(l * (float) Math.PI / genClusterSize) + 1.0F) * d9 + 1.0D;
      int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);
      int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);
      int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);
      int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);
      int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
      int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);

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

        if (d12 * d12 < 1.0D) {
          for (int l2 = j1; l2 <= i2; ++l2) {
            double d13 = (l2 + 0.5D - d7) / (d11 / 2.0D);

            if (d12 * d12 + d13 * d13 < 1.0D) {
              for (int i3 = k1; i3 <= j2; ++i3) {
                double d14 = (i3 + 0.5D - d8) / (d10 / 2.0D);

                Block block = Block.blocksList[world.getBlockId(k2, l2, i3)];
                if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D
                    && block != null
                    && block.isGenMineableReplaceable(world, k2, l2, i3, genBlockID)) {

                  WeightedRandomBlock ore =
                      (WeightedRandomBlock) WeightedRandom.getRandomItem(world.rand, cluster);
                  world.setBlock(k2, l2, i3, ore.blockId, ore.metadata, 1);
                }
              }
            }
          }
        }
      }
    }
    return true;
  }
Пример #25
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;
  }
 public void setRotationAngles(
     float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) {
   float var7 = MathHelper.sin(par2 * 3.141593F);
   float var8 = MathHelper.sin((1.0F - (1.0F - par2) * (1.0F - par2)) * 3.141593F);
   this.RightArm.rotateAngleX =
       MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 2.0F * par2 * 0.5F;
   this.LeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
   this.RightArm.rotateAngleZ = 0.0F;
   this.LeftArm.rotateAngleZ = 0.0F;
   this.RightFoot.rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
   this.LeftFoot.rotateAngleY = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
   this.RightFoot.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 0.7F * par2;
   this.LeftFoot.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 0.7F * par2;
 }
Пример #27
0
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    float pitch = player.rotationPitch;
    float yaw = player.rotationYaw;
    double pX = player.posX;
    double pY = player.posY;
    double pZ = player.posZ;
    Vec3 playerPos = world.getWorldVec3Pool().getVecFromPool(pX, pY, pZ);
    float yawOffZ = MathHelper.cos((-yaw * OUtil.PI_OVER_180) - (float) Math.PI);
    float yawOffX = MathHelper.sin((-yaw * OUtil.PI_OVER_180) - (float) Math.PI);
    float pitchOffZ = -MathHelper.cos((-pitch) * OUtil.PI_OVER_180);
    float pitchOffY = MathHelper.sin((-pitch) * OUtil.PI_OVER_180);
    float offsetX = yawOffX * pitchOffZ;
    float offsetZ = yawOffZ * pitchOffZ;
    double radius = 5.0;
    Vec3 offset =
        playerPos.addVector(
            (double) offsetX * radius, (double) pitchOffY * radius, (double) offsetZ * radius);
    MovingObjectPosition hitPos = world.clip(playerPos, offset, true);

    if (hitPos == null) {
      return stack;
    } else if (hitPos.typeOfHit == EnumMovingObjectType.TILE) {
      int bX = hitPos.blockX;
      int bY = hitPos.blockY;
      int bZ = hitPos.blockZ;
      int bID = world.getBlockId(bX, bY, bZ);

      if (bID == Block.waterStill.blockID || bID == Block.waterMoving.blockID) {
        EntityOceaniaBoatWithChest boat =
            new EntityOceaniaBoatWithChest(world, bX + 0.5, bY + 1.0, bZ + 0.5);
        boat.rotationYaw =
            (float)
                (((MathHelper.floor_double((double) (player.rotationYaw * 4.0f / 360.0f) + 0.5) & 3)
                        - 1)
                    * 90);
        boat.setBoatType(BoatType.values()[stack.getItemDamage()]);
        // boat.setOwner(player.getEntityName());

        if (!world
            .getCollidingBoundingBoxes(boat, boat.boundingBox.expand(-0.1D, -0.1D, -0.1D))
            .isEmpty()) return stack;
        if (!world.isRemote) {
          world.spawnEntityInWorld(boat);
        }
        if (!player.capabilities.isCreativeMode) stack.stackSize--;
      }
    }

    return stack;
  }
  /**
   * 発射する弾を生成・初期パラメータの定義をする。
   *
   * @param par1World :このワールド
   * @param par2EntityLivingBase :弾源となるエンティティ。このModの場合、弾を撃ったプレイヤーがここに入る
   * @param par3EntityLivingBase :ターゲットのエンティティ。生成前に、予めAABBなどを使ってターゲットを得ておくこと
   * @param speed :弾の速度計算に使われる値
   * @param speed2 :弾の速度計算に使われる値2
   * @param initialYaw :弾の初期射出方向
   */
  public EntityAnchorMissile(
      World par1World,
      EntityLivingBase par2EntityLivingBase,
      EntityLivingBase par3EntityLivingBase,
      float speed,
      float speed2,
      float initialYaw,
      float adjustX,
      float adjustY,
      float adjustZ) {
    super(par1World);
    this.renderDistanceWeight = 10.0D;
    this.shootingEntity = par2EntityLivingBase;
    this.targetEntity = par3EntityLivingBase;
    this.yOffset = 0.0F;
    this.setSize(0.5F, 0.5F);
    this.damage = 50.0D;

    float initialPitch = 0.0F;

    // 初期状態での向きは射手の向きに依存する
    this.setLocationAndAngles(
        par2EntityLivingBase.posX,
        par2EntityLivingBase.posY + par2EntityLivingBase.getEyeHeight(),
        par2EntityLivingBase.posZ,
        par2EntityLivingBase.rotationYaw,
        par2EntityLivingBase.rotationPitch);

    // 初速度
    this.posX +=
        -(double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * (1.0F + adjustZ))
            - MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * adjustX;
    this.posY += 0.05000000149011612D + adjustY;
    this.posZ +=
        (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * (1.0F + adjustZ))
            - (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * adjustX);
    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, speed2);
  }
Пример #29
0
  public static void drawLine(
      double x,
      double y,
      double x2,
      double y2,
      float red,
      float green,
      float blue,
      float lineWidth,
      float fadeSpeed) {
    int count = FMLClientHandler.instance().getClient().thePlayer.ticksExisted;
    float alpha = fadeSpeed + MathHelper.sin((float) (count + x)) * 0.3F + 0.3F;

    Tessellator var12 = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glLineWidth(lineWidth);
    GL11.glDisable(3553);
    GL11.glEnable(3042);
    var12.startDrawing(3);

    var12.setColorRGBA_F(red, green, blue, alpha);
    var12.addVertex(x, y, 0.0D);
    var12.addVertex(x2, y2, 0.0D);

    var12.draw();
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(32826);
    GL11.glDisable(3042);
    GL11.glEnable(3553);
    GL11.glPopMatrix();
  }
Пример #30
0
 public void doRenderFireball(
     EntityFlameFireball par1EntityFireball,
     double par2,
     double par4,
     double par6,
     float par8,
     float par9) {
   // uses the same code as the player renderer to get the smooth
   float delta = PlayerRenderTickEvent.delta * 1.5F;
   par1EntityFireball.fireballGrowth += delta;
   if (par1EntityFireball.fireballMaxGrowth < par1EntityFireball.fireballGrowth) {
     par1EntityFireball.fireballGrowth = par1EntityFireball.fireballMaxGrowth;
   }
   par1EntityFireball.fireballRotation += delta;
   // float f2 = (float)par1EntityFireball.innerRotation + par9;
   float f2 = (float) par1EntityFireball.fireballRotation + par9;
   GL11.glPushMatrix();
   GL11.glTranslatef((float) par2, (float) par4 + par1EntityFireball.height / 2, (float) par6);
   this.bindTexture(entityTexture);
   float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
   f3 += f3 * f3;
   this.mainModel.render(
       par1EntityFireball,
       0.0F,
       f2 * 3.0F,
       f3 * 0.2F,
       par1EntityFireball.fireballGrowth,
       par1EntityFireball.fireballMaxGrowth,
       0.0625F);
   GL11.glPopMatrix();
 }