Java 类net.minecraftforge.event.entity.player.ArrowNockEvent 实例源码

项目:connor41-etfuturum2    文件:ServerEventHandler.java   
@SubscribeEvent
public void arrowNock(ArrowNockEvent event) {
    if (event.result == null)
        return;
    IInventory invt = event.entityPlayer.inventory;
    for (int i = 0; i < invt.getSizeInventory(); i++) {
        ItemStack stack = invt.getStackInSlot(i);
        if (stack == null || stack.stackSize <= 0)
            continue;
        if (stack.getItem() == Items.arrow)
            return;
        if (stack.getItem() == ModItems.tipped_arrow) {
            event.setCanceled(true);
            event.entityPlayer.setItemInUse(event.result, event.result.getItem().getMaxItemUseDuration(event.result));
            return;
        }
    }
}
项目:CrystalMod    文件:EventHandler.java   
@SubscribeEvent
public void handleNock(ArrowNockEvent event){
    if(event.getEntityPlayer() !=null){
        ExtendedPlayer exPlayer = ExtendedPlayerProvider.getExtendedPlayer(event.getEntityPlayer()); 
        if(exPlayer !=null){
            ExtendedPlayerInventory inv = exPlayer.getInventory();
            ItemStack backpack = inv.getStackInSlot(ExtendedPlayerInventory.BACKPACK_SLOT_ID);
            if(ItemStackTools.isValid(backpack)){
                InventoryBackpackUpgrades upgrades = BackpackUtil.getUpgradeInventory(event.getEntityPlayer(), backpack);
                if(upgrades !=null && upgrades.hasUpgrade(BackpackUpgrade.BOW)){
                    InventoryBackpack backpackInv = BackpackUtil.getInventory(event.getEntityPlayer(), backpack);
                    if(backpackInv !=null){
                        for(int i = 0; i < backpackInv.getSize(); i++){
                            ItemStack st = backpackInv.getStackInSlot(i);
                            if(ItemStackTools.isValid(st) && st.getItem() instanceof ItemArrow){
                                event.getEntityPlayer().setActiveHand(event.getHand());
                                event.setAction(new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getBow()));
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:itemPatBow.java   
/**
 * 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_)
{
    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(ItemLoader.itemPatArrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:PopularMMOS-EpicProportions-Mod    文件:itemJenBow.java   
/**
 * 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_)
{
    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(ItemLoader.itemJenArrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:Coding    文件:ItemCrossbow.java   
/**
 * 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_)
{
    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(Items.arrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:Coding    文件:ItemLongBow.java   
/**
 * 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_)
{
    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(Items.arrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:ComponentEquipment    文件:BowItem.java   
@Override
public ItemStack onItemRightClick( ItemStack stack, World world, EntityPlayer player )
{
    ArrowNockEvent event = new ArrowNockEvent( player, stack );
    MinecraftForge.EVENT_BUS.post( event );
    if ( event.isCanceled() )
    {
        return event.result;
    }

    // TODO: Custom arrows
    if ( getActiveArrow( player ) != null )
    {
        player.setItemInUse( stack, this.getMaxItemUseDuration( stack ) );
    }

    return stack;
}
项目:Et-Futurum    文件:ServerEventHandler.java   
@SubscribeEvent
public void arrowNock(ArrowNockEvent event) {
    if (event.result == null)
        return;
    IInventory invt = event.entityPlayer.inventory;
    for (int i = 0; i < invt.getSizeInventory(); i++) {
        ItemStack stack = invt.getStackInSlot(i);
        if (stack == null || stack.stackSize <= 0)
            continue;
        if (stack.getItem() == Items.arrow)
            return;
        if (stack.getItem() == ModItems.tipped_arrow) {
            event.setCanceled(true);
            event.entityPlayer.setItemInUse(event.result, event.result.getItem().getMaxItemUseDuration(event.result));
            return;
        }
    }
}
项目:MineFantasy    文件:ItemBowMF.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, item);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled())
    {
        return event.result;
    }

    if (player.capabilities.isCreativeMode || player.inventory.hasItem(Item.arrow.itemID))
    {
        player.setItemInUse(item, this.getMaxItemUseDuration(item));
    }

    return item;
}
项目:IlluminatedBows    文件:ItemIlluminatedBow.java   
@Override
 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(IlluminatedItems.illuminatedArrow))
      {
          par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
      }

      return par1ItemStack;
 }
项目:Runes-And-Silver    文件:AirStaff.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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.capabilities.isCreativeMode)
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

    }

    return par1ItemStack;
}
项目:Runes-And-Silver    文件:FireStaff.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(ModItems.FireCastingPowder.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Runes-And-Silver    文件:RuneBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Runes-And-Silver    文件:WaterStaff.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(ModItems.WaterCastingPowder.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Runes-And-Silver    文件:FireBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:ZeroQuest    文件:ItemNileBow.java   
/**
 * 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_)
{
    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(Items.arrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:ZeroQuest    文件:ItemNileBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:NausicaaMod    文件:Flaregun.java   
@Override
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Main.flare))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:NausicaaMod    文件:Blowgun.java   
/**
    * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    */
   @Override
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(Main.blowGunDart))
       {
           par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
       }

       return par1ItemStack;
   }
项目:minecraft-mods    文件:DragonBowItem.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Items.arrow))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Cauldron    文件:ItemBow.java   
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(Items.arrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:Cauldron    文件:ItemBow.java   
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(Items.arrow))
    {
        p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
    }

    return p_77659_1_;
}
项目:ZeldaSwordSkills    文件:ItemHeroBow.java   
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) {
        return event.result;
    }
    // This can only be reached if BG2 is not installed or no arrow was found in the quiver
    if (nockArrowFromInventory(stack, player)) {
        int duration = getMaxItemUseDuration(stack);
        if (ZSSMain.isBG2Enabled) {
            duration -= (EnchantmentHelper.getEnchantmentLevel(BaseEnchantment.bowCharge.get().effectId, stack) * 20000);
        }
        player.setItemInUse(stack, duration);
    }
    return stack;
}
项目:RuneCraftery    文件:ItemBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Realms-of-Chaos    文件:ItemROCBow.java   
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled())
    {
        return event.result;
    }

    if (player.capabilities.isCreativeMode || player.inventory.hasItem(ammo))
    {
        player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
    }

    return stack;
}
项目:Wolf-s-addons    文件:Bow.java   
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, itemStack);
    MinecraftForge.EVENT_BUS.post(event);
    if(event.isCanceled())
    {
        return event.result;
    }

    if(player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow))
    {
        player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
    }

    return itemStack;
}
项目:ModTutoriel17    文件:obsidianBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Items.arrow))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:EnderAmmunition    文件:ItemEnderBow.java   
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(EACommonProxy.itemEnderArrow)) {
        par3EntityPlayer.setItemInUse(par1ItemStack,
                this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Battlegear2    文件:BowHookContainerClass2.java   
@SubscribeEvent
public void onBowUse(ArrowNockEvent event){
    // change to use Result: DENY (cannot fire), DEFAULT (attempt standard nocking algorithm), ALLOW (nock without further checks)
    Result canDrawBow = Result.DEFAULT;
    // insert special bow check here:
    if (event.getBow().getItem() instanceof ISpecialBow) {
        canDrawBow = ((ISpecialBow) event.getBow().getItem()).canDrawBow(event.getBow(), event.getEntityPlayer());
    }
    // Special bow did not determine a result, so use standard algorithms instead:
    if (canDrawBow == Result.DEFAULT && (event.hasAmmo() || event.getEntityPlayer().capabilities.isCreativeMode)) {
        canDrawBow = Result.ALLOW;
    }
    if (canDrawBow == Result.DEFAULT) {
        ItemStack quiver = QuiverArrowRegistry.getArrowContainer(event.getBow(), event.getEntityPlayer());
        if (!quiver.isEmpty() && ((IArrowContainer2)quiver.getItem()).
            hasArrowFor(quiver, event.getBow(), event.getEntityPlayer(), ((IArrowContainer2) quiver.getItem()).getSelectedSlot(quiver))) {
            canDrawBow = Result.ALLOW;
        }
    }
    // only nock if allowed
    if (canDrawBow == Result.ALLOW) {
        event.getEntityPlayer().setActiveHand(event.getHand());
        event.setAction(ActionResult.newResult(EnumActionResult.SUCCESS, event.getBow()));
    }
}
项目:AdvancedCraft    文件:netherStarBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:BetterNutritionMod    文件:ItemBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:WuppyMods    文件:ItemBoneSpear.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
@Override
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(ModItems.bonespear))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:CodeLyokoMod    文件:ItemFan.java   
/**
 * Called whenever this item is equipped and the right mouse button is
 * pressed. Args: itemStack, world, entityPlayer
 */
@Override
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(ModItems.fan))
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

    par3EntityPlayer.setItemInUse(par1ItemStack, 72000000);

    return par1ItemStack;
}
项目:CodeLyokoMod    文件:ItemEnergyField.java   
/**
 * Called whenever this item is equipped and the right mouse button is
 * pressed. Args: itemStack, world, entityPlayer
 */
