Package com.flansmod.common.vector

Examples of com.flansmod.common.vector.Vector3f


  {
    MechaType mechaType = getMechaType();
    BulletType bulletType = ((ItemBullet)bulletStack.getItem()).type;
    RotatedAxes a = new RotatedAxes();
   
    Vector3f armVector = new Vector3f(mechaType.armLength, 0F, 0F);
    Vector3f gunVector = new Vector3f(mechaType.armLength + 1.2F * mechaType.heldItemScale, 0.5F * mechaType.heldItemScale, 0F);
    Vector3f armOrigin = left ?  mechaType.leftArmOrigin : mechaType.rightArmOrigin;
   
    a.rotateGlobalYaw(axes.getYaw());
    armOrigin = a.findLocalVectorGlobally(armOrigin);
   
    a.rotateLocalPitch(-seats[0].looking.getPitch());
    gunVector = a.findLocalVectorGlobally(gunVector);
    armVector = a.findLocalVectorGlobally(armVector);
   
    Vector3f bulletOrigin = Vector3f.add(armOrigin, gunVector, null);
   
    bulletOrigin  = Vector3f.add(new Vector3f(posX, posY, posZ), bulletOrigin, null);
       
    if(!worldObj.isRemote)
      for (int k = 0; k < gunType.numBullets; k++)
        worldObj.spawnEntityInWorld(((ItemBullet)bulletStack.getItem()).getEntity(worldObj, bulletOrigin, armVector, (EntityLivingBase)(seats[0].riddenByEntity), gunType.getSpread(stack) / 2F, gunType.getDamage(stack), gunType.getBulletSpeed(stack),bulletStack.getItemDamage(), mechaType));
   
View Full Code Here


    slideModel[1].addBox(0F, 0F, 0F, 1, 1, 1, 0F); // Slide
    slideModel[1].setRotationPoint(7F, -4.5F, -0.5F);

   
    barrelAttachPoint = new Vector3f(8.5F / 16F, 4F / 16F, 0F);
   
    scopeAttachPoint = new Vector3f(3F / 16F, 5F / 16F, 0F);
    scopeIsOnSlide = true;

    gunSlideDistance = 0.2F;
    animationType = EnumAnimationType.PISTOL_CLIP;
View Full Code Here

      motionY += 0.1;
    }
   
    if(rocketTimer != 0) rocketTimer --;
   
    Vector3f actualMotion = new Vector3f(0F, motionY - (16F / 400F), 0F);
   
    if(driverIsLiving)
    {
      EntityLivingBase entity = (EntityLivingBase)seats[0].riddenByEntity;
      boolean driverIsCreative = entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode;
      if(thePlayerIsDrivingThis && Minecraft.getMinecraft().currentScreen instanceof GuiDriveableController)
      {
        if(FlansMod.proxy.isKeyDown(0)) moveX = 1;
        if(FlansMod.proxy.isKeyDown(1)) moveX = -1;
        if(FlansMod.proxy.isKeyDown(2)) moveZ = -1;
        if(FlansMod.proxy.isKeyDown(3)) moveZ = 1;
      }
      else if(seats[0].riddenByEntity instanceof EntityLiving && !(seats[0].riddenByEntity instanceof EntityPlayer))
      {

        moveZ = 1;
        /*
        EntityLiving ent = (EntityLiving)seats[0].riddenByEntity;
        //System.out.println(ent.moveForward);
        Vec3 target = Vec3.createVectorHelper(0D, 0D, 0D);
        if(ent.getNavigator().getPath() != null)
          target = ent.getNavigator().getPath().getPosition(ent);
        moveX = (float) target.xCoord;
        moveZ = (float) target.zCoord;
        */
      }
     
      Vector3f intent = new Vector3f(moveX, 0, moveZ);
     
      if(Math.abs(intent.lengthSquared()) > 0.1)
      {
        intent.normalise();
       
        ++legSwing;
     
        intent = axes.findLocalVectorGlobally(intent);
             
        Vector3f intentOnLegAxes = legAxes.findGlobalVectorLocally(intent);
        float intentAngle = (float)Math.atan2(intent.z, intent.x) * 180F / 3.14159265F;
        float angleBetween = intentAngle - legAxes.getYaw();
        if(angleBetween > 180F) angleBetween -= 360F;
        if(angleBetween < -180F) angleBetween += 360F;
                 
        float signBetween = Math.signum(angleBetween);
        angleBetween = Math.abs(angleBetween);
       
        if(angleBetween > 0.1)
        {
          legAxes.rotateGlobalYaw(Math.min(angleBetween, type.rotateSpeed)*signBetween);
        }
       
        Vector3f motion = legAxes.getXAxis();
       
        motion.scale((type.moveSpeed * data.engine.engineSpeed * speedMultiplier())*(4.3F/20F)*(intent.lengthSquared()));
       
        boolean canThrustCreatively = seats != null && seats[0] != null && seats[0].riddenByEntity instanceof EntityPlayer && ((EntityPlayer)seats[0].riddenByEntity).capabilities.isCreativeMode;
 
        if((canThrustCreatively || data.fuelInTank > data.engine.fuelConsumption) && isPartIntact(EnumDriveablePart.hips))
        {
          if(onGround || jumpDelay != 0)
          {
            //Move!
          Vector3f.add(actualMotion, motion, actualMotion);
          }
          else if(!onGround && shouldFly())
          {
            Vector3f flyMotion = new Vector3f(intent.x, 0F, intent.z);
            Vector3f.add(actualMotion, flyMotion, actualMotion);
          }

          //If we can't thrust creatively, we must thrust using fuel. Nom.
          if(!canThrustCreatively)
View Full Code Here

    ammoModel[0] = new ModelRendererTurbo(this, 0, 25, textureX, textureY);
    ammoModel[0].addBox(-1.5F, -2.8F, -0.5F, 2, 4, 1);
   
    translateAll(0F, 1F, 0F);
   
    barrelAttachPoint = new Vector3f(12F / 16F, 4.5F / 16F, 0F);
   
    scopeAttachPoint = new Vector3f(5F / 16F, 6F / 16F, 0F);
    scopeIsOnSlide = false;
   
    gunSlideDistance = 0.25F;
    animationType = EnumAnimationType.PISTOL_CLIP;
  }
View Full Code Here

      }
      if(split[0].equals("RotateSpeed"))
        rotateSpeed = Float.parseFloat(split[1]);
     
      if(split[0].equals("LeftArmOrigin"))
        leftArmOrigin = new Vector3f(Float.parseFloat(split[1]) / 16F, Float.parseFloat(split[2]) / 16F, Float.parseFloat(split[3]) / 16F);
      if(split[0].equals("RightArmOrigin"))
        rightArmOrigin = new Vector3f(Float.parseFloat(split[1]) / 16F, Float.parseFloat(split[2]) / 16F, Float.parseFloat(split[3]) / 16F);
      if(split[0].equals("ArmLength"))
        armLength = Float.parseFloat(split[1]) / 16F;
      if(split[0].equals("LegLength"))
        legLength = Float.parseFloat(split[1]) / 16F;
      if(split[0].equals("HeldItemScale"))
View Full Code Here

    for(ModelRendererTurbo[] mods : heliTailRotorModels)
    {
      translate(mods, x, y, z);
    }
    for(Vector3f o : heliMainRotorOrigins)
      Vector3f.add(o, new Vector3f(x / 16F, y / 16F, z / 16F), o);
    for(Vector3f o : heliTailRotorOrigins)
      Vector3f.add(o, new Vector3f(x / 16F, y / 16F, z / 16F), o);
  }
