本文整理汇总了C#中ItemStack.damageItem方法的典型用法代码示例。如果您正苦于以下问题:C# ItemStack.damageItem方法的具体用法?C# ItemStack.damageItem怎么用?C# ItemStack.damageItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemStack
的用法示例。
在下文中一共展示了ItemStack.damageItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onItemRightClick
public override ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if (entityplayer.fishEntity != null)
{
int i = entityplayer.fishEntity.func_6143_c();
itemstack.damageItem(i);
entityplayer.swingItem();
}
else
{
world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F/(itemRand.nextFloat()*0.4F + 0.8F));
if (!world.singleplayerWorld)
{
world.entityJoinedWorld(new EntityFish(world, entityplayer));
}
entityplayer.swingItem();
}
return itemstack;
}
示例2: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
int i1 = world.getBlockId(i, j, k);
Material material = world.getBlockMaterial(i, j + 1, k);
if (!material.isSolid() && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
{
Block block = Block.tilledField;
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, block.stepSound.func_737_c(),
(block.stepSound.func_738_a() + 1.0F)/2.0F, block.stepSound.func_739_b()*0.8F);
if (world.singleplayerWorld)
{
return true;
}
world.setBlockWithNotify(i, j, k, block.blockID);
itemstack.damageItem(1);
if (world.rand.nextInt(8) == 0 && i1 == Block.grass.blockID)
{
int j1 = 1;
for (int k1 = 0; k1 < j1; k1++)
{
float f = 0.7F;
float f1 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
float f2 = 1.2F;
float f3 = world.rand.nextFloat()*f + (1.0F - f)*0.5F;
var entityitem = new EntityItem(world, i + f1, j + f2, k + f3,
new ItemStack(seeds));
entityitem.delayBeforeCanPickup = 10;
world.entityJoinedWorld(entityitem);
}
}
return true;
}
else
{
return false;
}
}
示例3: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
int i1 = world.getBlockId(i, j, k);
if (i1 == 0)
{
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F,
itemRand.nextFloat()*0.4F + 0.8F);
world.setBlockWithNotify(i, j, k, Block.fire.blockID);
}
itemstack.damageItem(1);
return true;
}
示例4: hitEntity
public override void hitEntity(ItemStack itemstack, EntityLiving entityliving)
{
itemstack.damageItem(1);
}
示例5: hitBlock
public override void hitBlock(ItemStack itemstack, int i, int j, int k, int l)
{
itemstack.damageItem(2);
}