Package com.flansmod.common.guns

Examples of com.flansmod.common.guns.ItemGun


        }
      }
     
      else if(heldItem instanceof ItemGun)
      {
        ItemGun gunItem = (ItemGun)heldItem;
        GunType gunType = gunItem.type;
       
        //Get the correct shoot delay
        int delay = left ? shootDelayLeft : shootDelayRight;
       
        //If we can shoot
        if(delay <= 0)
        {
          //Go through the bullet stacks in the gun and see if any of them are not null
          int bulletID = 0;
          ItemStack bulletStack = null;
          for(; bulletID < gunType.numAmmoItemsInGun; bulletID++)
          {
            ItemStack checkingStack = gunItem.getBulletItemStack(heldStack, bulletID);
            if(checkingStack != null && checkingStack.getItem() != null && checkingStack.getItemDamage() < checkingStack.getMaxDamage())
            {
              bulletStack = checkingStack;
              break;
            }
          }

          //If no bullet stack was found, reload
          if(bulletStack == null)
          {
            gunItem.reload(heldStack, gunType, worldObj, this, driveableData, (infiniteAmmo() ? true : creative), false);       
          }
          //A bullet stack was found, so try shooting with it
          else if(bulletStack.getItem() instanceof ItemBullet)
          {
            //Shoot
            shoot(heldStack, gunType, bulletStack, creative, left);
           
            //Apply animations to 3D modelled guns
            //TODO : Move to client side and sync
            if(worldObj.isRemote)
            {
              int pumpDelay = gunType.model == null ? 0 : gunType.model.pumpDelay;
              int pumpTime = gunType.model == null ? 1 : gunType.model.pumpTime;
              if(left)
              {
                leftAnimations.doShoot(pumpDelay, pumpTime);
              }
              else
              {
                rightAnimations.doShoot(pumpDelay, pumpTime);
              }
            }
            //Damage the bullet item
            bulletStack.setItemDamage(bulletStack.getItemDamage() + 1);
           
            //Update the stack in the gun
            gunItem.setBulletItemStack(heldStack, bulletStack, bulletID);
          }
        }
      }
        }
    return true;
View Full Code Here


          infoType.read(typeFile);
          switch(type)
          {
          case bullet : bulletItems.add((ItemBullet)new ItemBullet((BulletType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case attachment : attachmentItems.add((ItemAttachment)new ItemAttachment((AttachmentType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case gun : gunItems.add((ItemGun)new ItemGun((GunType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case grenade : grenadeItems.add((ItemGrenade)new ItemGrenade((GrenadeType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case part : partItems.add((ItemPart)new ItemPart((PartType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case plane : planeItems.add((ItemPlane)new ItemPlane((PlaneType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case vehicle : vehicleItems.add((ItemVehicle)new ItemVehicle((VehicleType)infoType).setUnlocalizedName(infoType.shortName)); break;
          case aa : aaGunItems.add((ItemAAGun)new ItemAAGun((AAGunType)infoType).setUnlocalizedName(infoType.shortName)); break;
View Full Code Here

    ItemStack stackInSlot = player.inventory.getStackInSlot(slot - 1);
    if(stackInSlot == null)
      return false;
    if(stackInSlot.getItem() instanceof ItemGun)
    {
      ItemGun item = ((ItemGun)stackInSlot.getItem());
      if(item.type.oneHanded)
        return true;
    }
    return false;
  }
View Full Code Here

      if(mc.thePlayer != null)
      {
        ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
        if(stack != null && stack.getItem() instanceof ItemGun)
        {
          ItemGun gunItem = (ItemGun)stack.getItem();
          GunType gunType = gunItem.type;
          int x = 0;
          for(int n = 0; n < gunType.numAmmoItemsInGun; n++)
          {
            ItemStack bulletStack = ((ItemGun)stack.getItem()).getBulletItemStack(stack, n);
View Full Code Here

TOP

Related Classes of com.flansmod.common.guns.ItemGun

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.