本文整理汇总了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());
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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));
}
示例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);
}
示例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);
}
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}