本文整理汇总了Java中net.minecraft.util.EnumHand.values方法的典型用法代码示例。如果您正苦于以下问题:Java EnumHand.values方法的具体用法?Java EnumHand.values怎么用?Java EnumHand.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.EnumHand
的用法示例。
在下文中一共展示了EnumHand.values方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasPlayerGotBoneInHand
import net.minecraft.util.EnumHand; //导入方法依赖的package包/类
/**
* Gets if the Player has the Bone in the hand.
*/
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = player.getHeldItem(enumhand);
if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
{
return true;
}
if (this.theWolf.isBreedingItem(itemstack))
{
return true;
}
}
return false;
}
示例2: hasPlayerGotBoneInHand
import net.minecraft.util.EnumHand; //导入方法依赖的package包/类
/**
* Gets if the Player has the Bone in the hand.
*/
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = player.getHeldItem(enumhand);
if (itemstack != null)
{
if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
{
return true;
}
if (this.theWolf.isBreedingItem(itemstack))
{
return true;
}
}
}
return false;
}
示例3: func_190628_d
import net.minecraft.util.EnumHand; //导入方法依赖的package包/类
private boolean func_190628_d(DamageSource p_190628_1_)
{
if (p_190628_1_.canHarmInCreative())
{
return false;
}
else
{
boolean flag = false;
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = this.getHeldItem(enumhand);
if (itemstack.getItem() == Items.field_190929_cY)
{
itemstack.func_190918_g(1);
flag = true;
break;
}
}
if (flag)
{
if (this instanceof EntityPlayer)
{
((EntityPlayer)this).addStat(StatList.getObjectUseStats(Items.field_190929_cY));
}
this.setHealth(1.0F);
this.clearActivePotions();
this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 900, 1));
this.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 100, 1));
this.world.setEntityState(this, (byte)35);
}
return flag;
}
}
示例4: rightClickMouse
import net.minecraft.util.EnumHand; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
/**
* Called when user clicked he's mouse right button (place)
*/
private void rightClickMouse()
{
if (!this.playerController.getIsHittingBlock())
{
this.rightClickDelayTimer = 4;
if (!this.player.isRowingBoat())
{
if (this.objectMouseOver == null)
{
LOGGER.warn("Null returned as \'hitResult\', this shouldn\'t happen!");
}
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = this.player.getHeldItem(enumhand);
if (this.objectMouseOver != null)
{
switch (this.objectMouseOver.typeOfHit)
{
case ENTITY:
if (this.playerController.interactWithEntity(this.player, this.objectMouseOver.entityHit, this.objectMouseOver, enumhand) == EnumActionResult.SUCCESS)
{
return;
}
if (this.playerController.interactWithEntity(this.player, this.objectMouseOver.entityHit, enumhand) == EnumActionResult.SUCCESS)
{
return;
}
break;
case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
if (this.world.getBlockState(blockpos).getMaterial() != Material.AIR)
{
int i = itemstack.func_190916_E();
EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.player, this.world, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand);
if (enumactionresult == EnumActionResult.SUCCESS)
{
this.player.swingArm(enumhand);
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.playerController.isInCreativeMode()))
{
this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand);
}
return;
}
}
}
}
if (!itemstack.func_190926_b() && this.playerController.processRightClick(this.player, this.world, enumhand) == EnumActionResult.SUCCESS)
{
this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand);
return;
}
}
}
}
}
示例5: rightClickMouse
import net.minecraft.util.EnumHand; //导入方法依赖的package包/类
/**
* Called when user clicked he's mouse right button (place)
*/
@SuppressWarnings("incomplete-switch")
private void rightClickMouse()
{
if (!this.playerController.getIsHittingBlock())
{
this.rightClickDelayTimer = 4;
if (!this.thePlayer.isRowingBoat())
{
for (EnumHand enumhand : EnumHand.values())
{
ItemStack itemstack = this.thePlayer.getHeldItem(enumhand);
if (this.objectMouseOver == null)
{
LOGGER.warn("Null returned as \'hitResult\', this shouldn\'t happen!");
}
else
{
switch (this.objectMouseOver.typeOfHit)
{
case ENTITY:
if (this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit, this.objectMouseOver, this.thePlayer.getHeldItem(enumhand), enumhand) == EnumActionResult.SUCCESS)
{
return;
}
if (this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit, this.thePlayer.getHeldItem(enumhand), enumhand) == EnumActionResult.SUCCESS)
{
return;
}
break;
case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
if (this.theWorld.getBlockState(blockpos).getMaterial() != Material.AIR)
{
int i = itemstack != null ? itemstack.stackSize : 0;
EnumActionResult enumactionresult = this.playerController.processRightClickBlock(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec, enumhand);
if (enumactionresult == EnumActionResult.SUCCESS)
{
this.thePlayer.swingArm(enumhand);
if (itemstack != null)
{
if (itemstack.stackSize == 0)
{
this.thePlayer.setHeldItem(enumhand, (ItemStack)null);
}
else if (itemstack.stackSize != i || this.playerController.isInCreativeMode())
{
this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand);
}
}
return;
}
}
}
}
ItemStack itemstack1 = this.thePlayer.getHeldItem(enumhand);
if (itemstack1 == null && (this.objectMouseOver == null || this.objectMouseOver.typeOfHit == RayTraceResult.Type.MISS)) net.minecraftforge.common.ForgeHooks.onEmptyClick(this.thePlayer, enumhand);
if (itemstack1 != null && this.playerController.processRightClick(this.thePlayer, this.theWorld, itemstack1, enumhand) == EnumActionResult.SUCCESS)
{
this.entityRenderer.itemRenderer.resetEquippedProgress(enumhand);
return;
}
}
}
}
}