本文整理汇总了C#中ItemStack.getItemDamage方法的典型用法代码示例。如果您正苦于以下问题:C# ItemStack.getItemDamage方法的具体用法?C# ItemStack.getItemDamage怎么用?C# ItemStack.getItemDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemStack
的用法示例。
在下文中一共展示了ItemStack.getItemDamage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (world.getBlockId(i, j, k) == Block.snow.blockID)
{
l = 0;
}
else
{
if (l == 0)
{
j--;
}
if (l == 1)
{
j++;
}
if (l == 2)
{
k--;
}
if (l == 3)
{
k++;
}
if (l == 4)
{
i--;
}
if (l == 5)
{
i++;
}
}
if (itemstack.stackSize == 0)
{
return false;
}
if (world.canBlockBePlacedAt(blockID, i, j, k, false))
{
Block block = Block.blocksList[blockID];
if (world.setBlockAndMetadataWithNotify(i, j, k, blockID, getMetadata(itemstack.getItemDamage())))
{
Block.blocksList[blockID].onBlockPlaced(world, i, j, k, l);
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
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);
itemstack.stackSize--;
}
}
return true;
}
示例2: saddleEntity
public override void saddleEntity(ItemStack itemstack, EntityLiving entityliving)
{
if (entityliving is EntitySheep)
{
var entitysheep = (EntitySheep) entityliving;
int i = BlockCloth.func_21033_c(itemstack.getItemDamage());
if (!entitysheep.func_21069_f_() && entitysheep.getFleeceColor() != i)
{
entitysheep.setFleeceColor(i);
itemstack.stackSize--;
}
}
}
示例3: onItemUse
public override bool onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k,
int l)
{
if (itemstack.getItemDamage() == 15)
{
int i1 = world.getBlockId(i, j, k);
if (i1 == Block.sapling.blockID)
{
((BlockSapling) Block.sapling).func_21027_b(world, i, j, k, world.rand);
itemstack.stackSize--;
return true;
}
if (i1 == Block.crops.blockID)
{
((BlockCrops) Block.crops).func_21028_c(world, i, j, k);
itemstack.stackSize--;
return true;
}
}
return false;
}