@Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (ZSSPlayerInfo.get(player).canBlock()) {
     player.setItemInUse(stack, getMaxItemUseDuration(stack));
   }
   return stack;
 }
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  @Override
  public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer entity) {
    MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, entity, true);
    FoodStatsTFC fs = TFC_Core.getPlayerFoodStats(entity);

    if (mop == null) {
      if (is.getItemDamage() > 1 && fs.needDrink()) {
        entity.setItemInUse(is, this.getMaxItemUseDuration(is));
      }
    } else {
      if (mop.typeOfHit == EnumMovingObjectType.TILE) {
        int i = mop.blockX;
        int j = mop.blockY;
        int k = mop.blockZ;
        if (world.getBlockTileEntity(i, j, k) != null
            && world.getBlockTileEntity(i, j, k) instanceof TEBarrel) {
          TEBarrel TE = (TEBarrel) world.getBlockTileEntity(i, j, k);
          if (TE.checkValidAddition(13)) {
            return new ItemStack(TFCItems.WoodenBucketEmpty);
          }
        }
      }
    }
    return is;
  }
Exemple #3
0
  @Override
  public boolean onItemUse(
      ItemStack guitar,
      EntityPlayer player,
      World world,
      int x,
      int y,
      int z,
      int par7,
      float par8,
      float par9,
      float par10) {
    if (!player.worldObj.isRemote) {
      Block block = world.getBlock(x, y, z);

      if (block == Blocks.noteblock) {
        player.addChatComponentMessage(new ChatComponentTranslation("symphonia.instrument.tuning"));

      } else {
        player.setItemInUse(guitar, getMaxItemUseDuration(guitar));
        note = itemRand.nextFloat() + 0.5F;
        player.worldObj.playSoundAtEntity(
            player, Reference.MODID + ":" + "guitarnote1", 1.0F, note);
      }
    }
    return true;
  }
  public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
    if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) {
      playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
    }

    return itemStackIn;
  }
 @Override
 @ModDependent(ModList.THAUMCRAFT)
 public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player) {
   player.setItemInUse(wandstack, Integer.MAX_VALUE);
   ReikaThaumHelper.setWandInUse(wandstack, this);
   return wandstack;
 }
 @Override
 public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
   if (entityplayer.inventory.hasItem(this)) {
     entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
   }
   return itemstack;
 }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {

    if ((player.inventory.getStackInSlot(player.inventory.currentItem - 1) != null)) {
      if ((player.inventory.getStackInSlot(player.inventory.currentItem - 1).getItem()
          == (ModItems.itemModelArrow))) {
        player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
        bowUse = true;
      }
      if ((player.inventory.getStackInSlot(player.inventory.currentItem - 1).getItem()
          == (ModItems.itemIronTippedModelArrow))) {
        player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
        bowUse = true;
      }
    }
    return stack;
  }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    if (player.experienceLevel > 0 && player.inventory.hasItem(Item.bucketEmpty.itemID)) {
      player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
    }

    return stack;
  }
  @Override
  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
    if (entityplayer.inventory.hasItemStack(new ItemStack(AliensVsPredator.items().itemDisc))) {
      entityplayer.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
    }

    return itemstack;
  }
Exemple #10
0
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  public ItemStack onItemRightClick(
      ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
    if (p_77659_3_.capabilities.isCreativeMode || p_77659_3_.inventory.hasItem(Items.arrow)) {
      p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
  }
 @Override
 public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
   if (itemstack.stackSize <= 0) return itemstack;
   if (isCharged(entityplayer)) {
     int i = getMaxItemUseDuration(itemstack);
     entityplayer.setItemInUse(itemstack, i);
   }
   return itemstack;
 }
Exemple #12
0
  @Override
  public ItemStack onItemRightClick(ItemStack guitar, World world, EntityPlayer player) {
    player.setItemInUse(guitar, getMaxItemUseDuration(guitar));
    if (!player.worldObj.isRemote) {
      note = itemRand.nextFloat() + 0.5F;
      player.worldObj.playSoundAtEntity(player, Reference.MODID + ":" + "guitarnote1", 1.0F, note);
    }

    return guitar;
  }
  @Override
  public void handleNockEvent(ArrowNockEvent event) {

    EntityPlayer player = event.entityPlayer;

    if (InventoryUtil.hasItemInHotbar(player, (Item) this.item)) {
      player.setItemInUse(event.result, ItemReference.BOW.getMaxItemUseDuration(event.result));
      event.setCanceled(true);
    }
  }
