本文整理匯總了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;
}
}
}
示例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;
}
}
}
}
}
}
}
}
示例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_;
}
示例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_;
}
示例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_;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}