View Full Code Here

    //
    //leverActionModel[1] = new ModelRendererTurbo(this, 12, 4, textureX, textureY);
    //leverActionModel[1].addBox(7F, 2.75F, -1F, 4, 2, 2);
   
    //Scope
    scopeAttachPoint = new Vector3f(5F / 16F, 5F / 16F, 0F);

    //Stock
    defaultStockModel = new ModelRendererTurbo[2];
   
    defaultStockModel[0] = new ModelRendererTurbo(this, 18, 0, textureX, textureY);
    defaultStockModel[0].addShapeBox(-2F, 1F, -1F, 2, 2, 2, 0F, /* 0 */ 0F, 0F, 0F, /* 1 */ 0F, -1F, 0F, /* 2 */ 0F, -1F, 0F, /* 3 */ 0F, 0F, 0F, /* 4 */ 0F, 0F, 0F, /* 5 */ 0F, 1F, 0F, /* 6 */ 0F, 1F, 0F, /* 7 */ 0F, 0F, 0F);
   
    defaultStockModel[1] = new ModelRendererTurbo(this, 28, 0, textureX, textureY);
    defaultStockModel[1].addShapeBox(-8F, 0F, -1F, 6, 3, 2, 0F, /* 0 */ 0F, 0F, 0F, /* 1 */ 0F, -1F, 0F, /* 2 */ 0F, -1F, 0F, /* 3 */ 0F, 0F, 0F, /* 4 */ 0F, 0F, 0F, /* 5 */ 0F, 0F, 0F, /* 6 */ 0F, 0F, 0F, /* 7 */ 0F, 0F, 0F)
   
    stockAttachPoint = new Vector3f(0F / 16F, 3F / 16F, 0F);
   
    //Barrel   
    barrelAttachPoint = new Vector3f(18F / 16F, 4F / 16F, 0F);
   
    //Grip
    gripAttachPoint = new Vector3f(9F / 16F, 2.25F / 16F, 0F);
   
    //Ammo
    ammoModel = new ModelRendererTurbo[1];
   
    ammoModel[0] = new ModelRendererTurbo(this, 0, 14, textureX, textureY);
    ammoModel[0].addBox(1F, 3F, -0.5F, 2, 1, 1);
   
    translateAll(0F, -0.5F, 0F);
     
    gunSlideDistance = 0.5F;
    animationType = EnumAnimationType.RIFLE_TOP;
    pumpDelayAfterReload = 86;
    pumpDelay = 7;
    pumpTime = 12;
    gripIsOnPump = true;
    pumpHandleDistance = -0.25F;
   
    spinningCocking = true;
    spinPoint = new Vector3f(1F / 16F, 2F / 16F, 0F);
   
    numBulletsInReloadAnimation = 5;
    tiltGunTime = 0.159F;
    unloadClipTime = 0.0F;
    loadClipTime = 0.708F;