Exemple #14
0
 @Override
 public ItemStack onItemRightClick(
     ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
   AllomancyData data;
   data = AllomancyData.forPlayer(par3EntityPlayer);
   if (data.MetalAmounts[par1ItemStack.getItemDamage() - 1] < 10) {
     par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
   }
   return par1ItemStack;
 }
  @Override
  public ItemStack onFocusRightClick(
      ItemStack paramItemStack,
      World paramWorld,
      EntityPlayer paramEntityPlayer,
      MovingObjectPosition paramMovingObjectPosition) {
    if (isUseItem()) paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE);

    return paramItemStack;
  }
 @Override
 public ItemStack onFocusRightClick(
     ItemStack wandStack,
     World world,
     EntityPlayer player,
     MovingObjectPosition movingobjectposition) {
   player.setItemInUse(wandStack, 2147483647);
   // WandManager.setCooldown(player, -1);
   return wandStack;
 }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    if (getAmmoCount(stack) <= 0) return stack;

    launchProjectile(stack, world, player, 1);

    // this is only used for the animation
    player.setItemInUse(stack, this.getMaxItemUseDuration(stack));

    return stack;
  }
 @Override
 public ItemStack onItemRightClick(ItemStack weapon, World world, EntityPlayer entityPlayer) {
   if (world.isRemote
       && canFire(weapon, world, entityPlayer)
       && hasShootDelayPassed()
       && !entityPlayer.isUsingItem()) {
     entityPlayer.setItemInUse(weapon, getMaxItemUseDuration(weapon));
     playChargingSound(entityPlayer);
   }
   return weapon;
 }
Exemple #19
0
  @Override
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    if (par1ItemStack.getItemDamage() > 14
        && par1ItemStack.getItemDamage() < 19
        && par3EntityPlayer.canEat(false)) {
      par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
  }
  public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
    int var4 = var3.getFoodStats().getFoodLevel();

    if (var4 > 6
        && var2.canBlockSeeTheSky(
            (int) (var3.posX - 0.5D), (int) var3.posY, (int) (var3.posZ - 0.5D))) {
      var3.setItemInUse(var1, this.getMaxItemUseDuration(var1));
    }

    return var1;
  }
 @Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true);
   if (mop != null && mop.typeOfHit == EnumMovingObjectType.TILE) {
     if (MFRRegistry.getFluidDrinkHandlers()
         .containsKey(world.getBlockId(mop.blockX, mop.blockY, mop.blockZ))) {
       player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
     }
   }
   return stack;
 }
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    ISceptreFocus focus = getFocus(stack);
    if (focus != null) focus.onClickBegin(player, stack, world);

    if (world.isRemote) {
      gestureManager = new GestureTrackMap();
      lastOffset = new float[] {player.getRotationYawHead(), player.rotationPitch};
    }

    player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
    return stack;
  }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    DrugProperties drugProperties = DrugProperties.getDrugProperties(player);

    if (drugProperties != null && drugProperties.timeBreathingSmoke <= 0) {
      if (getUsedConsumable(player) != null) {
        player.setItemInUse(stack, getMaxItemUseDuration(stack));
      }
    }

    return stack;
  }
