Exemplo n.º 1
0
 public boolean tryFireMinigun(EntityLivingBase target) {
   boolean lastShotOfAmmo = false;
   if (ammo != null && (pressurizable == null || pressurizable.getPressure(stack) > 0)) {
     setMinigunTriggerTimeOut(Math.max(10, getMinigunSoundCounter()));
     if (getMinigunSpeed() == MAX_GUN_SPEED && (!requiresTarget || gunAimedAtTarget)) {
       if (!requiresTarget) target = raytraceTarget();
       lastShotOfAmmo = ammo.attemptDamageItem(1, rand);
       if (pressurizable != null) pressurizable.addAir(stack, -airUsage);
       if (target != null) {
         ItemStack potion = ItemGunAmmo.getPotion(ammo);
         if (potion != null) {
           if (rand.nextInt(20) == 0) {
             List<PotionEffect> effects = Items.potionitem.getEffects(potion);
             if (effects != null) {
               for (PotionEffect effect : effects) {
                 target.addPotionEffect(new PotionEffect(effect));
               }
             }
           }
         } else {
           target.attackEntityFrom(DamageSource.causePlayerDamage(player), 4);
         }
       }
     }
   }
   return lastShotOfAmmo;
 }
Exemplo n.º 2
0
 @Override
 public boolean canInteractWith(EntityPlayer player) {
   if (player.getCurrentEquippedItem() != null
       && player.getCurrentEquippedItem().getItem() == Itemss.amadronTablet) {
     IPressurizable pressurizable = (IPressurizable) Itemss.amadronTablet;
     pressurizable.addAir(player.getCurrentEquippedItem(), -1);
     if (pressurizable.getPressure(player.getCurrentEquippedItem()) > 0) return true;
     else {
       player.addChatMessage(new ChatComponentTranslation("gui.tab.problems.notEnoughPressure"));
     }
   }
   return false;
 }