@Override
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(ModItems.energyField))
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

    par3EntityPlayer.setItemInUse(par1ItemStack, 72000000);

    return par1ItemStack;
}
项目:CodeLyokoMod    文件:ItemGlove.java   
/**
 * Called whenever this item is equipped and the right mouse button is
 * pressed. Args: itemStack, world, entityPlayer
 */
@Override
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(ModItems.glove))
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

    par3EntityPlayer.setItemInUse(par1ItemStack, 72000000);

    return par1ItemStack;
}
项目:Modjam-3-Winter-Warfare-Mod    文件:ItemLauncher.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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;
    }

    boolean flag1 = par3EntityPlayer.inventory.hasItem(Item.snowball.itemID) && par3EntityPlayer.inventory.hasItem(WinterWarMain.chooserSnowball.itemID);
    boolean flag2 = par3EntityPlayer.inventory.hasItem(WinterWarMain.iceBall.itemID) && par3EntityPlayer.inventory.hasItem(WinterWarMain.chooserIceball.itemID);
    boolean flag3 = par3EntityPlayer.inventory.hasItem(WinterWarMain.rockySnowBall.itemID) && par3EntityPlayer.inventory.hasItem(WinterWarMain.chooserRockySnowball.itemID);
    boolean flag4 = par3EntityPlayer.inventory.hasItem(WinterWarMain.explodingSnowBall.itemID) && par3EntityPlayer.inventory.hasItem(WinterWarMain.chooserExplodingSnowball.itemID);
    boolean flag5 = par3EntityPlayer.inventory.hasItem(Item.potato.itemID) && par3EntityPlayer.inventory.hasItem(WinterWarMain.chooserPotato.itemID);

    if (par3EntityPlayer.capabilities.isCreativeMode || flag1 || flag2 || flag3 || flag4 || flag5);
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:WeaponsMod    文件:RocketLancher.java   
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(Weapons.rocket1.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        par3EntityPlayer.inventory.consumeInventoryItem(Weapons.rocket1.itemID);
    }

    par2World.playSoundAtEntity(par3EntityPlayer, "random.click", 1.0F, 2);
    return par1ItemStack;



}
项目:ObsidiCraft    文件:ModItemBow.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
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(Item.arrow.itemID))
    {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    }

    return par1ItemStack;
}
项目:Bewitchment    文件:FortuneDropBow.java   
@SubscribeEvent
public void onArrowNock(ArrowNockEvent evt) {
    if (evt.getEntityPlayer() != null && !evt.getEntityPlayer().isCreative() && evt.getHand() == EnumHand.MAIN_HAND) { // Needs to check for mainhand due to how the event works
        CapabilityDivination cap = evt.getEntityPlayer().getCapability(CapabilityDivination.CAPABILITY, null);
        if (cap.getFortune() == this && cap.isActive()) {
            if (evt.getEntityPlayer().dropItem(true) != null) {
                cap.setRemovable();
            }
        }
    }
}
项目:minecraft-quiverbow    文件:EnderBow.java   
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) { return event.result; }

    if (player.capabilities.isCreativeMode || player.inventory.hasItemStack( new ItemStack(Items.arrow) ) )
    {
        player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); 
        this.playerName = player.getDisplayName();  // Recording the player name here, so only they can see the projectile
    }

    return stack;
}