View Full Code Here

    ammoModel = new ModelRendererTurbo[1];
   
    ammoModel[0] = new ModelRendererTurbo(this, 14, 0, textureX, textureY);
    ammoModel[0].addBox(-0.5F, -1.8F, -0.5F, 2, 4, 1);
   
    barrelAttachPoint = new Vector3f(7.5F / 16F, 4F / 16F, 0F);
   
    scopeAttachPoint = new Vector3f(3F / 16F, 5F / 16F, 0F);
    scopeIsOnSlide = true;
   
    gunSlideDistance = 0.25F;
    animationType = EnumAnimationType.PISTOL_CLIP;
  }
View Full Code Here

    ammoModel = new ModelRendererTurbo[1];
   
    ammoModel[0] = new ModelRendererTurbo(this, 10, 7, textureX, textureY);
    ammoModel[0].addBox(1.25F, -4F, -0.75F, 1.5F, 6, 1.5F);
   
    barrelAttachPoint = new Vector3f(7.5F / 16F, 3.75F / 16F, 0F);
   
    scopeAttachPoint = new Vector3f(3F / 16F, 5F / 16F, 0F);
   
    gunSlideDistance = 0.25F;
    animationType = EnumAnimationType.PISTOL_CLIP;
  }
View Full Code Here

    {
      gunModel[i].setRotationPoint(0F, 0F, 2F);
    }
   
    //Scope
    scopeAttachPoint = new Vector3f(1.5F / 16F, 5F / 16F, 0F);
   
    //Barrel   
    barrelAttachPoint = new Vector3f(18F / 16F, 4F / 16F, 0F);
   
    //Stock   
    stockAttachPoint = new Vector3f(-1F / 16F, 1F / 16F, 0F);
   
    //Ammo
    ammoModel = new ModelRendererTurbo[3];
   
    ammoModel[0] = new ModelRendererTurbo(this, 60, 0, textureX, textureY);
    ammoModel[0].addBox(-0.5F, -10F, -0.5F, 1, 20, 1);
   
    ammoModel[1] = new ModelRendererTurbo(this, 55, 0, textureX, textureY);
    ammoModel[1].addBox(-1F, -10F, 0F, 2, 1, 0);
   
    ammoModel[2] = new ModelRendererTurbo(this, 55, 2, textureX, textureY);
    ammoModel[2].addBox(0F, -10F, -1F, 0, 1, 2);

   
    for(int i = 0; i < 3; i++)
    {
      ammoModel[i].setRotationPoint(0F, 3.5F, 2F);
      ammoModel[i].rotateAngleZ = -(float)Math.PI / 2F;
    }
     
    gunSlideDistance = 0.5F;
    animationType = EnumAnimationType.END_LOADED;
   
    endLoadedAmmoDistance = 3F;
   
    tiltGunTime = 0.25F;
    unloadClipTime = 0.25F;
    loadClipTime = 0.25F;
    untiltGunTime = 0.25F;
   
    thirdPersonOffset = new Vector3f(0F, 0F, -0.1F);
  }
View Full Code Here

TOP

Related Classes of com.flansmod.common.vector.Vector3f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.