當前位置: 首頁>>代碼示例>>Java>>正文


Java ArrowNockEvent類代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.player.ArrowNockEvent的典型用法代碼示例。如果您正苦於以下問題:Java ArrowNockEvent類的具體用法?Java ArrowNockEvent怎麽用?Java ArrowNockEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArrowNockEvent類屬於net.minecraftforge.event.entity.player包,在下文中一共展示了ArrowNockEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: arrowNock

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
@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;
		}
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:19,代碼來源:ServerEventHandler.java

示例2: handleNock

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
@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;
							}
						}
					}
				}
			}
		}
	}
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:27,代碼來源:EventHandler.java

示例3: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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_;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:20,代碼來源:itemPatBow.java

示例4: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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_;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:20,代碼來源:itemJenBow.java

示例5: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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_;
}
 
開發者ID:DracoAnimus,項目名稱:Coding,代碼行數:20,代碼來源:ItemCrossbow.java

示例6: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
@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;
}
 
開發者ID:spacechase0,項目名稱:ComponentEquipment,代碼行數:19,代碼來源:BowItem.java

示例7: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:20,代碼來源:ItemBowMF.java

示例8: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
@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;
 }
 
開發者ID:MikeLydeamore,項目名稱:IlluminatedBows,代碼行數:18,代碼來源:ItemIlluminatedBow.java

示例9: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:22,代碼來源:AirStaff.java

示例10: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:21,代碼來源:FireStaff.java

示例11: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:21,代碼來源:RuneBow.java

示例12: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:MinecraftModArchive,項目名稱:Runes-And-Silver,代碼行數:21,代碼來源:WaterStaff.java

示例13: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:20,代碼來源:ItemNileBow.java

示例14: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
@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;
}
 
開發者ID:mookie1097,項目名稱:NausicaaMod,代碼行數:21,代碼來源:Flaregun.java

示例15: onItemRightClick

import net.minecraftforge.event.entity.player.ArrowNockEvent; //導入依賴的package包/類
/**
    * 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;
   }
 
開發者ID:mookie1097,項目名稱:NausicaaMod,代碼行數:21,代碼來源:Blowgun.java


注:本文中的net.minecraftforge.event.entity.player.ArrowNockEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。