当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.setActiveHand方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.setActiveHand方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.setActiveHand方法的具体用法?Java EntityPlayer.setActiveHand怎么用?Java EntityPlayer.setActiveHand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.setActiveHand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
	Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);
	PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
	
	if (statsCap != null && playerInfo != null)
	{
		if (statsCap.getMana() - this.manaPerUse >= 0 && playerInfo.getPlayerLevel() >= NBTHelper.loadStackNBT(player.inventory.getCurrentItem()).getInteger("Level"))
		{	
			player.setActiveHand(hand);
			return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.inventory.getCurrentItem());
		}
	}
	
	if (playerInfo.getPlayerLevel() < NBTHelper.loadStackNBT(player.inventory.getCurrentItem()).getInteger("Level"))
	{
		player.sendMessage(new TextComponentString(TextFormatting.RED + "WARNING: You are using a high-leveled item. It will be useless and will take significantly more damage if it is not removed."));
	}
	
	return new ActionResult<ItemStack>(EnumActionResult.FAIL, player.inventory.getCurrentItem());
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:23,代码来源:ItemLEMagical.java

示例2: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World par2World, EntityPlayer player,
		EnumHand hand) {
	// System.out.println("lel "+stack.getTagCompound().getInteger("wait")+"
	// "+this.allowShot(player,stack, par2World));
	ItemStack stack=player.getHeldItem(hand);
	if (!(stack.hasTagCompound() && stack.getTagCompound().getInteger("wait") > 0)
			&& this.allowShot(player, stack, par2World)) {
		if (!this.usesBowAnimation(stack))
			this.use(stack, par2World, player, 1.8f,
					player.inventory.getStackInSlot(this.getSlotForUse(player, stack)), false);
		else
			// System.out.println("trying");
			player.setActiveHand(hand);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:TNTCannon.java

示例3: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    boolean flag = this.findAmmo(playerIn) != null;

    ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, hand, flag);
    if (ret != null) return ret;

    if (!playerIn.capabilities.isCreativeMode && !flag)
    {
        return !flag ? new ActionResult(EnumActionResult.FAIL, itemStackIn) : new ActionResult(EnumActionResult.PASS, itemStackIn);
    }
    else
    {
        playerIn.setActiveHand(hand);
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ItemBow.java

示例4: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the equipped item is right clicked.
 */
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
    ItemStack itemstack = playerIn.getHeldItem(handIn);
    boolean flag = !this.findAmmo(playerIn).isEmpty();

    ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, worldIn, playerIn, handIn, flag);
    if (ret != null) return ret;

    if (!playerIn.capabilities.isCreativeMode && !flag)
    {
        return flag ? new ActionResult(EnumActionResult.PASS, itemstack) : new ActionResult(EnumActionResult.FAIL, itemstack);
    }
    else
    {
        playerIn.setActiveHand(handIn);
        return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
    }
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:22,代码来源:ItemCGBow.java

示例5: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	playerIn.setActiveHand(hand);
	if (!worldIn.isRemote) {
		BlockPos pos = playerIn.getPosition();
		int id = GuiElementLoader.GUI_PICTURE_BOOK;
		playerIn.openGui(MineCamera.instance, id, worldIn, pos.getX(), pos.getY(), pos.getZ());
	}
	return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:12,代码来源:ItemPictureBook.java

示例6: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.canEat(this.alwaysEdible))
    {
        playerIn.setActiveHand(hand);
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemStackIn);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:ItemFood.java

示例7: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
	boolean flag = canItemBeUsed(worldIn, playerIn, handIn);
	if(flag && getMaxItemUseDuration(playerIn.getHeldItem(handIn)) > 0)
		playerIn.setActiveHand(handIn);
	if(getMaxItemUseDuration(playerIn.getHeldItem(handIn)) < 0)
		onItemUseFinish(playerIn.getHeldItem(handIn), worldIn, playerIn);
	return new ActionResult<ItemStack>(flag ? EnumActionResult.SUCCESS : EnumActionResult.PASS, playerIn.getHeldItem(handIn));
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:10,代码来源:BaseHarshenStaff.java

示例8: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	ItemStack itemStackIn = playerIn.getHeldItem(hand);
	if (TF2Attribute.getModifier("Rage Crit", itemStackIn, 0, playerIn)!=0 &&playerIn.getCapability(TF2weapons.WEAPONS_CAP, null).getPhlogRage()>=20f) {
		playerIn.setActiveHand(hand);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
	}
	return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:11,代码来源:ItemFlameThrower.java

示例9: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
       ItemStack itemstack = playerIn.getHeldItem(handIn);
       
       if (!this.isEmpty(itemstack)) {
           playerIn.setActiveHand(handIn);
           return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
       } else {
           return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemstack);
       }
   }
 
开发者ID:elytra,项目名称:Thermionics,代码行数:12,代码来源:ItemSpiritBottle.java

示例10: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	player.setActiveHand(hand);

	ItemStack stack = player.getHeldItem(hand);

	this.getSpell(stack).onCast(world, player, stack);
	return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:10,代码来源:ItemSpellBook.java

示例11: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
	ItemStack itemstack = playerIn.getHeldItem(handIn);
	playerIn.setActiveHand(handIn);
	spell.songStarted(playerIn, itemstack);

    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:10,代码来源:ItemTempSpellCaster.java

示例12: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);
    player.setActiveHand(hand);
    return new ActionResult<>(EnumActionResult.SUCCESS, itemstack);
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:9,代码来源:ItemMorphine.java

示例13: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick( World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	ItemStack itemStackIn=playerIn.getHeldItem(hand);
	Integer value = playerIn.getCapability(TF2weapons.WEAPONS_CAP, null).effectsCool
			.get(getData(itemStackIn).getName());
	if (value == null || value <= 0) {
		playerIn.setActiveHand(hand);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
	}
	return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:ItemBonk.java

示例14: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
    ItemStack stack = playerIn.getHeldItem(handIn);

    if (playerIn.canEat(content.alwaysEdible.get(stack.getMetadata()).orElse(false)))
    {
        playerIn.setActiveHand(handIn);
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    } else
    {
        return new ActionResult<>(EnumActionResult.FAIL, stack);
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:15,代码来源:ItemFood.java

示例15: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    player.setActiveHand(hand);
    return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
 
开发者ID:JamiesWhiteShirt,项目名称:trumpet-skeleton,代码行数:6,代码来源:ItemTrumpet.java


注:本文中的net.minecraft.entity.player.EntityPlayer.setActiveHand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。