Examples of GunType


Examples of com.flansmod.common.guns.GunType

      riddenByEntity.mountEntity(null);
       
    if(key == 9) //Shoot
    {
      //Get the gun from the plane type and the ammo from the data
      GunType gun = seatInfo.gunType;
     
      minigunSpeed += 0.1F;
     
      if(gun != null && gun.mode != EnumFireMode.MINIGUN || minigunSpeed > 2F)
      {
        if(gunDelay <= 0 && TeamsManager.bulletsEnabled)
        {
 
          ItemStack bulletItemStack = driveable.getDriveableData().ammo[seatInfo.gunnerID];
          //Check that neither is null and that the bullet item is actually a bullet
          if(gun != null && bulletItemStack != null && bulletItemStack.getItem() instanceof ItemShootable)
          {
            ShootableType bullet = ((ItemShootable)bulletItemStack.getItem()).type;
            if(gun.isAmmo(bullet))
            {
              //Gun origin
              Vector3f gunOrigin = Vector3f.add(driveable.axes.findLocalVectorGlobally(seatInfo.gunOrigin), new Vector3f(driveable.posX, driveable.posY, driveable.posZ), null);
              //Calculate the look axes globally
              RotatedAxes globalLookAxes = driveable.axes.findLocalAxesGlobally(looking);
View Full Code Here

Examples of com.flansmod.common.guns.GunType

          damage = Integer.parseInt(split[3]);
        }
        ItemStack stack = new ItemStack(matchingItem, amount, damage);
        if(itemNames.length > 1 && matchingItem instanceof ItemGun)
        {
          GunType gunType = ((ItemGun)matchingItem).type;
            NBTTagCompound tags = new NBTTagCompound();
            NBTTagCompound attachmentTags = new NBTTagCompound();
            int genericID = 0;
            for(int i = 0; i < itemNames.length - 1; i++)
            {
              AttachmentType attachment = AttachmentType.getAttachment(itemNames[i + 1]);
              if(attachment != null)
              {
                String tagName = null;
                switch(attachment.type)
                {
                  case sights : tagName = "scope"; break;
                  case barrel : tagName = "barrel"; break;
                  case stock : tagName = "stock"; break;
                  case grip : tagName = "grip"; break;
                  case generic : tagName = "generic_" + genericID++; break;
                }
                NBTTagCompound specificAttachmentTags = new NBTTagCompound();
                new ItemStack(attachment.item).writeToNBT(specificAttachmentTags);
                attachmentTags.setTag(tagName, specificAttachmentTags);
              }
              //Maybe it was a paintjob
              else
              {
                Paintjob paintjob = gunType.getPaintjob(itemNames[i + 1]);
                if(paintjob != null)
                  tags.setString("Paint", paintjob.iconName);
              }
            }
            tags.setTag("attachments", attachmentTags);
View Full Code Here

Examples of com.flansmod.common.guns.GunType

      gunStack = player.inventory.getStackInSlot(data.offHandGunSlot - 1);
    }
       
    if(gunStack == null || !(gunStack.getItem() instanceof ItemGun))
      return;
    GunType gunType = ((ItemGun)gunStack.getItem()).type;
       
    //Render!
    GL11.glPushMatrix();
    renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F);
        GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
View Full Code Here

Examples of com.flansmod.common.guns.GunType

            for(int i = 0; i < player.inventory.getSizeInventory(); i++)
            {
              ItemStack stack = player.inventory.getStackInSlot(i);
              if(stack != null && stack.getItem() != null && stack.getItem() instanceof ItemGun)
              {
                GunType type = ((ItemGun)stack.getItem()).type;
                for(int j = ammoStacks.size() - 1; j >= 0; j--)
                {
                  ItemStack ammoStack = ammoStacks.get(j);
                  if(type.isAmmo(((ItemShootable)ammoStack.getItem()).type))
                  {
                    if(player.inventory.addItemStackToInventory(ammoStack))
                    {
                      FMLCommonHandler.instance().firePlayerItemPickupEvent(player, this);
                              playSound("random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
 
View Full Code Here

Examples of com.flansmod.common.guns.GunType

    if(!event.isCanceled())
    {
        ItemStack currentItem = player.getCurrentEquippedItem();
        if(currentItem != null && currentItem.getItem() instanceof ItemGun)
        {
          GunType gunType = ((ItemGun)currentItem.getItem()).type;
          List<ItemStack> newAmmoStacks = new ArrayList<ItemStack>();
          for(int i = 0; i < player.inventory.getSizeInventory(); i++)
          {
            ItemStack stack = player.inventory.getStackInSlot(i);
            if(stack != null && stack.getItem() instanceof ItemShootable)
            {
              ShootableType bulletType = ((ItemShootable)stack.getItem()).type;
              if(gunType.isAmmo(bulletType))
              {
                newAmmoStacks.add(stack.copy());
                player.inventory.setInventorySlotContents(i, null);
              }
            }
View Full Code Here

Examples of com.flansmod.common.guns.GunType

      {
        stack = playerEntity.inventory.getStackInSlot(data.offHandGunSlot - 1);
      }
      if(data != null && stack != null && stack.getItem() instanceof ItemGun)
      {
        GunType type = ((ItemGun)stack.getItem()).type;
        if(((ItemGun)stack.getItem()).reload(stack, type, playerEntity.worldObj, playerEntity, true, left))
        {
          //Set the reload delay
          data.shootTimeRight = data.shootTimeLeft = type.reloadTime;
          if(left)
View Full Code Here

Examples of com.flansmod.common.guns.GunType

      PlayerData data = PlayerHandler.getPlayerData(clientPlayer, Side.CLIENT);
      if(left)
        stack = clientPlayer.inventory.getStackInSlot(data.offHandGunSlot - 1);
      if(stack != null && stack.getItem() instanceof ItemGun)
      {
        GunType type = ((ItemGun)stack.getItem()).type;
        if(left)
          FlansModClient.shootTimeLeft = type.reloadTime;
        else FlansModClient.shootTimeRight = type.reloadTime;
       
        //Apply animations
        GunAnimations animations = null;
        if(left)
        {
          if(FlansModClient.gunAnimationsLeft.containsKey(clientPlayer))
          animations = FlansModClient.gunAnimationsLeft.get(clientPlayer);
        else
        {
          animations = new GunAnimations();
          FlansModClient.gunAnimationsLeft.put(clientPlayer, animations);
        }
        }
        else
        {
        if(FlansModClient.gunAnimationsRight.containsKey(clientPlayer))
          animations = FlansModClient.gunAnimationsRight.get(clientPlayer);
        else
        {
          animations = new GunAnimations();
          FlansModClient.gunAnimationsRight.put(clientPlayer, animations);
        }
        }
      int pumpDelay = type.model == null ? 0 : type.model.pumpDelayAfterReload;
      int pumpTime = type.model == null ? 1 : type.model.pumpTime;
      animations.doReload(type.reloadTime, pumpDelay, pumpTime);
       
      //Iterate over all inventory slots and find the magazine / bullet item with the most bullets
      int bestSlot = -1;
      int bulletsInBestSlot = 0;
      for (int j = 0; j < clientPlayer.inventory.getSizeInventory(); j++)
      {
        ItemStack item = clientPlayer.inventory.getStackInSlot(j);
        if (item != null && item.getItem() instanceof ItemShootable && type.isAmmo(((ItemShootable)(item.getItem())).type))
        {
          int bulletsInThisSlot = item.getMaxDamage() - item.getItemDamage();
          if(bulletsInThisSlot > bulletsInBestSlot)
          {
            bestSlot = j;
View Full Code Here

Examples of com.flansmod.common.guns.GunType

    //If its a pilot gun, then it is using a gun type, so do the following
    if(shootPoint instanceof PilotGun)
    {
      PilotGun pilotGun = (PilotGun)shootPoint;
      //Get the gun from the plane type and the ammo from the data
      GunType gunType = pilotGun.type;
      ItemStack bulletItemStack = driveableData.ammo[getDriveableType().numPassengerGunners + currentGun];
      //Check that neither is null and that the bullet item is actually a bullet
      if(gunType != null && bulletItemStack != null && bulletItemStack.getItem() instanceof ItemShootable && TeamsManager.bulletsEnabled)
      {
        ShootableType bullet = ((ItemShootable)bulletItemStack.getItem()).type;
        if(gunType.isAmmo(bullet))
        {
          //Spawn a new bullet item
          worldObj.spawnEntityInWorld(((ItemShootable)bulletItemStack.getItem()).getEntity(worldObj, Vector3f.add(gunVec, new Vector3f((float)posX, (float)posY, (float)posZ), null), lookVector, (EntityLivingBase)seats[0].riddenByEntity, gunType.bulletSpread / 2, gunType.damage, 2.0F,bulletItemStack.getItemDamage(), type));
          //Play the shoot sound
          PacketPlaySound.sendSoundPacket(posX, posY, posZ, FlansMod.soundRange, dimension, type.shootSound(secondary), false);
View Full Code Here

Examples of com.flansmod.common.guns.GunType

      {
        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);
            if(bulletStack != null && bulletStack.getItem() != null && bulletStack.getItemDamage() < bulletStack.getMaxDamage())
            {
              RenderHelper.enableGUIStandardItemLighting();
              GL11.glEnable(GL12.GL_RESCALE_NORMAL);
              OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
              drawSlotInventory(mc.fontRenderer, bulletStack, i / 2 + 16 + x, j - 65);
              GL11.glDisable(GL12.GL_RESCALE_NORMAL);
              RenderHelper.disableStandardItemLighting();
              String s = (bulletStack.getMaxDamage() - bulletStack.getItemDamage()) + "/" + bulletStack.getMaxDamage();
              if(bulletStack.getMaxDamage() == 1)
                s = "";
              mc.fontRenderer.drawString(s, i / 2 + 32 + x, j - 59, 0x000000);
              mc.fontRenderer.drawString(s, i / 2 + 33 + x, j - 60, 0xffffff);
              x += 16 + mc.fontRenderer.getStringWidth(s);
            }
          }
          //Render secondary gun
          PlayerData data = PlayerHandler.getPlayerData(mc.thePlayer, Side.CLIENT);
          if(gunType.oneHanded && data.offHandGunSlot != 0)
          {
            ItemStack offHandStack = mc.thePlayer.inventory.getStackInSlot(data.offHandGunSlot - 1);
            if(offHandStack != null && offHandStack.getItem() instanceof ItemGun)
            {
              GunType offHandGunType = ((ItemGun)offHandStack.getItem()).type;
              x = 0;
              for(int n = 0; n < offHandGunType.numAmmoItemsInGun; n++)
              {
                ItemStack bulletStack = ((ItemGun)offHandStack.getItem()).getBulletItemStack(offHandStack, n);
                if(bulletStack != null && bulletStack.getItem() != null && bulletStack.getItemDamage() < bulletStack.getMaxDamage())
View Full Code Here

Examples of com.flansmod.common.guns.GunType

      {
        EntityPlayer player = (EntityPlayer)obj;
        ItemStack currentHeldItem = player.getCurrentEquippedItem();
        if(currentHeldItem != null && currentHeldItem.getItem() instanceof ItemGun)
        {
          GunType type = ((ItemGun)currentHeldItem.getItem()).type;
          AttachmentType grip = type.getGrip(currentHeldItem);
          if(grip != null && grip.flashlight)
          {
            for(int i = 0; i < 2; i++)
            {
              MovingObjectPosition ray = player.rayTrace(grip.flashlightRange / 2F * (i + 1), 1F);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.