Exemple #24
0
 public ItemStack onItemRightClick(
     ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
   ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
   MinecraftForge.EVENT_BUS.post(event);
   if (event.isCanceled()) {
     return event.result;
   }
   if (par3EntityPlayer.capabilities.isCreativeMode
       || par3EntityPlayer.inventory.hasItem(Wildycraft.astralRune)) {
     par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
   }
   return par1ItemStack;
 }
 @SubscribeEvent
 public void onPlayerTick(TickEvent.PlayerTickEvent event) {
   if (event.side.isClient()
       && event.phase == TickEvent.Phase.START
       && event.player != null
       && event.player == ClientUtils.mc().renderViewEntity) {
     skyhookGrabableConnections.clear();
     EntityPlayer player = event.player;
     ItemStack stack = player.getCurrentEquippedItem();
     if (stack != null && stack.getItem() instanceof ItemSkyhook) {
       TileEntity connector = null;
       double lastDist = 0;
       Connection line = null;
       double py = player.posY + player.getEyeHeight();
       for (int xx = -2; xx <= 2; xx++)
         for (int zz = -2; zz <= 2; zz++)
           for (int yy = 0; yy <= 3; yy++) {
             TileEntity tile =
                 player.worldObj.getTileEntity(
                     (int) player.posX + xx, (int) py + yy, (int) player.posZ + zz);
             if (tile != null) {
               Connection con =
                   SkylineHelper.getTargetConnection(
                       player.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, player, null);
               if (con != null) {
                 double d = tile.getDistanceFrom(player.posX, py, player.posZ);
                 if (connector == null || d < lastDist) {
                   connector = tile;
                   lastDist = d;
                   line = con;
                 }
               }
             }
           }
       if (line != null && connector != null) skyhookGrabableConnections.add(line);
     }
   }
   if (event.side.isClient() && event.phase == TickEvent.Phase.END && event.player != null) {
     EntityPlayer player = event.player;
     ItemStack stack = player.getCurrentEquippedItem();
     if (stack != null
         && stack.getItem() instanceof ItemDrill
         && (player != ClientUtils.mc().renderViewEntity
             || ClientUtils.mc().gameSettings.thirdPersonView != 0)) {
       if (player.getItemInUseCount() <= 0) {
         player.clearItemInUse();
         player.setItemInUse(stack, 2147483647);
       }
     }
   }
 }
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  @Override
  public ItemStack onItemRightClick(ItemStack var1, World var2, EntityPlayer var3) {
    ArrowNockEvent var4 = new ArrowNockEvent(var3, var1);
    MinecraftForge.EVENT_BUS.post(var4);

    if (var4.isCanceled()) return var4.result;
    else {
      if (var3.capabilities.isCreativeMode
          || var3.inventory.hasItem(IceikaItemHelper.icicleBow.itemID)) {
        var3.setItemInUse(var1, this.getMaxItemUseDuration(var1));
      }

      return var1;
    }
  }
  @Override
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {

    if (!player.capabilities.isCreativeMode && getEnergyStored(stack) < getEnergyPerUse(stack)) {
      return stack;
    }
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) {
      return event.result;
    }
    if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow)) {
      player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
    }
    return stack;
  }
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  @Override
  public ItemStack onItemRightClick(
      ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
    ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) {
      return event.result;
    }

    if (p_77659_3_.capabilities.isCreativeMode
        || p_77659_3_.inventory.hasItem(ModItems.gun_rpg_ammo)) {
      p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
  }
Exemple #29
0
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  @Override
  public ItemStack onItemRightClick(ItemStack ist, World world, EntityPlayer player) {
    PotionEssence essence = new PotionEssence(ist.getTagCompound());
    if (!getSplash(ist)) {
      if (essence.getEffects().size() > 0) {
        player.setItemInUse(ist, this.getMaxItemUseDuration(ist));
        return ist;
      } else {
        MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, true);

        if (mop == null) return ist;
        else {
          if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
            int blockX = mop.blockX;
            int blockY = mop.blockY;
            int blockZ = mop.blockZ;
            if (world.getBlock(blockX, blockY, blockZ) instanceof BlockApothecaryCauldron) {
              TileEntityCauldron cauldronTile =
                  (TileEntityCauldron) world.getTileEntity(blockX, blockY, blockZ);
              NBTTagCompound potionTag = cauldronTile.removeContainedPotion();
              ItemStack newPotion = new ItemStack(this, 1, 0);
              newPotion.setTagCompound(potionTag);

              if (--ist.stackSize <= 0) {
                return newPotion;
              }

              if (!player.inventory.addItemStackToInventory(newPotion)) {
                player.entityDropItem(newPotion, 0.1F);
              }
            }
          }
        }
      }
    } else {
      if (world.isRemote) return ist;
      Entity e = new EntityThrownXRPotion(world, player, ist);
      if (e == null) return ist;
      if (!player.capabilities.isCreativeMode) {
        --ist.stackSize;
      }
      world.playSoundAtEntity(
          player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
      world.spawnEntityInWorld(e);
    }
    return ist;
  }
  @Override
  public void onRightClick(EntityPlayer player, World world, ItemStack itemStack) {
    player.setItemInUse(itemStack, 10);
    if (!world.isRemote) {
      double energyConsumption = ModuleManager.computeModularProperty(itemStack, ENERGY);
      // MuseHeatUtils.heatPlayer(player, energyConsumption / 500);
      if (ElectricItemUtils.getPlayerEnergy(player) > energyConsumption) {
        ElectricItemUtils.drainPlayerEnergy(player, energyConsumption);

        double red = ModuleManager.computeModularProperty(itemStack, RED);
        double green = ModuleManager.computeModularProperty(itemStack, GREEN);
        double blue = ModuleManager.computeModularProperty(itemStack, BLUE);
        EntityLuxCapacitor luxCapacitor = new EntityLuxCapacitor(world, player, red, green, blue);
        world.spawnEntityInWorld(luxCapacitor);
      }
    }
  }