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


C# World.setBlockMetadataWithNotify方法代码示例

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


在下文中一共展示了World.setBlockMetadataWithNotify方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.jukebox.blockID && world.getBlockMetadata(i, j, k) == 0)
     {
         world.setBlockMetadataWithNotify(i, j, k, (shiftedIndex - record13.shiftedIndex) + 1);
         world.playRecord(recordName, i, j, k);
         itemstack.stackSize--;
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:15,代码来源:ItemRecord.cs

示例2: ejectRecord

 public void ejectRecord(World world, int i, int j, int k, int l)
 {
     world.playRecord(null, i, j, k);
     world.setBlockMetadataWithNotify(i, j, k, 0);
     int i1 = (Item.record13.shiftedIndex + l) - 1;
     float f = 0.7F;
     double d = (world.rand.nextFloat()*f) + (1.0F - f)*0.5D;
     double d1 = (world.rand.nextFloat()*f) + (1.0F - f)*0.20000000000000001D +
                 0.59999999999999998D;
     double d2 = (world.rand.nextFloat()*f) + (1.0F - f)*0.5D;
     var entityitem = new EntityItem(world, i + d, j + d1, k + d2,
                                     new ItemStack(i1, 1, 0));
     entityitem.delayBeforeCanPickup = 10;
     world.entityJoinedWorld(entityitem);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:15,代码来源:BlockJukeBox.cs

示例3: blockActivated

 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     if (world.singleplayerWorld)
     {
         return true;
     }
     int l = world.getBlockMetadata(i, j, k);
     int i1 = l & 7;
     int j1 = 8 - (l & 8);
     world.setBlockMetadataWithNotify(i, j, k, i1 + j1);
     world.markBlocksDirty(i, j, k, i, j, k);
     world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "random.click", 0.3F,
                           j1 <= 0 ? 0.5F : 0.6F);
     world.notifyBlocksOfNeighborChange(i, j, k, blockID);
     if (i1 == 1)
     {
         world.notifyBlocksOfNeighborChange(i - 1, j, k, blockID);
     }
     else if (i1 == 2)
     {
         world.notifyBlocksOfNeighborChange(i + 1, j, k, blockID);
     }
     else if (i1 == 3)
     {
         world.notifyBlocksOfNeighborChange(i, j, k - 1, blockID);
     }
     else if (i1 == 4)
     {
         world.notifyBlocksOfNeighborChange(i, j, k + 1, blockID);
     }
     else
     {
         world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
     }
     return true;
 }
开发者ID:riverar,项目名称:Crafty,代码行数:36,代码来源:BlockLever.cs

示例4: onBlockPlaced

 public override void onBlockPlaced(World world, int i, int j, int k, int l)
 {
     int i1 = world.getBlockMetadata(i, j, k);
     int j1 = i1 & 8;
     i1 &= 7;
     if (l == 1 && world.isBlockOpaqueCube(i, j - 1, k))
     {
         i1 = 5 + world.rand.nextInt(2);
     }
     if (l == 2 && world.isBlockOpaqueCube(i, j, k + 1))
     {
         i1 = 4;
     }
     if (l == 3 && world.isBlockOpaqueCube(i, j, k - 1))
     {
         i1 = 3;
     }
     if (l == 4 && world.isBlockOpaqueCube(i + 1, j, k))
     {
         i1 = 2;
     }
     if (l == 5 && world.isBlockOpaqueCube(i - 1, j, k))
     {
         i1 = 1;
     }
     world.setBlockMetadataWithNotify(i, j, k, i1 + j1);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:27,代码来源:BlockLever.cs

示例5: onBlockPlacedBy

 public override void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
 {
     int l = MathHelper.floor_double(((entityliving.rotationYaw*4F)/360F) + 0.5D) & 3;
     world.setBlockMetadataWithNotify(i, j, k, l);
 }
开发者ID:riverar,项目名称:Crafty,代码行数:5,代码来源:BlockPumpkin.cs


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